#include <bits/stdc++.h>

using namespace std;

bool check(string s)  {
	stack<char> st;
	if(s[0] == ')')
		return false;
	st.push('(');
	int i = 1;
	int n = s.length();
	while(i < n) {
		if(s[i] == '(')
			st.push('(');
		else if(st.empty() && s[i] == ')')
			return false;
		else
			st.pop();
		++i;
	}
	if(!st.empty())
		return false;
	return true;
}
int main() {

	int t = 1;
	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] == '1');
		}
		if(cnt & 1 || s[0] == '0' || s[n-1] == '0')
			cout << "NO";
		else {
			int k = 0;
			bool flip = true;
			string a = "", b = "";
			for(int i = 0; i < n; ++i) {
				if(s[i] == '1') {
					a += (2 * k < cnt) ? '(' : ')';
					b += a.back();
					++k;
				}
				else {
					a += flip ? ')' : '(';
					b += flip ? '(' : ')';
					flip = !flip;
				}
			}
			cout << "YES\n" << a << '\n' << b;
		}

		cout << '\n';
	}
	return 0;
}