/*
#ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.in", "r", stdin);
    // for writing output to output.txt
    freopen("output.out", "w", stdout);
#endif
*/

//(UNCOMMENT WHEN HAVING LOTS OF RECURSIONS)
//#pragma comment(linker, "/stack:200000000")
//(UNCOMMENT WHEN NEEDED)\

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int mod=1e9+7;
#define eps 1e-7
#define vpi vector<pair<int,int>>
#define vi vector<ll>
#define pi pair<int,int>
#define pb push_back
#define ppb pop_back
#define umap unordered_map
#define uset unordered_set
#define vvi vector<vector<ll>>
#define minheap priority_queue<ll,vi,greater<ll>>
#define maxheap priority_queue<ll>
#define minheapi priority_queue<pi,vpi,greater<pi>>
#define maxheapi priority_queue<pi>
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
ll powmod(ll x,ll y){ll t; for(t=1;y;y>>=1,x=x*x%mod) if(y&1) t=t*x%mod; return t;}
ull gcd(ll x,ll y){return y?gcd(y,x%y):x;}
ll lcm(ll x,ll y){return x*(y/gcd(x,y)); }
ll modd(ll a){return (a%mod + mod)%mod;}
ll add(ll a,ll b){return modd(modd(a)+modd(b));}
ll mul(ll a,ll b){return modd(modd(a)*modd(b));}
void smask(int pos,int &i){ i=i^(1<<pos); }
void clmask(int pos,int &i){ i=i&~(1<<pos); }
bool chmask(int pos,int i){return i&(1<<pos);}
double cordist(pair<double,double> a,pair<double,double> b)
{return sqrt(((a.first-b.first)*(a.first-b.first))+((a.second-b.second)*(a.second-b.second)));}

//ll prime[60];
//int posx[10];
//int posy[10];
//im,q,r;nt price[30]; 
//char board[26][26];
int n,m,q,r;

bool isbalanced(string s)
{
    stack<char> st;
    for(int i=0;i<s.length();i++)
    {
        if(s[i]=='(')
        {
            st.push('(');
        }
        else
        {
            if(st.empty())
                return false;
            st.pop();
        }
    }
    return st.size()==0;
}

void solve()    
{  
    cin>>n;
    string s;
    cin>>s;
    string temp(s.length(),'`');
    int cnt=count(s.begin(),s.end(),'1');
    //cout<<cnt<<endl;
    int counter=0;
    for(int i=0;i<n;i++)
    {
        if(s[i]!='1')continue;
        if(counter==cnt/2)
        {
            temp[i]=')';
        }
        else
        {
            temp[i]='(';
            counter++;
        }
    }
    bool flip=true;
    for(int i=0;i<n;i++)
    {
        if(s[i]=='0')
        {
            if(flip)
            {
                temp[i]='(';
                flip=!flip;
            }
            else
            {
                temp[i]=')';
                flip=!flip;
            }
        }
    }
    
    string temp2=temp;
    for(int i=0;i<s.length();i++)
    {
        if(s[i]=='0')
        {
            if(temp2[i]==')')
                temp2[i]='(';
            else temp2[i]=')';
        }
    }
    //cout<<temp<<" "<<temp2<<endl;
    if(isbalanced(temp) and isbalanced(temp2))
    {
        cout<<"YES\n";
        cout<<temp<<endl<<temp2<<endl;
    }
    else
        cout<<"NO\n";

}

 
 
 
 
int main()  
{
    
    IOS
    #ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.in", "r", stdin);
    // for writing output to output.txt
    freopen("output.out", "w", stdout);
    #endif
    int k=1;

    cin>>k;
    //sieve();
    //int counter=1;
    while(k--)
    {
        //printf("Case %d: ",counter++);
        solve();
    }
    return 0;
}