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.io.*;
  
  public class Codeforces {
      final static long mod = 1000000007;
  
      public static void main(String[] args) throws Exception {
          FastReader sc = new FastReader();
          int t = sc.nextInt();
          outer:while (t-- > 0) {
              int n = sc.nextInt();
  
              if(n==1){
                  System.out.println("()");
                  continue outer;
              }
  
              String str = "";
  
              for (int i = 0; i < n; i++) {
                  str = "(" + str;
                  str += ")";
              }
  
              System.out.println(str);
  
              char ch[] =str.toCharArray();
  
              for(int i=n;i>1;i--){
                  ch[i]='(';
                  ch[i-1]=')';
  
                  System.out.println(ch);
                  
              }
  
          }
      }
  
      public static String addZero(String s, int count) {
          for (int i = 0; i < count; i++) {
              s += "0 ";
          }
  
          return s;
      }
  
      public static String get(String s, int k) {
          int n = s.length();
          int rep = k % n == 0 ? k / n : k / n + 1;
          s = s.repeat(rep);
  
          return s.substring(0, k);
  
      }
  
      public static int diglen(Long y) {
          int a = 0;
          while (y != 0L) {
              y /= 10;
              a++;
  
          }
          return a;
      }
  
      static class FastReader {
  
          BufferedReader br;
          StringTokenizer st; // StringTokenizer() is used to read long strings
  
          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());
          }
  
          String nextLine() {
              String str = "";
              try {
                  str = br.readLine();
              } catch (IOException e) {
                  e.printStackTrace();
              }
              return str;
          }
      }
  
      public class Pair implements Comparable<Pair> {
          public final int index;
          public final int value;
  
          public Pair(int index, int value) {
              this.index = index;
              this.value = value;
          }
  
          @Override
          public int compareTo(Pair other) {
              // multiplied to -1 as the author need descending sort order
              return -1 * Integer.valueOf(this.value).compareTo(other.value);
          }
      }
  
      static String reverseString(String str) {
          StringBuilder input = new StringBuilder();
          return input.append(str).reverse().toString();
      }
  
      static long factorial(int n, int b) {
          if (n == b)
              return 1;
  
          return n * factorial(n - 1, b);
      }
  
      static int lcm(int ch, int b) {
          return ch * b / gcd(ch, b);
      }
  
      static int gcd(int ch, int b) {
          return b == 0 ? ch : gcd(b, ch % b);
      }
  
      static double ceil(double n, double k) {
          return Math.ceil(n / k);
      }
  
      static int sqrt(double n) {
          return (int) Math.sqrt(n);
      }
  
  }
  