#include using namespace std; typedef long long ll; const int N = 1005; string beg[4][6] = { { "80044 ", "68802 ", "57731 ", "544714", "433000", "566212" }, { "45 ", "31 ", "31 ", "000", "515", "344" }, { "566", "355", "144", "0336", "0224", "0112" }, { "1388 ", "3276 ", "7245 ", "01158", "02344", "07656" } }; string mid[6] = { "1388 ", "3276 ", "7245 ", " 1158", " 2344", " 7656" }; string ed[6] = { "937", "315", "715", " 99", " 13", " 75" }; char res[6][N]; int now = 0; inline void prt(string *a, int len) { for (int i = 0; i < 6; i++) for (int j = 0; j <= len; j++) if (isdigit(a[i][j])) res[i][now + j] = a[i][j]; now += len; } int main() { cin.tie(0)->sync_with_stdio(0); // freopen("game.in", "r", stdin); // freopen("game.out", "w", stdout); int n; cin >> n; if (n == 1) { cout << "1\n0\n0\n0\n1\n1\n"; return 0; } if (n == 2) { cout << "-1\n"; return 0; } if (n == 4) { cout << "1776\n7664\n0223\n0112\n0553\n5443\n"; return 0; } if (n == 3) { res[3][0] = res[4][0] = res[5][0] = '2'; prt(ed, 2); } else { prt(beg[n % 4], (n - 1) % 4 + 2); for (int i = 1; i < (n - 1) / 4; i++) prt(mid, 4); prt(ed, 2); } for (int j = 0; j < 6; j++, cout << '\n') for (int i = 0; i <= now; i++) cout << res[j][i]; return 0; }