import java .util.*;
class N{
public static void main(String[] args) {
//Scanner sc = new Scanner(System.in);
//String str = sc.nextLine();
int n = 2;
String str = "(";
printPermutation(str,n,1,0);// 1 is count of ( and 0 is for left paren count at initial state.
}
public static void printPermutation(String ans,int n,int lpcount,int rpcount){
if(ans.length() == n*2 ){
if(isValid(ans,lpcount,rpcount)){
System.out.println(ans);
}
return ;
}
printPermutation(ans+"(", n ,lpcount+1,rpcount);
printPermutation(ans+")", n ,lpcount,rpcount+1);
}
public static boolean isValid(String ques,int lpcount , int rpcount){
if(lpcount == rpcount){
Stack<Character> st = new Stack();
for(int i=0;i<ques.length();i++){
char ch = ques.charAt(i);
if(ch == '('){
st.push(ch);
}else{
if(st.isEmpty() == false){
st.pop();
}
}
}
if(st.size() ==0){
return true;
}
}
return false;
}
}