// #ifndef LOCAL #pragma GCC optimize("Ofast") #pragma GCC target("avx2") #pragma GCC optimize("unroll-loops") // #pragma GCC target("sse,sse2,sse3,ssse3,sse4,fma,abm,mmx,avx,avx2,avx512f") #include // #else // #include // #endif using namespace std; using ll = long long; using ld = long double; template using V = vector; template using P = pair; template using max_heap = priority_queue; template using min_heap = priority_queue,greater>; #define OVERLOADER(_1,_2,_3,NAME,...) NAME #define REP2(i,a,b) for (ll i = (a); i < (ll)(b); ++i) #define REP(i,n) REP2(i,0,n) #define rep(...) OVERLOADER(__VA_ARGS__,REP2,REP)(__VA_ARGS__) #define pb push_back #define eb emplace_back #define ALL(a) a.begin(),a.end() #define RALL(a) a.rbegin(),a.rend() template inline bool chmin(T &a, U b) { if(a>b) {a=b; return 1;} return 0;} template inline bool chmax(T &a, U b) { if(a(lhs, rhs);} ll min (ll lhs, ll rhs) {return std::min(lhs, rhs);} templatevoid uniqify(V& v){v.erase(unique(ALL(v)),v.end());} templateV compress(V& v){Vvals=v;sort(ALL(vals));uniqify(vals);rep(i,v.size())v[i]=lower_bound(ALL(vals),v[i])-vals.begin();return vals;} templateV sum_array(V& v) {int n=v.size(); V sum(n+1); rep(i,n) sum[i+1]=sum[i]+v[i]; return sum;} // inputs template istream& operator>>(istream& is,P&p){return is>>p.first>>p.second;} template istream& operator>>(istream& is,V&v){for(T& e:v) is>>e; return is;} // outputs template ostream& operator<<(ostream& os,P& p){return os< ostream& operator<<(ostream& os,set& v) {os<<'{';for(auto&l:v){os< ostream& operator<<(ostream& os,map& m){os<<'{';for(auto&p:m) {os< ostream& operator<<(ostream& os,V& v) {int ss=v.size(); rep(ii,ss) {os<inline void drop(T&& x) { cout << x << endl; exit(0); } constexpr char ENDL = '\n'; inline void yesno(bool f) { cout << (f ? "Yes" : "No") << ENDL; } constexpr ll INF = (1LL<<30)-1; // 問題毎にfit constexpr ll INFLL = (1LL<<62)-1; // 問題毎にfit const ld PI = acos(static_cast(-1)); constexpr int dy[]={0, 1, 0, -1}; constexpr int dx[]={1, 0, -1, 0}; // constexpr int dy[]={0, 1, 1, 1, 0, -1, -1, -1}; // constexpr int dx[]={1, 1, 0, -1, -1, -1, 0, 1}; struct IO_Setting{IO_Setting(){cin.tie(nullptr);ios_base::sync_with_stdio(false);cout< // ac-library using namespace atcoder; // ac-library std::ostream &operator<<(std::ostream &os, const modint998244353 &a) {return os< void debug_out(Head H, Tail... T) { cerr << ", " << H; debug_out(T...); } #define debug(...) cerr << "Line " << __LINE__ << " : " << #__VA_ARGS__ << " ,,", debug_out(__VA_ARGS__) #else #define debug(...) (void(0)) #endif // using mint = modint1000000007; // using mint = modint998244353; int main() { int n; cin>>n; V s; rep(i, n) s.push_back(-1); rep(i, n) s.push_back(1); // 括弧列を全探索 16C8 ~ 12000 do { // 区切り方を全探索 V div; rep(i, n) div.push_back(0); rep(i, n-1) div.push_back(1); do { V> ss(n); int ind = 0; rep(i, 2*n) { ss[ind].push_back(s[i]); if(i == 2*n-1) break; if(div[i]==1) ind++; } bool isunique = 1; rep(i, n) rep(j, i+1, n) if(ss[i]==ss[j]) isunique = 0; if(!isunique) continue; sort(ALL(ss)); // unique な順列かを判定 int oks = 0; do { V tmp; rep(i, n) for(auto ii : ss[i]) tmp.push_back(ii); int sum = 0; bool isok = 1; rep(i, 2*n) if((sum += tmp[i]) < 0) isok = 0; if(isok) oks++; } while(next_permutation(ALL(ss))); if(oks == 1) { // 出力して終了 rep(i, n) { for(auto ii:ss[i]) cout << (ii==1?'(':')'); cout << endl; } return 0; } } while(next_permutation(ALL(div))); } while(next_permutation(ALL(s))); }