#include using namespace std; //* ATCODER #include using namespace atcoder; typedef modint998244353 mint; //*/ /* BOOST MULTIPRECISION #include using namespace boost::multiprecision; //*/ typedef long long ll; #define rep(i, s, n) for (int i = (int)(s); i < (int)(n); i++) #define rrep(i, s, n) for (int i = (int)(n)-1; i >= (int)(s); i--) template bool chmin(T &a, const T &b) { if (a <= b) return false; a = b; return true; } template bool chmax(T &a, const T &b) { if (a >= b) return false; a = b; return true; } template T max(vector &a){ assert(!a.empty()); T ret = a[0]; for (int i=0; i<(int)a.size(); i++) chmax(ret, a[i]); return ret; } template T min(vector &a){ assert(!a.empty()); T ret = a[0]; for (int i=0; i<(int)a.size(); i++) chmin(ret, a[i]); return ret; } template T sum(vector &a){ T ret = 0; for (int i=0; i<(int)a.size(); i++) ret += a[i]; return ret; } void validation(int n, vector p){ assert(p.size() == 3 * n); vector dar(3 * n); rep(i,0,3 * n){ assert(1 <= p[i] && p[i] <= 3 * n); assert(dar[p[i] - 1] == 0); dar[p[i] - 1] = 1; } ll t = 0; rep(i,0,n){ t += p[i] * p[i+n]; t -= p[i+n] * p[i+2*n]; } assert(t == 0); } int main(){ int n; cin >> n; vector> small = { {-1}, {-1}, {1, 4, 3, 6, 5, 2}, {2, 9, 1, 6, 7, 8, 5, 3, 4}, {7, 10, 2, 8, 1, 3, 11, 9, 6, 12, 4, 5}, }; if (n <= 4){ int m = small[n].size(); //validation(n, small[n]); rep(i,0,m){ cout << small[n][i] << ' '; } cout << '\n'; }else{ vector base; if (n % 3 == 0){ base = small[3]; }else if(n % 3 == 1){ base = small[4]; }else if(n % 3 == 2){ base = small[2]; } vector up; vector middle; vector down; rep(i,0,(int)base.size() / 3){ up.push_back(base[i]); } rep(i,(int)base.size() / 3, (int)base.size() / 3 * 2){ middle.push_back(base[i]); } rep(i,(int)base.size() / 3 * 2, (int)base.size() / 3 * 3){ down.push_back(base[i]); } while((int)up.size() < n){ int k = (int)up.size() * 3; rep(i,0,3){ up.push_back(small[3][i] + k); } rep(i,3,6){ middle.push_back(small[3][i] + k); } rep(i,6,9){ down.push_back(small[3][i] + k); } } vector ans; for (int i: up) ans.push_back(i); for (int i: middle) ans.push_back(i); for (int i: down) ans.push_back(i); int m = ans.size(); //validation(n, ans); rep(i,0,m){ cout << ans[i] << ' '; } cout << '\n'; } }