#include <bits/stdc++.h>

#define endl "\n"
#define pb push_back
#define ll long long
#define ld long double

using namespace std;

//geeksforgeeks.org/remove-invalid-parentheses

bool isValidString(string str)
{
    int cnt = 0;
    for (int i = 0; i < str.length(); i++)
    {
        if (str[i] == '(')
            cnt++;
        else if (str[i] == ')')
            cnt--;
        if (cnt < 0)
            return false;
    }
    return (cnt == 0);
}

int removeInvalidParenthesis(string str)
{
    int orlen=str.size();
    if (str.empty())
        return 0;

    set<string> visit;

    queue<string> q;
    string temp;
    bool level;

    q.push(str);
    visit.insert(str);
    while (!q.empty())
    {
        str = q.front();  q.pop();
        if (isValidString(str))
        {
            return orlen-(int)str.size();
        }
        if (level)
            continue;
        for (int i = 0; i < str.length(); i++)
        {
            temp = str.substr(0, i) + str.substr(i + 1);
            if (visit.find(temp) == visit.end())
            {
                q.push(temp);
                visit.insert(temp);
            }
        }
    }
}

void solve8(int n, int k, ll t)
{
    string s(n,'(');
    int range=(1<<n)-1;
    if(t>range+1) {
        cout << "Ne postoji" << endl;
        return;
    }
    int ima=0;
    string dobar;

    for(int i=0;i<=range;i++) {
        int x=n-1,y=i;
        while(y>0) {
            if((y&1)==0)
                s[x]='(';
            else
                s[x]=')';
            x--;
            y=y>>1;
        }
        if(removeInvalidParenthesis(s)<=k) {
            ima++;
            if(ima==t) {
                cout << s << endl;
                return;
            }
        }
    }
    cout << "Ne postoji" << endl;
}

ll ex(int n)
{
    ll r=1;
    for(int i=1;i<=n;i++)
        r*=2;
    return r;
}


void solvekn(int n, int k, ll t)
{
    if(n<=61) {
        if(t>ex(n)) {
            cout << "Ne postoji" << endl;
            return;
        }
    }

    t--;
    int x=n-1;
    string s(n,'(');
    while(t>0) {
        if((t&1)==0)
            s[x]='(';
        else
            s[x]=')';
        x--;
        t=t>>1;
    }
    cout << s << endl;
}

int main()
{
    //geeksforgeeks.org/remove-invalid-parentheses
    ios_base::sync_with_stdio(false);  cin.tie(0); cout.tie(0);

    int q; cin >> q;
    while(q--) {
        int n,k; ll t; cin >> n >> k >> t;
        if(n<=8) {
            solve8(n,k,t);
            continue;
        }
        if(k==n) {
            solvekn(n,k,t);
            continue;
        }
//
//        if(!k) {
//            solvek0(n,k,t);
//            continue;
//        }
        cout << "Ne postoji" << endl;
    }

    return 0;
}