#include<bits/stdc++.h>
using namespace std;
int main()
{
    /*freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);*/
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int tc;
    cin>>tc;
    while(tc--)
    {
        int n;
        string s;
        cin >> n >> s;
        int zero = count(s.begin(), s.end(), '0');
        if (s[0] == '0' || s[n - 1] == '0' || zero&1)
        {
            cout << "NO" << endl;
            continue;
        }
        string s1="(", s2="(";
        int o = 1, O = 1;
        for (int i = 1; i < n - 1; i++)
        {
            if(s[i]=='1')
            {
                (o == 1) ? s2 += '(' : s2 += ')';
                if(o == 1) 
                {
                    s1 += '(';
                    o = 1 - o;
                }
                else
                {
                    s1 += ')';
                    o = 1 - o;
                }
            }
            else
            {
                O == 1 ? s2 += '(' : s2 += ')';
                if(O == 1)
                {
                    s1 += ')';
                    O = 1 - O;
                }
                else
                {
                    s1 += '(';
                    O = 1 - O;
                }
            }
            //cout << s1 << " " << s2 << endl;
        }
        s1 += ')';
        s2 += ')';
        cout << "YES" << endl;
        cout << s1 << endl<< s2 << endl;
    }
   
}