#include <bits/stdc++.h>
using namespace std;
long long MOD = 1e9 + 7;
long long min_s = 1e9;
long long max_e = 0;
void init_code() {}
long long gcd(long long a, long long b) {
  while (b != 0) {
    a = a % b;
    swap(a, b);
  }
  return a;
}
long long binExp(long long x, long long n, long long m = MOD) {
  long long res = 1;
  while (n != 0) {
    if (n % 2 == 1) {
      res = ((res % m) * (x % m)) % m;
    }
    x = ((x % m) * (x % m)) % m;
    n /= 2;
  }
  return res;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    vector<char> vect;
    for (long long i = 0; i < 2 * n; i++) {
      if (i % 2 == 0)
        vect.push_back('(');
      else
        vect.push_back(')');
    }
    for (long long i = 0; i < 2 * n; i++) cout << vect[i];
    cout << '\n';
    for (long long i = 1; i < 2 * n - 1; i += 2) {
      char temp = vect[i];
      vect[i] = vect[i + 1];
      vect[i + 1] = temp;
      for (long long i = 0; i < 2 * n; i++) cout << vect[i];
      cout << '\n';
    }
  }
  return 0;
}
