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.io.*;
  import java.math.BigInteger;
  import java.util.*;
  
  public class Problem {
  
      public static void main(final String[] args) {
          final InputStream inputStream = System.in;
          final OutputStream outputStream = System.out;
          final FastScanner in = new FastScanner(inputStream);
          final FastPrintWriter out = new FastPrintWriter(outputStream);
          final boolean multiTests = true;
          if (multiTests) {
              int t = in.nextInt();
              while (t-- > 1) {
                  new Solver(in, out).solve();
              }
          }
          new Solver(in, out).solve();
          out.close();
          in.close();
      }
  
      static class Solver {
          private final FastScanner in;
          private final FastPrintWriter out;
  
          public Solver(FastScanner in, FastPrintWriter out) {
              this.in = in;
              this.out = out;
          }
  
          List<String> vectors;
  
          public void solve() {
              int n = scanInt();
              vectors = new ArrayList<>(n);
              gen(n, 0, 0, "");
              for (String vector : vectors) {
                  out.println(vector);
              }
          }
  
          private void gen(int length, int countOpen, int countClose, String vector) {
              if (countOpen + countClose == 2 * length) {
                  vectors.add(vector);
                  return;
              }
              if (vectors.size() == length) {
                  return;
              }
              if (countOpen < length) {
                  gen(length, countOpen + 1, countClose, vector + "(");
              }
              if (countOpen > countClose) {
                  gen(length, countOpen, countClose + 1, vector + ")");
              }
          }
  
          static class Pair<TypeFirst, TypeSecond> {
              public TypeFirst first;
              public TypeSecond second;
  
              public Pair(TypeFirst first, TypeSecond second) {
                  this.first = first;
                  this.second = second;
              }
  
              @Override
              public String toString() {
                  return first + " " + second;
              }
          }
  
          // InputRead
          private int scanInt() {
              return in.nextInt();
          }
  
          private long scanLong() {
              return in.nextLong();
          }
  
          private double scanDouble() {
              return in.nextDouble();
          }
  
          private String next() {
              return in.next();
          }
  
          private int[] nextIntArray(int len) {
              int[] array = new int[len];
              for (int i = 0; i < len; i++) {
                  array[i] = scanInt();
              }
              return array;
          }
  
          private long[] nextLongArray(int len) {
              long[] array = new long[len];
              for (int i = 0; i < len; i++) {
                  array[i] = scanLong();
              }
              return array;
          }
      }
  
      static class FastScanner {
          private final BufferedReader reader;
          private StringTokenizer st;
  
          public FastScanner(InputStream inputStream) {
              reader = new BufferedReader(new InputStreamReader(inputStream));
          }
  
          public void close() {
              try {
                  reader.close();
              } catch (IOException e) {
                  e.printStackTrace();
              }
          }
  
          private void read() {
              while (st == null || !st.hasMoreTokens()) {
                  try {
                      st = new StringTokenizer(reader.readLine());
                  } catch (IOException e) {
                      e.printStackTrace();
                  }
              }
          }
  
          public String next() {
              read();
              return st.nextToken();
          }
  
          public int nextInt() {
              return Integer.parseInt(next());
          }
  
          public long nextLong() {
              return Long.parseLong(next());
          }
  
          public double nextDouble() {
              return Double.parseDouble(next());
          }
      }
  
      static class FastPrintWriter extends PrintWriter {
          public FastPrintWriter(OutputStream outputStream) {
              super(outputStream);
          }
  
          public void print(Object ... objects) {
              for (int i = 0; i < objects.length - 1; i++) {
                  print(objects[i] + " ");
              }
              print(objects[objects.length - 1]);
          }
  
          public void println(Object ... objects) {
              for (int i = 0; i < objects.length - 1; i++) {
                  print(objects[i] + " ");
              }
              println(objects[objects.length - 1]);
          }
  
          public void printArray(int[] array) {
              for (int i = 0; i < array.length - 1; i++) {
                  print(array[i] + " ");
              }
              println(array[array.length - 1]);
          }
      }
  }