#include<bits/stdc++.h>
#define LL long long
#define pb push_back
#define SZ(x) ((int)x.size()-1)
#define ms(a,b) memset(a,b,sizeof a)
#define F(i,a,b) for (int i=(a);i<=(b);++i)
#define DF(i,a,b) for (int i=(a);i>=(b);--i)
using namespace std;
inline int read(){
	char ch=getchar(); int w=1,c=0;
	for(;!isdigit(ch);ch=getchar()) if (ch=='-') w=-1;
	for(;isdigit(ch);ch=getchar()) c=(c<<1)+(c<<3)+(ch^48);
	return w*c;
}
const int M=2e5+10;
char c[M];
string s1,s2;
int n;
void work(){
	n=read(); s1=s2="";
	scanf("%s",c+1);
	if (c[1]!=c[n] || c[1]!='1'){
		puts("NO");
		return ;
	}
	int num=0;
	bool fl=0;
	F(i,1,n){
		num+=(c[i]=='1');
	}
	if (num&1){
		puts("NO");
		return ;
	}
	int cur=0;
	F(i,1,n){
		cur+=(c[i]=='1');
		if (c[i]=='1'){
			if (cur<=num/2){
				s1+="("; s2+="(";
			}
			else s1+=")",s2+=")";
		}
		else{
			if (fl){
				s1+="("; s2+=")";
			}
			else{
				s1+=")"; s2+="(";
			}
			fl^=1;
		}
	}
	puts("YES");
	cout<<s1<<"\n"<<s2<<"\n";
}
int main(){
	int T=read();
	while (T--) work();
	return 0;
}
/* stuff you should look for
	* int overflow, array bounds
	* special cases (n=1?)
	* do smth instead of nothing and stay organized
	* WRITE STUFF DOWN
	* DON'T GET STUCK ON ONE APPROACH
*/
