#include <bits/stdc++.h>
using namespace std;
vector<string> ans;
int n;
void generate(string curr, int open1, int close1, int open2, int close2) {
// If current length equals required length
if(curr.length() == n) {
if(open1 == close1 && open2 == close2) { // All brackets are matched
ans.push_back(curr);
}
return;
}
// Can add ( if we haven't used all n/2 opening brackets
if(open1 < n/2) {
generate(curr + '(', open1 + 1, close1, open2, close2);
}
// Can add ) if we have more ( than )
if(close1 < open1) {
generate(curr + ')', open1, close1 + 1, open2, close2);
}
// Can add [ if we haven't used all n/2 opening brackets
if(open2 < n/2) {
generate(curr + '[', open1, close1, open2 + 1, close2);
}
// Can add ] if we have more [ than ]
if(close2 < open2) {
generate(curr + ']', open1, close1, open2, close2 + 1);
}
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cin >> n;
if(n % 2 == 1) { // Odd length can't form valid sequence
cout << '\n';
return 0;
}
generate("", 0, 0, 0, 0);
sort(ans.begin(), ans.end()); // Sort lexicographically
for(const string& s : ans) {
cout << s << '\n';
}
return 0;
}