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 javax.print.event.PrintJobListener;
  
  import java.io.*;
  
  public class Coding {
  
  		public 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();
  			}
  			
  			int nextInt() {
  				return Integer.parseInt(next());
  			}
  			
  			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());
  			}
  		}
  		
  		//prime sieve
  		public static boolean sieve[];
  		public static void sievePrime(int n) {
  			sieve = new boolean[n+1];
  			for(int i=2;i*i<=n;i++) {
  				if(sieve[i] == false) { //means prime hai
  					for(int j=i+i;j<sieve.length;j+= i) {
  						sieve[j] = true;
  					}
  				}
  			}
  			
  		}
  		
  		//swap
  		public static void swap(int a,int b) {
  			int temp= a;
  			a=b;
  			b=temp;
  		}
  		
  		//Longest Palindromic String
  		 public String manacher(String s){
  		        StringBuilder sb = new StringBuilder();
  		        sb.append("@");
  		        for(int i=0;i<s.length();i++){
  		            sb.append("#");
  		            sb.append(s.charAt(i));
  		        }
  		        sb.append("#");
  		        sb.append("$");
  		        String ans = manacher_Util(sb.toString(),s);
  		        return ans;
  		    }
  		    public String manacher_Util(String s,String org){
  		        int lps[] = new int[s.length()];
  		        int c = 0;
  		        int r = 0;
  		        for(int i=1;i<s.length()-1;i++){
  		            int mirror = c - (i-c);
  		            if(i<r){
  		                lps[i] = Math.min(lps[mirror],r-i);
  		            }
  		        
  		            while(s.charAt(1+i+lps[i]) == s.charAt(i-1-lps[i])){
  		                lps[i]++;
  		            }
  		            if(i+lps[i] > r){
  		                c= i ;
  		                r = i+lps[i];
  		            }
  		        }
  		        int maxlen = Integer.MIN_VALUE;
  		        int maxindex = Integer.MIN_VALUE;
  		        for(int i=1;i<lps.length-1;i++){
  		            if(lps[i] > maxlen){
  		                maxlen = lps[i];
  		                maxindex = i;
  		            }
  		        }
  		        int firstindex = maxindex - maxlen + 1;
  		        int actualFirstIndex = (firstindex-2)/2;
  		        return org.substring(actualFirstIndex,actualFirstIndex+maxlen);
  		    }
  		
  		
  		    //kmp
  		    public static int lps[];
  		    public static void kmp(String s) {
  		    	lps = new int[s.length()];
  		    	int i = 1;
  		    	int len = 0;
  		    	while(i<s.length()) {
  		    		if(s.charAt(i) == s.charAt(len)) {
  		    			len++;
  		    			lps[i] = len;
  		    			i++;
  		    		}
  		    		else {
  		    			if(len>0) {
  		    				len = lps[len - 1];
  		    			}
  		    			else {
  		    				lps[i] = 0;
  		    				i++;
  		    			}
  		    		}
  		    	}
  		    }
  
  		public static void main(String[] args) {
  		    FastScanner sc = new FastScanner();
  			int test = sc.nextInt();
  //			PrintWriter o = new PrintWriter(System.out);
  			while(test-->0) {
  				int n=sc.nextInt();
  				int op=1;
  				int cl=1;
  				for(int i=1;i<=n;i++){
  					int j=n;
  					op=i;
  					while(j!=0){
  						j-=op;	
  						for(int k=1;k<=op;k++){
  							System.out.print("(");
  						}
  						for(int k=1;k<=op;k++){
  							System.out.print(")");
  						}
  						if(j!=0&&j<op){
  							op=j;
  						}
  					}
  					System.out.println();
  				}
  				
  			}
  			
  		}
  		// public static print(int n,int op,int cl){
  		// 	print()
  		// }
  		static int gcd(int a, int b)
  	    {
  	      if (b == 0)
  	        return a;
  	      return gcd(b, a % b);
  	    }
  		
  		public static int fac(int n)
  		{
  			int ans = 1;
  			for(int i = 1;i<=n;i++)
  			{
  				ans *= i;
  			}
  			return ans;
  		}
  		
  	}