#ifndef ONLINE_JUDGE #define _GLIBCXX_DEBUG #endif #include using namespace std; #if __has_include() #include using namespace atcoder; #endif template istream& operator>>(istream& is, pair& p) { return is >> p.first >> p.second; } template istream& operator>>(istream& is, vector& v) { for(auto& x : v) is >> x; return is; } template void in(T&... a) { (cin >> ... >> a); } template ostream& operator<<(ostream& o, const pair& p) { o << p.first << " " << p.second; return o; } template ostream& operator<<(ostream& o, const vector& v) { int i = 0; for(const auto& x : v) o << (i++ ? " " : "") << x; return o; } template ostream& operator<<(ostream& o, const vector>& v) { int i = 0; for(const auto& x : v) o << (i++ ? "\n" : "") << x; return o; } inline void out() { cout << "\n"; } template void out(const H& h, const T&... t) { cout << h; ((cout << " " << t), ...); cout << "\n"; } #ifndef ONLINE_JUDGE #if __has_include() #include #define dump(...) cpp_dump(__VA_ARGS__) namespace cp = cpp_dump; CPP_DUMP_SET_OPTION_GLOBAL(max_line_width, 120); CPP_DUMP_SET_OPTION_GLOBAL(log_label_func, cp::log_label::filename()); #else #define dump(x) cerr << #x << " = " << (x) << '\n' #endif #else #define dump(...) (void)0 #define CPP_DUMP_SET_OPTION(...) #define CPP_DUMP_DEFINE_EXPORT_OBJECT(...) #define CPP_DUMP_DEFINE_EXPORT_OBJECT_GENERIC(...) #define CPP_DUMP_DEFINE_EXPORT_ENUM(...) #define CPP_DUMP_DEFINE_EXPORT_ENUM_GENERIC(...) #endif using ll = long long; using ld = long double; #define all(v) (v).begin(),(v).end() #define rall(v) (v).rbegin(),(v).rend() #define OVERLOAD_REP(_1,_2,_3,name,...) name #define REP1(i,n) for (ll i = 0; (i) < (ll)(n); ++(i)) #define REP2(i, l, r) for (ll i = (ll)(l); (i) < (ll)(r); ++(i)) #define rep(...) OVERLOAD_REP(__VA_ARGS__, REP2, REP1)(__VA_ARGS__) #define RREP1(i, n) for (ll i = (ll)(n)-1; i>=0; --i) #define RREP2(i, l, r) for (ll i = (ll)(r)-1; i>=(ll)(l); --i) #define rrep(...) OVERLOAD_REP(__VA_ARGS__, RREP2, RREP1)(__VA_ARGS__) #define sz(a) ssize((a)) template inline bool chmin(T& a, const U& b) {if(a > b){a = b; return true;} else {return false;}} template inline bool chmax(T& a, const U& b) {if(a < b){a = b; return true;} else {return false;}} template inline bool inLR(const T& x, const U& n) {return 0 <= x && x < n;} template inline bool inLR(const T& x, const U& l, const V& r) {return l <= x && x < r;} template inline bool inGrid(const T& i, const U& j, const V& h, const W& w) {return inLR(i, h) && inLR(j, w);} inline void Yes(bool ok = true) {cout << (ok ? "Yes" : "No") << "\n";} inline void No() {cout << "No\n";} inline void YES(bool ok = true) {cout << (ok ? "YES" : "NO") << "\n";} inline void NO() {cout << "NO\n";} template inline auto ceil(T a, U b) {return (a + b - 1) / b;} const ll INF=(1LL<<60); const ll mod=998244353; const int dx[4] = {1, 0, -1, 0}; const int dy[4] = {0, 1, 0, -1}; const int dx2[8] = {1, 1, 1, 0, 0, -1, -1, -1}; const int dy2[8] = {1, 0, -1, 1, -1, 1, 0, -1}; using vll = vector; using vvll = vector>; using pll = pair; using vpll = vector; using vvpll = vector; template using minpq = priority_queue, greater>; struct Random { mt19937_64 rng; Random() : rng(random_device{}()) {} ll operator()(ll l, ll r) { uniform_int_distribution dist(l, r); return dist(rng); } vll perm(ll n) { vll p(n); iota(all(p), 0); shuffle(all(p), rng); return p; } vll vec(ll n, ll l, ll r) { vll a(n); for(auto& x : a) x = (*this)(l, r); return a; } vpll tree(ll n) { if(n < 2) return {}; vpll es; vll p(n - 2), d(n, 1); for(ll& v : p) d[v = (*this)(0, n - 1)]++; ll x = 0, l; while(d[x] != 1) x++; l = x; for(ll v : p) { es.push_back({l, v}); if(--d[v] == 1 && v < x) l = v; else { while(d[++x] != 1); l = x; } } es.push_back({l, n - 1}); return es; } vpll graph(ll n, ll m) { set st; vpll es; if(m < n - 1) { while(st.size() < m) { ll u = (*this)(0, n - 1), v = (*this)(0, n - 1); if(u > v) swap(u, v); if(u != v) st.insert({u, v}); } } else { es = tree(n); for(auto [u, v] : es) { if(u > v) swap(u, v); st.insert({u, v}); } while(st.size() < m) { ll u = (*this)(0, n - 1), v = (*this)(0, n - 1); if(u > v) swap(u, v); if(u != v && !st.count({u, v})) st.insert({u, v}); } } return vpll(all(st)); } } rnd; void solve() { ll n;in(n); const ll L = 1, R = 300000; rep(i, n-1) { rep(j, n) out(rnd(L, R)); } rep(i, n) { rep(j, n-1) out(rnd(L, R)); } } int main() { cin.tie(0); ios_base::sync_with_stdio(false); int t = 1; // cin >> t; while (t--) { solve(); } return 0; }