#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    int t;
    cin >> t;
    while (t--) {
        int n;
        cin >> n;
        string s;
        cin >> s;
        int cnt = 0;
        for (int i = 0; i < n; i++)
            cnt += (s[i] == '0');
        if (s[0] == '0' || s[n - 1] == '0' || cnt % 2 == 1) {
            cout << "NO" << '\n';
        } else {
            cout << "YES" << '\n';
            int f1 = 1, f2 = 1;
            string x = "", y = "";
            int now = 0, f = 1;;
            cnt = n - cnt;
            for (int i = 0; i < n; i++) {
                if (s[i] == '0') {
                    if (f) {
                        x += '(';
                        y += ')';
                    } else {
                        x += ')';
                        y += '(';
                    }
                    f ^= 1;
                } else {
                    if (now < cnt / 2) {
                        x += '(';
                        y += '(';
                    } else {
                        x += ')';
                        y += ')';
                    }
                    now++;
                }
            }
            cout << x << '\n' << y << '\n';
        }
    }
    return 0;
}