// To Hell and Back
#include <bits/stdc++.h>
 
using namespace std;

typedef long long int ll;
typedef pair<int, int> pii;
 
#define SZ(x)                       (int) x.size()
#define F                           first
#define S                           second

const int N = 2e5 + 10, MOD = 1e9 + 7;
int t, n; char S[N];

int main() {
    scanf("%d", &t);
    for (; t; t--) { 
        int f1 = 0, f2 = 0;
        scanf("%d", &n); string r1 = "", r2 = "";
        scanf("%s", S + 1);
        if (S[1] != '1' || S[n] != '1') { printf("NO\n"); continue; }
        int c = 0, f = 1;
        for (int i = 1; i <= n; i++) 
           c += (S[i] - '0'); 
        int c2 = n - c;
        if (c & 1) { printf("NO\n"); continue; }
        c >>= 1; 
        //printf("wtf %d\n", c);
        for (int i = 1; S[i]; i++) {
            if (S[i] == '1') {
                if (c) r1 += '(', r2 += '(', f2++, f1++, c--;
                else r1 += ')', r2 += ')', f2--, f1--;
            } else {
                if (c2 & 1) r1 += '(', r2 += ')', f1++, f2--;
                else r1 += ')', r2 += '(', f1--, f2++;
                c2--;
            }
            if (min(f1, f2) < 0) f = 0;
        }
        if (!f) printf("NO\n");
        else cout << "YES\n" << r1 << '\n' << r2 << '\n';
    }
    return 0;
}
