#include <bits/stdc++.h>
#define forn(i, n) for(int i = 0; i < n; ++i)
#define INF 1e9
using namespace std;

char s[200005], ans1[200005], ans2[200005];

void solve() {
    int n;
    scanf("%d", &n);
    scanf("%s", s);
    
    if (s[0] == '0' || s[n-1] == '0') {
        printf("NO\n");
        return;
    }

    int n_0 = 0, n_1 = 0;
    forn(i, n) {
        if (s[i] == '0') ++n_0;
        else ++n_1;
    }
    if (n_0 % 2) {
        printf("NO\n");
        return;
    }

    int idx, n1_half = n_1 / 2;
    for (idx = 0; n1_half > 0; ++idx) {
        if (s[idx] == '1') {
            ans1[idx] = ans2[idx] = '(';
            --n1_half;
        }
    }
    for (idx; idx < n; ++idx) {
        if (s[idx] == '1') {
            ans1[idx] = ans2[idx] = ')';
        }
    }

    int n0_half = n_0 / 2;
    int flag = 1;
    for (idx = 0; idx < n; ++idx) {
        if (s[idx] == '0') {
            if (flag == 1) {
                ans1[idx] = '(';
                ans2[idx] = ')';
            }
            else {
                ans1[idx] = ')';
                ans2[idx] = '(';
            }
            flag *= -1;
        }
    }

    ans1[n] = ans2[n] = '\0';

    printf("YES\n%s\n%s\n", ans1, ans2);
    
    return;
}

int main() {
    int T;
    scanf("%d", &T);
    while(T--) {
        solve();
    }
    return 0;
}