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: """
                              pppppppppppppppppppp
                           ppppp  ppppppppppppppppppp
                        ppppppp    ppppppppppppppppppppp
                        pppppppp  pppppppppppppppppppppp
                        pppppppppppppppppppppppppppppppp
                                pppppppppppppppppppppppp
         ppppppppppppppppppppppppppppppppppppppppppppppp  pppppppppppppppppppp
        pppppppppppppppppppppppppppppppppppppppppppppppp  ppppppppppppppppppppp
       ppppppppppppppppppppppppppppppppppppppppppppppppp  pppppppppppppppppppppp
      ppppppppppppppppppppppppppppppppppppppppppppppp    pppppppppppppppppppppppp
     pppppppppppppppppppppppppppppppppppppppppppppp     pppppppppppppppppppppppppp
    ppppppppppppppppppppppppppppppppppppppppppppp      pppppppppppppppppppppppppppp
    pppppppppppppppppppppppppppppppp               pppppppppppppppppppppppppppppppp
    pppppppppppppppppppppppppppp     pppppppppppppppppppppppppppppppppppppppppppppp
    ppppppppppppppppppppppppppp    pppppppppppppppppppppppppppppppppppppppppppppppp
      pppppppppppppppppppppppp  pppppppppppppppppppppppppppppppppppppppppppppppppp
       ppppppppppppppppppppppp  ppppppppppppppppppppppppppppppppppppppppppppppppp
        pppppppppppppppppppppp  ppppppppppppppppppppppppppppppppppppppppppppppp
         ppppppppppppppppppppp  ppppppppppppppppppppppppppppppppppppppppppppp
                                pppppppppppppppppppppppp
                                pppppppppppppppppppppppppppppppp
                                pppppppppppppppppppppp  pppppppp
                                ppppppppppppppppppppp    ppppppp
                                   ppppppppppppppppppp  ppppp
                                      pppppppppppppppppppp
  """
  
  
  import sys
  from functools import lru_cache, cmp_to_key
  from heapq import merge, heapify, heappop, heappush, nsmallest
  # from math import ceil, floor, gcd, fabs, factorial, fmod, sqrt, inf
  from collections import defaultdict as dd, deque, Counter as C
  from itertools import combinations as comb, permutations as perm
  from bisect import bisect_left as bl, bisect_right as br, bisect
  from time import perf_counter
  from fractions import Fraction
  from decimal import Decimal
  # sys.setrecursionlimit(pow(10, 6))
  # sys.stdin = open("input.txt", "r")
  # sys.stdout = open("output.txt", "w")
  
  mod = pow(10, 9)
  # mod2 = 998244353
  def data(): return sys.stdin.readline().strip()
  def out(var): sys.stdout.write(str(var)+"\n")
  def outa(*var, end="\n"): sys.stdout.write(' '.join(map(str, var)) + end)
  def l(): return list(sp())
  def sl(): return list(ssp())
  def sp(): return map(int, data().split())
  def ssp(): return map(str, data().split())
  def l1d(n, val=0): return [val for i in range(n)]
  def l2d(n, m, val=0): return [l1d(n, val) for j in range(m)]
  
  
  def recur(stack=0, cnt=0, op=0):
      global full
      if full == n:
          return
      if cnt == 2 * n:
          full += 1
          out(''.join(temp))
      if not stack:
          if op < n:
              temp.append("(")
              recur(stack + 1, cnt + 1, op + 1)
              temp.pop()
          else:
              return
      else:
          if op < n:
              temp.append("(")
              recur(stack + 1, cnt + 1, op + 1)
              temp.pop()
          temp.append(")")
          recur(stack - 1, cnt + 1, op)
          temp.pop()
  
  
  full = 0
  for _ in range(int(data())):
      n = int(data())
      if n == 1:
          out("()")
          continue
      full = 0
      temp = []
      recur()
  