#include <cstdio>
using namespace std;

int n;
char str[200050];

char ans0[200050];
char ans1[200050];

bool run() {
    if (str[0] != '1' || str[n - 1] != '1')
        return false;

    int cnt_one = 0;
    for (int i = 0; i < n; i++)
        if (str[i] == '1')
            cnt_one++;
    if (cnt_one % 2 == 1)
        return false;

    int cnt_half = cnt_one / 2;
    bool flag = false;
    for (int i = 0; i < n; i++) {
        if (str[i] == '1') {
            if (cnt_half > 0) {
                ans0[i] = ans1[i] = '(';
                cnt_half--;
            } else {
                ans0[i] = ans1[i] = ')';
            }
        } else {
            if (flag) {
                ans0[i] = '(';
                ans1[i] = ')';
            } else {
                ans0[i] = ')';
                ans1[i] = '(';
            }
            flag = !flag;
        }
    }
    ans0[n] = ans1[n] = '\0';
    return true;
}

int main() {
    int T;
    scanf("%d", &T);
    while (T--) {
        scanf("%d %s", &n, str);
        if (run()) {
            printf("YES\n%s\n%s\n", ans0, ans1);
        } else {
            printf("NO\n");
        }
    }
    return 0;
}
