/*
* Copyright (c) 2025 Emon Thakur
* All rights reserved.
*/
#include<bits/stdc++.h>
using namespace std;
int n;
vector<string> v;
string s;
void bracket(int i,string s,int cnt1,int cnt2)
{
if(i==n)
{
v.push_back(s);
//cout<<s<<'\n';
return;
}
int rem = n-i-1;
if(cnt1+cnt2+1 <= rem)
{
//s.push_back('(');
bracket(i+1,s+'(',cnt1,cnt2+1);
//s.pop_back();
}
if(cnt2)
{
//s.push_back(')');
bracket(i+1,s+')',cnt1,cnt2-1);
//s.pop_back();
}
if(cnt1+cnt2+1 <= rem)
{
//s.push_back('[');
bracket(i+1,s+'[',cnt1+1,cnt2);
//s.pop_back();
}
if(cnt1)
{
//s.push_back(']');
bracket(i+1,s+']',cnt1-1,cnt2);
//s.pop_back();
}
}
bool valid(string &s)
{
//cout<<s<<endl;
int op1=0,op2=0;
for(auto e:s)
{
if(e=='(') op1++;
else if(e==')') op1--;
else if(e=='[') op2++;
else op2--;
if(op1 <0 || op2<0) return false;
}
if(op1 + op2) return false;
return true;
}
void naive(int i,string s)
{
if(i==n)
{
if(valid(s)) cout<<s<<'\n';
return;
}
naive(i+1,s+'(');
naive(i+1,s+')');
naive(i+1,s+'[');
naive(i+1,s+']');
}
int main()
{
ios::sync_with_stdio(false); cin.tie(nullptr);
cin >> n;
naive(0,s);
//bracket(0,s,0,0);
sort(v.begin(),v.end());
for(auto e:v) cout<<e<<'\n';
}