#include <bits/stdc++.h>
using namespace std;
#define endl "\n"

int size;
vector<bool> binary;

/**************************
/* IZVOR : https://www.geeksforgeeks.org/remove-invalid-parentheses/
/*************************/

bool isParenthesis(char c)
{
    return ((c == '(') || (c == ')'));
}
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);
}
void removeInvalidParenthesis(string str)
{
    if (str.empty())
        return ;
    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))
        {
            size=str.size();
            return;
        }
        if (level)
            continue;
        for (int i = 0; i < str.length(); i++)
        {
            if (!isParenthesis(str[i]))
                continue;
            temp = str.substr(0, i) + str.substr(i + 1);
            if (visit.find(temp) == visit.end())
            {
                q.push(temp);
                visit.insert(temp);
            }
        }
    }
}
void bin(long long n)
{
    if (n > 1)
        bin(n/2);
    binary.push_back(n%2);
}
bool check(int n, long long t)
{
    long long x=1;
    int br=0;
    while(x<t) {
        x*=2;
        br++;
    }
    if(br<=n) return true;
    return false;
}
void resi(long long t,int n)
{
    binary.clear();
    bin(t-1);
    if(!check(n,t)) {cout<<"Ne postoji"<<endl; return;}
    for(int i=0; i<n-(int)binary.size(); ++i) {cout<<"(";}
    for(int i=max((int)binary.size()-n,0); i<binary.size(); ++i) {
        if(binary[i]==1) cout<<")";
        else cout<<"(";
    }
    cout<<endl;
}

int main()
{
    int k,q,n,bro,brz;
    long long t;
    cin>>q;
    while(q--) {
        cin>>n>>k>>t;
        if(n==k) {
            resi(t,n);
            continue;
        }
        int br=0;
        bool ind=false;
        vector<string> vec;
        for(int i=n; i>=0; --i) {
            bro=i;
            brz=n-i;
            string s1(bro,'('),s2(brz,')');
            s1+=s2;
            do {
                removeInvalidParenthesis(s1);
                if(s1.size()-size<=k) vec.push_back(s1);
            }while(next_permutation(s1.begin(),s1.end()));
        }
        sort(vec.begin(),vec.end());
        if(t>vec.size()) cout<<"Ne postoji"<<endl;
        else cout<<vec[t-1]<<endl;
    }
    return 0;
}