#include // #include using namespace std; // using namespace atcoder; #define rep(i, a, n) for(int i = a; i < n; i++) #define rrep(i, a, n) for(int i = a; i >= n; i--) #define inr(l, x, r) (l <= x && x < r) #define ll long long #define ld long double // using mint = modint1000000007; // using mint = modint998244353; constexpr int IINF = 1001001001; constexpr ll INF = 1e18; template void chmax(t&a,u b){if(a void chmin(t&a,u b){if(b> n; vector> ans; int sum = IINF; rep(k, 0, 3){ int tmp = 0; vector> now(n, vector(n, 1)); rep(i, 0, n){ tmp++; if(i%3 == k) now[n-1][i] = 2, tmp++; } rrep(i, n-1, 1){ rep(j, 0, i){ if(now[i][j] == 1 && now[i][j+1] == 1) now[i-1][j] = 2, tmp++; tmp++; } } if(tmp < sum){ sum = tmp; ans = now; } } rep(i, 0, n){ rep(j, 0, i+1){ cout << ans[i][j] << ' '; } cout << endl; } return 0; }