#include <bits/stdc++.h>
using namespace std;
int T, n;
void outp() {
  int sc = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= sc; j++) {
      printf("(");
    }
    for (int j = 1; j <= n - sc; j++) {
      printf("()");
    }
    for (int j = 1; j <= sc; j++) {
      printf(")");
    }
    sc++;
    printf("\n");
  }
}
void inp() {
  scanf("%d", &T);
  for (int sl = 1; sl <= T; sl++) {
    scanf("%d", &n);
    outp();
  }
}
int32_t main() { inp(); }
