#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL);

    int q, n, k, k1, i, t1;
    bool flag;
    ll t;
    cin >> q;

    while(q--) {
        cin >> n >> k >> t;

        k1 = n, i = n - 1;
        flag = false;

        string s(n, '(');

        while (k1 > k) {
            
            if (i < 0) {
                flag = true;
                break;
            }

            s[i] = ')';
            --i, k1 -= 2;
        }

        t1 = 1;

        while (t1 != t && !flag) {
            s[i - (t - t1)] = ')';
            t1 = t;
        }

        if (flag) {
            cout << "Ne postoji\n";
        } else {
            cout << s << "\n";
        }

        cout << i;
    }
}