#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
const int max_n = 200005, mod = 1000000007;

void solve(){
    int n;cin>>n;string s,a,b;cin>>s;
    int cnt=0;bool flip=false;
    for(char c:s)cnt+=(c=='1');
    if(cnt%2==1||s[0]=='0'||s.back()=='0'){
        cout<<"NO"<<endl;return;
    }
    int k=0;
    for(int i=0;i<s.length();i++){
        if(s[i]=='1'){
            a.push_back((k<cnt/2)?'(':')');
            b.push_back(a.back());
            k++;
        }
        else {
            a.push_back(flip==true?'(':')');
            b.push_back(flip==true?')':'(');
            flip=!flip;
        }
    }
    cout<<"YES"<<endl<<a<<endl<<b<<endl;
}


int main(){

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
        freopen("in.txt","r",stdin);
        freopen("out.txt","w",stdout);
    #endif
 
    int t;cin>>t;
    while(t--){
        solve();
    }
    return 0;
}