#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n;
  cin >> n;
  string s[n];
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j <= i; j++) cout << '(';
    for (long long j = 0; j <= i; j++) cout << ')';
    for (long long j = 0; j < n - i - 1; j++) cout << "()";
    cout << '\n';
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t = 1, x = 0;
  cin >> t;
  while (t--) {
    x++;
    solve();
  }
}
