#include <iostream>
using namespace std;
int main() {
int n;
cout << "n=";
cin >> n;
int A[n+1][n+1];
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= n; j++) {
A[i][j] = (i%2 == 1? i : j);
}
}
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= n; j++) {
cout << A[i][j]<< " ";
}
cout << endl;
}
return 0;
}