#include using namespace std; int pat[3][3] = { {2, 1, 1}, {1, 1, 2}, {1, 2, 1} }; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int N; cin >> N; vector cur = {2}; int mn = 1e9; int mn_ofs = 0; for(int ofs : {0, 1, 2}) { int sm = 0; for(int i = 0; i < N; i++) { for(int j = 0; j < i + 1; j++) { sm += pat[(i + ofs) % 3][j % 3]; } } if(mn > sm) { mn = sm; mn_ofs = ofs; } } for(int i = 0; i < N; i++) { for(int j = 0; j < i + 1; j++) { cout << pat[(i + mn_ofs) % 3][j % 3] << " "; } cout << "\n"; } return 0; }