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