#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int Rand(int l, int h){
return uniform_int_distribution<int>(l, h)(rng);
}
int main(){
int n = Rand(1, 100); // length of the regular bracket is 2 * n
stack<char> st;
int pref = 0;
for (int i = 1; i <= n; ++i){
int x = Rand(0, 1);
if (x == 1){
pref ++;
st.push('(');
cout << '(';
}
else{
if (pref > 0) {
pref--; st.push(')');
cout << ')';
}
else{
pref++; st.push('(');
cout << '(';
}
}
}
while(st.size()){
char c = st.top(); st.pop();
cout << (c == '(' ? ')' : '(');
}
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwptdDE5OTM3IHJuZyhjaHJvbm86OnN0ZWFkeV9jbG9jazo6bm93KCkudGltZV9zaW5jZV9lcG9jaCgpLmNvdW50KCkpOwoKaW50IFJhbmQoaW50IGwsIGludCBoKXsKICAgIHJldHVybiB1bmlmb3JtX2ludF9kaXN0cmlidXRpb248aW50PihsLCBoKShybmcpOwp9CmludCBtYWluKCl7CiAgICBpbnQgbiA9IFJhbmQoMSwgMTAwKTsgLy8gbGVuZ3RoIG9mIHRoZSByZWd1bGFyIGJyYWNrZXQgaXMgMiAqIG4KICAgIHN0YWNrPGNoYXI+IHN0OwogICAgaW50IHByZWYgPSAwOwogICAgZm9yIChpbnQgaSA9IDE7IGkgPD0gbjsgKytpKXsKICAgICAgICBpbnQgeCA9IFJhbmQoMCwgMSk7CiAgICAgICAgaWYgKHggPT0gMSl7CiAgICAgICAgICAgIHByZWYgKys7CiAgICAgICAgICAgIHN0LnB1c2goJygnKTsKICAgICAgICAgICAgY291dCA8PCAnKCc7CiAgICAgICAgfQogICAgICAgIGVsc2V7CiAgICAgICAgICAgIGlmIChwcmVmID4gMCkgewogICAgICAgICAgICAgICAgcHJlZi0tOyBzdC5wdXNoKCcpJyk7CiAgICAgICAgICAgICAgICBjb3V0IDw8ICcpJzsKICAgICAgICAgICAgfQogICAgICAgICAgICBlbHNlewogICAgICAgICAgICAgICAgcHJlZisrOyBzdC5wdXNoKCcoJyk7CiAgICAgICAgICAgICAgICBjb3V0IDw8ICcoJzsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgIH0KICAgIHdoaWxlKHN0LnNpemUoKSl7CiAgICAgICAgY2hhciBjID0gc3QudG9wKCk7IHN0LnBvcCgpOwogICAgICAgIGNvdXQgPDwgKGMgPT0gJygnID8gJyknIDogJygnKTsKICAgIH0KfQ==