// 4.7
#include <iostream>
#include <string>
using namespace std;
void solve(int open, int close, int n, string s) {
if (s.length() == 2 * n) {
cout<< s<< endl;
return;
}
if (open < n)
solve(open + 1, close, n, s + '(');
if (close < open)
solve(open, close + 1, n, s + ')');
}
int main() {
int n;
cin >> n;
solve(0, 0, n, "");
return 0;
}
Ly8gNC43CiNpbmNsdWRlIDxpb3N0cmVhbT4KI2luY2x1ZGUgPHN0cmluZz4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCnZvaWQgc29sdmUoaW50IG9wZW4sIGludCBjbG9zZSwgaW50IG4sIHN0cmluZyBzKSB7CiAgICBpZiAocy5sZW5ndGgoKSA9PSAyICogbikgewogICAgICAgIGNvdXQ8PCBzPDwgZW5kbDsKICAgICAgICByZXR1cm47CiAgICB9CgogICAgaWYgKG9wZW4gPCBuKQogICAgICAgIHNvbHZlKG9wZW4gKyAxLCBjbG9zZSwgbiwgcyArICcoJyk7CgogICAgaWYgKGNsb3NlIDwgb3BlbikgCiAgICAgICAgc29sdmUob3BlbiwgY2xvc2UgKyAxLCBuLCBzICsgJyknKTsKfQoKaW50IG1haW4oKSB7CiAgICBpbnQgbjsKICAgIGNpbiA+PiBuOwogICAgc29sdmUoMCwgMCwgbiwgIiIpOwogICAgcmV0dXJuIDA7Cn0K