//A rekla je da voli me k'o sto nikog nije
//Danima srce boli me, ali nema leka
//Lazem da ce biti bolje, jer to jace je od droge

//U meni k'o da gori sve dok crna kisa lije
//Alkohola tone pijem, nek me nosi reka
//Lazes da ce biti bolje, ma to jace je od droge
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define ldb long double
#define mt make_tuple
#define pii pair<int,int>
const int N=1050;
int q;
int len[N],k[N];
ll t[N];
char ans[N][N];
bool ok[N];
void input(){
	scanf("%i",&q);
	for(int i=1;i<=q;i++)scanf("%i %i %lld",&len[i],&k[i],&t[i]);
}
void output(){
	for(int i=1;i<=q;i++){
		if(!ok[i])printf("Ne postoji\n");
		else printf("%s\n",ans[i]+1);
	}
}
const ll inf=2e18;
const int K=105;
ll dp[K][K][K];
void Pref(int i){
	for(int j=0;j<=100;j++){
		for(int l=1;l<=100;l++){
			dp[i][j][l]+=dp[i][j][l-1];
			if(dp[i][j][l]>inf)dp[i][j][l]=inf;
		}
	}
}
void Preprocess(){
	for(int j=0;j<=100;j++)
		for(int l=0;l<=100;l++)
			dp[0][j][l]=0;
	dp[0][0][0]=1;
	for(int i=1;i<=100;i++){
		for(int j=0;j<=100;j++){
			for(int l=0;l<=100;l++){
				dp[i][j][l]=0;
				if(j!=0)dp[i][j][l]+=dp[i-1][j-1][l];
				dp[i][j][l]+=dp[i-1][j+1][l];
				if(j==0 && l!=0)dp[i][j][l]+=dp[i-1][j][l-1];
				if(dp[i][j][l]>inf)dp[i][j][l]=inf;
			}
		}
		Pref(i-1);
	}
	Pref(100);
}
void SlowDP(){
	Preprocess();
	for(int i=1;i<=q;i++){
		ll T=t[i];
		int bal=0,cnt=0;
		for(int j=1;j<=len[i];j++){
			int n=len[i]-j;
			ll lo=0;
			for(int b=0;b<=100;b++){
				int can=k[i]-cnt-abs(bal+1-b);
				if(can>=0){
					lo+=dp[n][b][can];
					if(lo>inf)lo=inf;
				}
				//for(int o=0;o<=k[i];o++){
				//	if(o+cnt+abs(bal+1-b)<=k[i]){
				//		lo+=dp[n][b][o];
				//		lo=min(lo,inf);
				//	}
				//}
			}
			//printf("(%i %i %i)\n",i,j,lo);
			if(lo>=T){
				ans[i][j]='(';
				bal++;
			}else{
				if(bal==0)cnt++;
				else bal--;
				ans[i][j]=')';
				T-=lo;
			}
		}
		if(cnt+bal<=k[i] && T==1)ok[i]=1;
		else ok[i]=0;
	}
}
void SubTask2(){
	for(int i=1;i<=q;i++){
		ll T=t[i];
		int bal=0,cnt=0;
		for(int j=1;j<=len[i];j++){
			int n=len[i]-j;
			ll lo=(n>60)?inf:(ll)1<<n;
			if(lo>=T){
				ans[i][j]='(';
				bal++;
			}else{
				if(bal==0)cnt++;
				else bal--;
				ans[i][j]=')';
				T-=lo;
			}
		}
		if(cnt+bal<=k[i] && T==1)ok[i]=1;
		else ok[i]=0;
	}
}
ll catalan[1005][1005];
void SubTask3(){
	catalan[0][0]=1;
	for(int j=1;j<=1000;j++)catalan[0][j]=0;
	for(int i=1;i<=1000;i++){
		for(int j=0;j<=1000;j++){
			catalan[i][j]=catalan[i-1][j+1];
			if(j!=0)catalan[i][j]+=catalan[i-1][j-1];
			if(catalan[i][j]>inf)catalan[i][j]=inf;
		}
	}
	for(int i=1;i<=q;i++){
		ll T=t[i];
		int bal=0,cnt=0;
		for(int j=1;j<=len[i];j++){
			int n=len[i]-j;
			ll lo=catalan[n][bal+1];
			if(lo>=T){
				ans[i][j]='(';
				bal++;
			}else{
				if(bal==0)cnt++;
				else bal--;
				ans[i][j]=')';
				T-=lo;
			}
		}
		if(cnt+bal<=k[i] && T==1)ok[i]=1;
		else ok[i]=0;
	}
}
const int S=20;
namespace FastDP{
	ll dp[N/S+1][N][K];
	ll tmp[2][N][K];
	int now=1,pre=0;
	void upd(){
		swap(now,pre);
		for(int j=0;j<=1000;j++){
			for(int l=0;l<=100;l++){
				tmp[now][j][l]=0;
				if(j!=0)tmp[now][j][l]+=tmp[pre][j-1][l];
				tmp[now][j][l]+=tmp[pre][j+1][l];
				if(j==0 && l!=0)tmp[now][j][l]+=tmp[pre][j][l-1];
				if(tmp[now][j][l]>inf)tmp[now][j][l]=inf;
			}
		}
	}
	void Copy_to(int i){
		for(int j=0;j<=1000;j++)
			for(int l=0;l<=100;l++)
				dp[i][j][l]=tmp[now][j][l];
	}
	void Copy_from(int i){
		for(int j=0;j<=1000;j++)
			for(int l=0;l<=100;l++)
				tmp[now][j][l]=dp[i][j][l];
	}
	void Pref(){
		for(int j=0;j<=1000;j++)
			for(int l=1;l<=100;l++){
				tmp[now][j][l]+=tmp[now][j][l-1];
				if(tmp[now][j][l]>inf)tmp[now][j][l]=inf;
			}
	}
};
int bal[N],cnt[N];
ll T[N];
void Solve(){
	for(int j=0;j<=1000;j++)
		for(int l=0;l<=100;l++)
			FastDP::tmp[FastDP::now][j][l]=0;
	FastDP::tmp[FastDP::now][0][0]=1;
	FastDP::Copy_to(0);
	for(int i=1;i<=1000;i++){
		FastDP::upd();
		if(i%S==0)FastDP::Copy_to(i/S);
	}
	int mxn=0;
	for(int i=1;i<=q;i++)T[i]=t[i],bal[i]=cnt[i]=0,mxn=max(mxn,len[i]);
	for(int n=mxn-1;n>=0;n--)
	{
		int taj=n/S;
		FastDP::Copy_from(taj);
		for(int i=taj*S;i<n;i++)FastDP::upd();
		FastDP::Pref();
		for(int i=1;i<=q;i++)if(len[i]>n){
			ll lo=0;
			for(int j=max(0,bal[i]-k[i]+cnt[i]);j<=min(1000,bal[i]+1+k[i]-cnt[i]);j++){
				int can=k[i]-cnt[i]-abs(bal[i]+1-j);
				if(can>=0){
					lo+=FastDP::tmp[FastDP::now][j][can];
					if(lo>=inf)lo=inf;
				}
			}
			if(lo>=T[i]){
				ans[i][len[i]-n]='(';
				bal[i]++;
			}else{
				if(bal[i]==0)cnt[i]++;
				else bal[i]--;
				ans[i][len[i]-n]=')';
				T[i]-=lo;
			}
		}
	}
	for(int i=1;i<=q;i++){
		if(bal[i]+cnt[i]<=k[i] && T[i]==1)ok[i]=1;
		else ok[i]=0;
	}
}
void Run(){
	input();
	bool all_n=1,all_0=1;
	for(int i=1;i<=q;i++)all_n&=k[i]==len[i];
	for(int i=1;i<=q;i++)all_0&=k[i]==0;
	int mxn=0;
	for(int i=1;i<=q;i++)mxn=max(mxn,len[i]);
	if(all_n)SubTask2();
	else if(all_0)SubTask3();
	else if(mxn<=100)SlowDP();
	else Solve();
	output();
}
void BruteForce(){
	for(int i=1;i<=q;i++){
		vector<string> all;
		for(int mask=0;mask<1<<len[i];mask++){
			string tmp;
			for(int j=0;j<len[i];j++)tmp+=(mask>>j&1)?'(':')';
			int bal=0,cnt=0;
			for(int j=0;j<len[i];j++){
				if(tmp[j]=='(')bal++;
				else{
					if(bal==0)cnt++;
					else bal--;
				}
			}
			if(bal+cnt<=k[i])all.pb(tmp);
		}
		sort(all.begin(),all.end());
		if(all.size()<t[i])ok[i]=0;
		else{
			ok[i]=1;
			for(int j=0;j<len[i];j++)ans[i][j+1]=all[t[i]-1][j];
		}
	}
}
mt19937_64 rng(time(0));
void MakeTestCase(){
	//q=rng()%1000+1;
	q=1000;
	//q=1;
	for(int i=1;i<=q;i++){
		//len[i]=rng()%100+1;
		//len[i]=rng()%100+1;
		//len[i]=rng()%10+1;
		//k[i]=rng()%101;//rng()%len[i];
		//t[i]=rng()%((ll)1<<60)+1;
		len[i]=rng()%10+1;
		k[i]=rng()%(len[i]+1);
		t[i]=rng()%(1<<len[i])+1;
	}
}
char ans2[N][N];
bool ok2[N];
bool Compare(){
	for(int i=1;i<=q;i++){
		if(ok2[i]!=ok[i])return 0;
		if(ok[i]){
			for(int j=1;j<=len[i];j++)
				if(ans[i][j]!=ans2[i][j])
					return 0;
		}
	}
	return 1;
}
void Print(){
	printf("%i\n",q);
	for(int i=1;i<=q;i++){
		printf("%i %i %lld\n",len[i],k[i],t[i]);
		if(!ok2[i])printf("Nema");
		else for(int j=1;j<=len[i];j++)printf("%c",ans2[i][j]);
		printf("\n");
		if(!ok[i])printf("Nema");
		else for(int j=1;j<=len[i];j++)printf("%c",ans[i][j]);
		printf("\n");
	}
}
double GetTime(){return (ldb)clock()/CLOCKS_PER_SEC;}
double s_time,e_time,d_time;
void Start(){s_time=GetTime();}
void Stop(){e_time=GetTime();d_time=e_time-s_time;}
void Test(){
	cout<<fixed<<setprecision(4);
	int work=100000;
	double max_time=0;
	bool speed_only=0;
	for(int i=1;i<=work;i++){
		MakeTestCase();
		//if(!speed_only)BruteForce();
		//SubTask2();
		//SlowDP();
		BruteForce();
		for(int j=1;j<=q;j++)for(int l=1;l<=len[j];l++)ans2[j][l]=ans[j][l];
		for(int j=1;j<=q;j++)ok2[j]=ok[j];
		Start();
		Solve();
		//SubTask3();
		Stop();
		if(!speed_only && !Compare()){
			Print();
			return;
		}
		max_time=max(max_time,d_time);
		cout<<i<<":OK, max time so far="<<max_time<<"\n";
	}
	cout<<":D\n";
}
int main(){
	Run();
	return 0;
}