#include <iostream>
#include <vector>
#include <string>

std::vector<int> o;
int cc = 0;
bool oi = 0, ran = 0, oil = 0, oil2 = 0;

std::vector<int>* komb(int k, int n, std::vector<int>& var, int c, int p) {
	if (k == 0) {
		if (cc != n)cc++;
		if (c == 0) {
			if (p % 2 == 0) {
				oi = 0;
			}
			else {
				oi = 1;
			}
		}
		if (oi == 0 && cc == n) {
			int lol = 0;
			for (int d = 0; d < p; d=d+2) {
				if (var[d] == 0 && var[d + 1] == 1) ran = 1;
				else { ran = 0; break; }
			}
			if (ran == 1) {
				o = var;
			}
		}
		int ns = 0, os = 0;
		for (int q = 0; q < p; q++) {
			if (var[q] == 0) ns++;
			if (var[q] == 1) os++;
		}
		for (int q = 0; q < p/2; q++) {
			if (var[q] == 0 && var[q + 1] == 1 && q == (p / 2) - 1) oil = 1;
		}
		if (var[(p / 2) - 1] == 0 && var[p / 2] == 1) oil2 = 1;
		if (ns == os && oil == 1 && oil2 == 1 && cc == n) { o = var; }
	if (cc == n && c == p) { o = var; }
	//for (int i = 0; i < p; i++) std::cout << var[i] << ' '; std::cout << cc; std::cout << '\n';
}
	else
		for (int nn = 0; nn < 2; nn++) {
			if (oi == 1 && c != p) {
				std::cout << "Ne postoji";
				exit(0);
			}

			if (o == var) break;
			var[var.size() - k] = nn;
			komb(k - 1, n, var, c, p);
		}
	return &o;
}

int main(){
	int n = 3, k, t, p, q; std::cin >> q;
	std::vector<std::vector<int> >c(q,std::vector<int>(3));
	std::vector<int> l;
	for (int i = 0; i < q;i++) {
		for (int j = 0; j < 3; j++) {
			std::cin >> c[i][j];
		}
	}
	for (int i = 0; i < q; i++) {
		n = c[i][0]; k = c[i][1]; t = c[i][2];
		l.resize(n);
		p = n;
		l = *komb(n, t, l, k, p);
		cc = 0;
		std::vector<std::string>a(n);
		for (int g = 0; g < n; g++) {
			if (l[g] == 0) a[g] = '(';
			if (l[g] == 1) a[g] = ')';
		}
		for (int j = 0; j < n; j++)
			std::cout << a[j];
		std::cout << '\n';
	}
}