#include<bits/stdc++.h>
using namespace std;
#define int long long
#define F first
#define S second
#define pii pair<int, int>
#define vi vector<int>
#define vb vector<bool>
#define vii vector<pii>
#define vvi vector<vector<int>>
#define P_B push_back
#define M_P make_pair
#define endl "\n"

#define MOD 1000000007
#define pi 3.141592653589793238


// void file_io()
// {
//     freopen("input.txt","r",stdin);
//     freopen("output.txt","w",stdout);
// }


const int N = 1e5 + 5;


int32_t main() {
    
    // file_io();
    
    ios_base:: sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    int T; cin>>T; while(T--) 
    {
        
    	int n;
    	cin >> n;

    	string s;
    	cin >> s;

    	string a = "", b = "";
    	bool flag = true;

    	int cnt = 0;
    	for (int i = 0; i < n; i++) if(s[i] == '1') cnt++;
    	if(cnt&1 || s[0] == '0' || s[n-1] == '0') {
    		cout << "NO" << endl;
    		continue;
    	}

    	int balanced = 0, k = 0;
    	bool turn = true;

    	for (int i = 0; i < n; i++) {

    		if(s[i] == '1') {

    			if(k < cnt/2) a += '(', b += '(';
    			else a += ')', b += ')';
    			k++;

    		} else {

    			if(turn) a += ')', b += '(';
    			else a += '(', b += ')';
    			turn = !turn;

    		}
    	}

    	if(flag) {
    		cout << "YES" << endl;
    		cout << a << endl << b << endl;
    	} else cout << "NO" << endl;


    }    
    
    return 0;
}   
