#ifdef LOCAL #include #else #pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx2,popcnt,lzcnt,abm,bmi,bmi2") #include #define debug(...) ((void)0) #define postprocess(...) ((void)0) #endif using namespace std; using ll = long long; using ld = long double; vector p6 = {1, 4, 3, 6, 5, 2}; vector p9 = {1, 2, 8, 3, 6, 9, 7, 5, 4}; void solve([[maybe_unused]] int test) { int N; cin >> N; if (N == 1) { cout << -1 << endl; return; } vector ans1, ans2, ans3; int next = 0; if (N % 2 == 0) { ans1.push_back(p6[0]); ans1.push_back(p6[1]); ans2.push_back(p6[2]); ans2.push_back(p6[3]); ans3.push_back(p6[4]); ans3.push_back(p6[5]); next = 7; } else { ans1.push_back(p9[0]); ans1.push_back(p9[1]); ans1.push_back(p9[2]); ans2.push_back(p9[3]); ans2.push_back(p9[4]); ans2.push_back(p9[5]); ans3.push_back(p9[6]); ans3.push_back(p9[7]); ans3.push_back(p9[8]); next = 10; } // {0, 3, 2, 5, 4, 1}; while (next < 3 * N) { ans1.push_back(next + 0); ans1.push_back(next + 3); ans2.push_back(next + 2); ans2.push_back(next + 5); ans3.push_back(next + 4); ans3.push_back(next + 1); next += 6; } for (auto&& x : ans1) { cout << x << " "; } for (auto&& x : ans2) { cout << x << " "; } for (auto&& x : ans3) { cout << x << " "; } cout << endl; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int t = 1; // cin >> t; for (int i = 1; i <= t; i++) { solve(i); } postprocess(); }