#include<iostream>
using namespace std;
int main() {
int n,cnt=1,k=1,j,m;
cin >> n;
//输出矩阵
for (int i = 1; i <= n; i++) {//代表列
for (int j = 1; j <= n; j++) {//代表行
if (cnt < 10) {
cout.fill('0');//设置填充字符
cout.width(2);//设置域宽
cout << cnt;
cnt++;
}
else {
cout << cnt;
cnt++;
}
}
cout << '\n';
cout << '\n';//输出换行
}
cnt = 1;
cout << '\n' << endl;//三角矩阵换行
//输出三角
for (int i = 1; i <= n; i++) {//代表行
for (m =n - k; m >0; m--) {
cout << ' '<<' ';
}
for (j = 1; j <= k; j++) {//代表列
if (cnt < 10) {
cout.fill('0');//设置填充字符
cout.width(2);//设置域宽
cout << cnt;
cnt++;
}
else {
cout << cnt;
cnt++;
}
}
k++;
cout << '\n';
cout << '\n';//输出换行
}
return 0;
}