#ifdef NACHIA #define _GLIBCXX_DEBUG #else // disable assert #define NDEBUG #endif #include #include #include #include using namespace std; using ll = long long; const ll INF = 1ll << 60; #define REP(i,n) for(ll i=0; i using V = vector; template void chmax(A& l, const B& r){ if(l < r) l = r; } template void chmin(A& l, const B& r){ if(r < l) l = r; } V f4 = { "###.###", "#.#...#", "#.#.###", "#...#..", "#####.#", "..#.#.#", "###.###" }; V f5 = { "#######.#", "#.....#.#", "#####.###", "#.....#.#", "#.###.#.#", "#...#.#.#", "#####.#.#", "........#", "#########" }; V f6 = { "#########.#", "#.......#.#", "#######.###", "..........#", "#######.###", "#.....#...#", "#####.###.#", "#.......#.#", "###.#####.#", "....#.....#", "###########" }; V ex = { "#.#.#", "....#", "#.###", "..#..", "#####" }; V G(ll N){ V ans(N*2-1, string(N*2-1, '.')); REP(i,N) REP(j,N) ans[i*2][j*2] = '#'; while(N >= 7){ REP(f,3) REP(j,N*2-5) ans[N*2-2-f*2][j] = '#'; REP(f,3) REP(j,N*2-5) ans[j][N*2-2-f*2] = '#'; ans[0][(N-2)*2+1] = ans[0][(N-3)*2+1] = '#'; ans[(N-2)*2+1][0] = '#'; ans[(N-3)*2-1][0] = '#'; REP(i,5) REP(j,5) ans[N*2-6+i][N*2-6+j] = ex[i][j]; N -= 3; } auto buf = f4; if(N == 5) buf = f5; if(N == 6) buf = f6; ll K = buf.size(); REP(i,K) REP(j,K) ans[i][j] = buf[j][K-1-i]; return ans; } void testcase(){ ll N; cin >> N; if(N <= 3){ cout << "-1\n"; return; } auto ans = G(N); // for(auto& a : ans) cout << a << "\n"; auto idx = [&](ll y, ll x){ return y*N+x +1; }; REP(i,N) REP(j,N-1) if(ans[i*2][j*2+1] == '#'){ cout << idx(i,j) << " " << idx(i,j+1) << "\n"; } REP(i,N-1) REP(j,N) if(ans[i*2+1][j*2] == '#'){ cout << idx(i,j) << " " << idx(i+1,j) << "\n"; } // cout << endl; } int main(){ cin.tie(0)->sync_with_stdio(0); testcase(); return 0; }