#include using namespace std; #define int long long #define INF (int)1e18 #define f first #define s second mt19937_64 RNG(chrono::steady_clock::now().time_since_epoch().count()); vector s1, s2, s3; void work2(vector a){ int n = a.size(); int m = n / 3; for (int i = 0; i < m; i++){ s1.push_back(a[i]); s2.push_back(a[i + m]); s3.push_back(a[i + 2 * m]); } } void work(int n){ if (n == 2){ work2({1, 4, 3, 6, 5, 2}); } else if (n == 3){ work2({1, 2, 8, 3, 6, 9, 7, 5, 4}); } else if (n == 4){ work2({1, 2, 4, 11, 7, 9, 10, 12, 8, 5, 6, 3}); } else if (n == 5) { work2({1, 2, 3, 8, 13, 7, 10, 12, 14, 15, 11, 9, 6, 4, 5}); } else { work(n - 4); int m = 3 * n - 12; work2({m + 5, m + 8, m + 10, m + 11, m + 1, m + 2, m + 3, m + 4, m + 6, m + 7, m + 9, m + 12}); } } void Solve() { int n; cin >> n; if (n == 1){ cout << -1 << "\n"; return; } work(n); int v1 = 0, v2 = 0; vector ok(3 * n + 1, false); for (int i = 0; i < n; i++){ v1 += s1[i] * s2[i]; v2 += s2[i] * s3[i]; ok[s1[i]] = true; ok[s2[i]] = true; ok[s3[i]] = true; } for (auto x : s1) cout << x << " "; for (auto x : s2) cout << x << " "; for (auto x : s3) cout << x << " "; if (v1 != v2){ cout << "NOOO\n"; } for (int i = 1; i <= 3 * n; i++) if (!ok[i]){ cout << "NOOB\n"; } } int32_t main() { auto begin = std::chrono::high_resolution_clock::now(); ios_base::sync_with_stdio(0); cin.tie(0); int t = 1; // freopen("in", "r", stdin); // freopen("out", "w", stdout); // cin >> t; for(int i = 1; i <= t; i++) { //cout << "Case #" << i << ": "; Solve(); } auto end = std::chrono::high_resolution_clock::now(); auto elapsed = std::chrono::duration_cast(end - begin); cerr << "Time measured: " << elapsed.count() * 1e-9 << " seconds.\n"; return 0; }