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

// Neke stvari su preuzete sa Geeks For Geeks-a, bile su postojane
// i pre takmicenja.


string next_balanced_sequence(string& s)
{
    string next = "-1";
    int length = s.size();
    int depth = 0;
    for (int i = length - 1; i >= 0; --i) {

        // Decrement the depth for
        // every opening bracket
        if (s[i] == '(')
            depth--;

        // Increment for the
        // closing brackets
        else
            depth++;

        // Last opening bracket
        if (s[i] == '(' && depth > 0) {
            depth--;
            int open = (length - i - 1 - depth) / 2;
            int close = length - i - 1 - open;

            // Generate the required string
            next = s.substr(0, i) + ')'
                   + string(open, '(')
                   + string(close, ')');
            break;
        }
    }
    if (next == "-1")
        return "Ne postoji";
    return next;
}

// Driver code
int main()
{
    int q;
    cin >> q;
    int n, k, t;
    deque<char> s;
    for (int i = 0; i < q; i++) {
        cin >> n >> k >> t;
        for (int j = 0; j < (n+k)/2; j++)
        {
            s.push_front('(');
            s.push_back(')');
        }
        if (k == 0) {

            string ss (s.begin(), s.end());
            s.clear();
            while (t-->1) {
                ss = next_balanced_sequence(ss);
            }
            cout << ss << "\n";
        } else {
            string ss (s.begin(), s.end());
            s.clear();
            while (t-->1) {
                ss = next_balanced_sequence(ss);
            }
            cout << ss << "\n";
        }
    }
    return 0;
}