#include using namespace std; int main() { int n; cin >> n; if (n <= 5) { int num_confs = 1; for (int i = 1; i <= n; ++i) { num_confs *= n; } vector p(n); map, int> freq; for (int conf_ = 0; conf_ < num_confs; ++conf_) { int conf = conf_; iota(p.begin(), p.end(), 0); for (int i = 0; i < n; ++i) { swap(p[i], p[conf % n]); conf /= n; } ++freq[p]; } int mx_chx = 0, mn_chx = 1 << 30; for (auto it : freq) { mx_chx = max(mx_chx, it.second); mn_chx = min(mn_chx, it.second); } for (auto it : freq) { if (it.second == mx_chx) { for (auto x : it.first) { cout << x + 1 << ' '; } cout << '\n'; break; } } for (auto it : freq) { if (it.second == mn_chx) { for (auto x : it.first) { cout << x + 1 << ' '; } cout << '\n'; break; } } return 0; } for (int i = 0, half = (n + 1) / 2; i < n; ++i) { cout << ((i < half) ? (i + 1) % half + 1 : (i - half + 1) % (n - half) + half + 1) << " \n"[i == n - 1]; } for (int i = 0; i < n; ++i) { cout << (i - 1 + n) % n + 1 << " \n"[i == n - 1]; } }