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: 
  import java.util.*;
  
  import java.util.Map.Entry;
  
  
  //import sun.text.resources.cldr.ext.FormatData_fy;
  
  import java.io.*;
   public class Solution {
  	 static FastScanner scr=new FastScanner();
  //		static Scanner scr=new Scanner(System.in);
  		 static PrintStream out=new PrintStream(System.out);
  		 static StringBuilder sb=new StringBuilder();
  		 static  class FastScanner {
  			 BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
  			StringTokenizer st=new StringTokenizer("");
  		 	String next() {
  		 		while (!st.hasMoreTokens())
  		 			try {
  		 				st=new StringTokenizer(br.readLine());
  		 			} catch (IOException e) {
  		 				e.printStackTrace();
  		 			}
  		 			return st.nextToken();
  			} long gcd(long a,long b){
  				if(b==0) {
  					return a;
  				}
  					
  				return gcd(b,a%b);
  			}
  		 	 long modPow(long base,long exp) {
  				if(exp==0) {
  					return 1;
  				}
  				if(exp%2==0) {
  					long res=(modPow(base,exp/2));
  					return (res*res);
  				}
  				return (base*modPow(base,exp-1));
  			}
  			long []reverse(long[] count){
  				long b[]=new long[count.length];
  				int index=0;
  				for(int i=count.length-1;i>=0;i--) {
  					b[index++]=count[i];
  				}
  				return b;
  			}
  			int nextInt() {
  				return Integer.parseInt(next());
  			}
  			long getMax(long a[],int n) {
  				long max=Long.MIN_VALUE;
  				for(int i=0;i<n;i++) {
  					max=Math.max(a[i], max);
  				}
  					return max;
  			}
  			long[] readLongArray(int n) {
  				long  [] a=new long  [n];
  				for (int i=0; i<n; i++) a[i]=nextLong();
  				return a;
  			}int[] readArray(int n) {
  				int  [] a=new int  [n];
  				for (int i=0; i<n; i++) a[i]=nextInt();
  				return a;
  			}
  			long nextLong() {
  				return Long.parseLong(next());
  			}
  			
  		}
  		
  		 static class triplet{
  			long x;
  			long y;
  			long z;
  			triplet(long x,long y,long z){
  				this.x=x;
  				this.y=y;
  				this.z=z;
  			}
  		} 
  		 static class DSU {
  			 int[] upper;
  			 int[] next;
  			 int[] last;
  	 
  			 DSU(int n) {
  				upper = new int[n];
  				Arrays.fill(upper, -1);
  				next = new int[n];
  				last = new int[n];
  				Arrays.fill(next, -1);
  				for(int i = 0;i < n;i++){
  					last[i] = i;
  				}
  			}
  	 
  			 int find(int x) {
  				return upper[x] < 0 ? x : (upper[x] = find(upper[x]));
  			}
  	 
  			 boolean equiv(int x, int y) {
  				return find(x) == find(y);
  			}
  	 
  			 boolean union(int x, int y) {
  				x = find(x);
  				y = find(y);
  				if (x != y) {
  					if (upper[y] < upper[x]) {
  						int d = x;
  						x = y;
  						y = d;
  					}
  					upper[x] += upper[y];
  					upper[y] = x;
  					next[last[x]] = y;
  					last[x] = last[y];
  				}
  				return x == y;
  			}
  			  int count() {
  					int ct = 0;
  					for (int u : upper)
  						if (u < 0)
  							ct++;
  					return ct;
  				}
  		 }
  		 static Solve s=new Solve();
  			public static  void main(String []args) {
  				int t=scr.nextInt();
  				while(t-->0) {
  					s.solve();
  				}
  //				s.solve();
  				out.println(sb);
  			}
  			static class Solve{
  				 ArrayList<String>s=new ArrayList<>();
  				int MAX=Integer.MAX_VALUE;
  				 int MIN=Integer.MIN_VALUE;
  				 ArrayList<Integer>list[];
  				 int degree[];
  				 int n;
  				 boolean good;
  				 boolean visited[];
  				 ArrayList<Integer>path=new ArrayList<>();
  				 int cnt=0;
  				 void solve() {
  					int n=scr.nextInt();
  //					int cnt=0;
  					for(int cnt=1;cnt<=n;cnt++) {
  						
  						int i=cnt;
  						int count=0;
  						String prefix="";
  						String middle="";
  						while(i-->0) {
  							middle+="()";
  						}
  						
  						i=n-cnt;
  						while(i-->0) {
  							prefix+='(';
  						}
  						i=n-cnt;
  						prefix+=middle;
  						while(i-->0) {
  							prefix+=')';
  						}
  						out.println(prefix);
  					}
  					
  				 }
  			}
  	}	
    	