#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t;cin>>t;
    while(t--)
    {
        int n;cin>>n;
        string str;cin>>str;
        stack<char>s1,s2;
        string str1="";string str2="";
        int flg=0;
        for(int i=0;i<str.length();i++)
        {
            if(str[i]=='1')
            {
                if(s1.size()==0 or s2.size()==0)
                {
                    s1.push('(');s2.push('(');
                    str1+='(';str2+='(';
                }
                else if((i+1<str.length()) and (s1.size()==1 and s2.size()==1) and str[i+1]=='0')
                {
                    s1.push('(');s2.push('(');
                    str1+='(';str2+='(';
                }
                else
                {
                    s1.pop();s2.pop();
                    str1+=')';str2+=')';
                }
            }
            else
            {
                if(s1.size()==0 and s2.size()==0)
                {
                    flg=1;break;
                }
                else if(s1.size()==0 and s2.size()>0)
                {
                    s1.push('(');s2.pop();
                    str1+='(';str2+=')';
                }
                else if(s1.size()>0 and s2.size()==0)
                {
                    s1.pop();s2.push('(');
                    str1+=')';str2+='(';
                }
                else if(s1.size()>=s2.size())
                {
                    s1.pop();s2.push('(');
                    str1+=')';str2+='(';
                }
                else
                {
                    s1.push('(');s2.pop();
                    str1+='(';str2+=')';
                }
            }
        }
        if(flg==1 or (s1.size()>0 or s2.size()>0))
        {
            cout<<"NO"<<endl;
        }
        else
        {
            cout<<"YES"<<endl;
            cout<<str1<<endl;
            cout<<str2<<endl;
        }
    }
}