description: A bracket sequence is a string containing only characters "(" and ")". A regular bracket sequence is a bracket sequence that can be transformed into a correct arithmetic expression by inserting characters "1" and "+" between the original characters of the sequence. For example, bracket sequences "()()" and "(())" are regular (the resulting expressions are: "(1)+(1)" and "((1+1)+1)"), and ")(", "(" and ")" are not.
  
  You are given an integer n. Your goal is to construct and print exactly n different regular bracket sequences of length 2n.
  
  Input
  
  The first line contains one integer t (1 ≤ t ≤ 50) — the number of test cases.
  
  Each test case consists of one line containing one integer n (1 ≤ n ≤ 50).
  
  Output
  
  For each test case, print n lines, each containing a regular bracket sequence of length exactly 2n. All bracket sequences you output for a testcase should be different (though they may repeat in different test cases). If there are multiple answers, print any of them. It can be shown that it's always possible.
  
  Example
  
  Input
  
  
  3
  3
  1
  3
  
  
  Output
  
  
  ()()()
  ((()))
  (()())
  ()
  ((()))
  (())()
  ()(())
solution: // Piyush Nagpal
  import java.util.*;
  import java.io.*;
   public class C{
       
      static int MOD=1000000007;
      static PrintWriter pw;
      static FastReader sc;
      
      static class FastReader {
          BufferedReader br;
          StringTokenizer st;
   
          public FastReader()
          {
              br = new BufferedReader(
                  new InputStreamReader(System.in));
          }
   
          String next()
          {
              while (st == null || !st.hasMoreElements()) {
                  try {
                      st = new StringTokenizer(br.readLine());
                  }
                  catch (IOException e) {
                      e.printStackTrace();
                  }
              }
              return st.nextToken();
          }
   
          int nextInt() { return Integer.parseInt(next()); }
   
          long nextLong() { return Long.parseLong(next()); }
   
          double nextDouble(){return Double.parseDouble(next());}
          
          public char nextChar() throws IOException {return next().charAt(0);}
   
          String nextLine(){
              String str = "";
              try {
                  str = br.readLine();
              }
              catch (IOException e) {
                  e.printStackTrace();
              }
              return str;
          }
          public int[] intArr(int a,int b,int n) throws IOException {int[]in=new int[n];for(int i=a;i<b;i++)in[i]=nextInt();return in;}
          public long[] longArr(int a,int b,int n) throws IOException {long[]in=new long[n];for(int i=a;i<b;i++)in[i]=nextLong();return in;}
          
      }   
   
   
       public static long gcd(long a,long b){if( b>a ){return gcd(b,a);}if( b==0 ){return a;} return gcd(b,a%b);}
       public static long expo( long a,long b,long M ){long result=1;while(b>0){if( b%2==1 ){result=(result*a)%M;}a=(a*a)%M;b=b/2;}return result%M;}
      public static ArrayList<Long> Sieve(int n){boolean [] arr= new boolean[n+1];Arrays.fill(arr, true);ArrayList<Long> list= new ArrayList<>();for(int i=2;i<=n;i++){if( arr[i]==true ){list.add((long)i);}for(int j=2*i;j<=n;j+=i){arr[j]=false;}}return list;}
   
      public static void printarr(int [] arr){for(int i=0;i<arr.length;i++){pw.print(arr[i]+" ");}}
      public static void printarr(long [] arr){for(int i=0;i<arr.length;i++){pw.print(arr[i]+" ");}}
      
      // int [] arr=sc.intArr(a,b,n);  <b
      static void solve() throws Exception{
          int n=sc.nextInt();
          StringBuilder sb = new StringBuilder();
          for(int i=0;i<(2*n);i++){
              if(i<n){
                  sb.append("(");
              }else{
                  sb.append(")");
              }
          }
          int i=1;
          StringBuilder s= new StringBuilder(sb.toString());
          // pw.println(s);
          while(i<=n){
               sb= new StringBuilder(s.toString());
              sb.insert(i,")");
              sb.deleteCharAt(sb.length()-1);
              pw.println(sb);
              i++;
          }
          // pw.println(sb);
     }
     
     public static void main(String[] args) throws Exception{
          try {
              System.setIn(new FileInputStream("input.txt"));
              System.setOut(new PrintStream(new FileOutputStream("output.txt")));
          } catch (Exception e) {
              System.err.println("Error");
          }
          sc= new FastReader();
          pw = new PrintWriter(System.out);
  
          int tc=1;
          tc=sc.nextInt();
          for(int ii=1;ii<=tc;ii++) {
  //            pw.printf("Case #%d: "b, i);
              solve();
          }
         
          pw.flush();
   
      
   
      }
   
  }