#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    ll t, n, i, j, one;
    string s, a, b;
    cin >> t;
    while(t--){
        cin >> n >> s;
        one = 0;
        for(i = 0; i < n; i++){
            if(s[i] == '1') one++;
        }
        if(one%2 == 0 && s[0] == '1' && s[n-1] == '1'){
            cout << "YES" << endl;
            bool f = 0;
            ll cnt = 0;
            for(i = 0; i < n; i++){
                if(s[i] == '1'){
                    if(2*cnt < one){
                        a += '(';
                        b += '(';
                        cnt++;
                    }
                    else{
                        a += ')';
                        b += ')';
                    }
                }
                else{
                    if(f){
                        a += '(';
                        b += ')';
                    }
                    else{
                        a += ')';
                        b += '(';
                    }
                    f = !f;
                }
            }
            cout << a << endl;
            cout << b << endl;
        }
        else cout << "NO" << endl;

        a.clear(); b.clear();
    }
    return 0;
}
