#define _USE_MATH_DEFINES #include using namespace std; #define FOR(i,m,n) for(int i=(m);i<(n);++i) #define REP(i,n) FOR(i,0,n) #define ALL(v) (v).begin(),(v).end() using ll = long long; const int INF = 0x3f3f3f3f; const ll LINF = 0x3f3f3f3f3f3f3f3fLL; const double EPS = 1e-8; const int MOD = 1000000007; // const int MOD = 998244353; const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1}; const int dy8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dx8[] = {0, -1, -1, -1, 0, 1, 1, 1}; template inline bool chmax(T &a, U b) { return a < b ? (a = b, true) : false; } template inline bool chmin(T &a, U b) { return a > b ? (a = b, true) : false; } struct IOSetup { IOSetup() { cin.tie(nullptr); ios_base::sync_with_stdio(false); cout << fixed << setprecision(20); } } iosetup; bool solveB(int); vector ans, sub; bool solveA(int n) { if (n == 1) { ans.emplace_back(0); ans.emplace_back(0); ans.emplace_back(0); return sub.empty(); } if (n == 2) return false; int nx = n / 2; if (n & 1) { for (int i = n - 1; i >= nx; --i) { ans.emplace_back(i); ans.emplace_back(i); } for (int i = n - 1; i >= nx; --i) { ans.emplace_back(i); } return solveA(nx); } else { if (sub.empty()) { FOR(i, nx, n) { ans.emplace_back(i); } ans.emplace_back(n - 1); FOR(i, nx, n - 1) { ans.emplace_back(i); ans.emplace_back(i); } sub.emplace_back(n - 1); } else { ans.emplace_back(n - 1); ans.emplace_back(sub[0]); sub.pop_back(); for (int i = n - 2; i >= nx; --i) { ans.emplace_back(i); ans.emplace_back(i); } ans.emplace_back(n - 1); for (int i = n - 1; i >= nx; --i) { ans.emplace_back(i); } } return solveB(nx); } } bool solveB(int n) { if (n == 1) return false; int nx = n / 2; if (n & 1) { for (int i = n - 1; i >= nx; --i) { ans.emplace_back(i); ans.emplace_back(i); } for (int i = n - 1; i >= nx; --i) { ans.emplace_back(i); } return solveB(nx); } else { if (sub.empty()) { FOR(i, nx, n) { ans.emplace_back(i); } ans.emplace_back(n - 1); FOR(i, nx, n) { ans.emplace_back(i); ans.emplace_back(i); } ans.pop_back(); sub.emplace_back(n - 1); } else { ans.emplace_back(n - 1); ans.emplace_back(sub[0]); sub.pop_back(); for (int i = n - 2; i >= nx; --i) { ans.emplace_back(i); ans.emplace_back(i); } ans.emplace_back(n - 1); for (int i = n - 1; i >= nx; --i) { ans.emplace_back(i); } } return solveA(nx); } } int main() { int n; cin >> n; if (n == 2) { cout << "-1\n"; return 0; } if (solveA(n)) { REP(i, 3 * n) cout << ans[i] << " \n"[i + 1 == 3 * n]; return 0; } ans.clear(); sub.clear(); if (solveB(n)) { REP(i, 3 * n) cout << ans[i] << " \n"[i + 1 == 3 * n]; return 0; } assert(false); }