#include<bits/stdc++.h>
using namespace std;
//p5725
int main() {
int n;
cin >> n;
int ans = 1;
for (int i = 0; i < n; i++) {//4x4矩阵
for (int j = 0; j < n; j++) {
if (ans < 10)
cout << "0" << ans++;//小于十补0
else
cout << ans++;
}
cout << endl;
}
cout << endl;
ans = 1;
int temp = n - 1;
for (int i = 0; i < n; i++) {
for (int j = 0;j<n; j++) {
if (j >= temp) {//4*4 第一行在下标三的地方 第二行在下标二的地方开始 依此类推
if (ans < 10)
cout << "0" << ans++;
else
cout << ans++;
}
else
cout << " ";//输出两个空格占位置
}
temp--;
cout << endl;
}
system("pause");
return 0;
}