#include using namespace std; using ll = long long; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main() { cin.tie(nullptr); ios_base::sync_with_stdio(false); int n; cin >> n; vector a(n, vector(n)); vector b(n, vector(n)); rep(i, n) rep(j, n) { a[i][j] = i + 1; b[i][j] = j + 1; } rep(i, n) rep(j, n) { if (i < j) continue; if ((i + j) % 2) { swap(a[i][j], a[j][i]); swap(b[i][j], b[j][i]); } } rep(i, n) { rep(j, n) cout << a[i][j] << " "; cout << endl; } rep(i, n) { rep(j, n) cout << b[i][j] << " "; cout << endl; } return 0; }