from __future__ import print_function
from sys import stdin

def printf(str, *args):
	print(str % args, end='')

def copy(r, c, be_data, data):
	be_data = [[be_data[i][k] for k in range(0, len(be_data[0]))] for i in range(0, len(be_data))]
	for i in range(0, r):
		for j in range(0, c):
			be_data[i][j] = data[i][j]
	return be_data

def output(r, c, data):
	for i in range(0, r):
		printf("{")
		for j in range(0, c-1):
			printf("%d," % data[i][j])
		printf("%d}," % data[i][c-1])

def fact(n):
	if n==0:
		return 1
	else:
		return (fact(n-1)*n)

def combi(n, r):
	return fact(n)/(fact(r)*fact(n-r))

printf("\n### How many elements? ")
element = int(stdin.readline())
printf("\n### Set = {")
for i in range(1, element):
	printf("%d,"%i)
printf("%d}\n\n"%element)
printf("### ? 는 공집합 표시입니다.\n\n")
printf("### 멱집합 = {")
printf("?,") # output

# allocate element
i=element/2
j=combi(element,i)
data = [[0 for k in range(0, element)] for i in range(0, j)]
be_data = [[0 for k in range(0, element)] for i in range(0, j)]

# element : 1
c=1
r=combi(element,c)
for i in range(0, r):
	for j in range(0, c):
		be_data[i][j] = i+1
output(r,c,be_data)

# element : 2..n-1
for col in range(2,element):
	be_row=combi(element,col-1)
	r=0
	for i in range(0,be_row):
		if i<be_data[i][col-2] and be_data[i][col-2]<element:
			for j in range(be_data[i][col-2]+1, element+1):
				for k in range(0, col-1):
					data[r][k]=be_data[i][k]
				data[r][col-1]=j
				r += 1

	output(r,col,data)

	# copy data to be_data and Initialize data
	k=combi(element,element/2)
	for i in range(0,k):
		for j in range(0, element):
			be_data[i][j] = 0
	be_data = copy(r,col,be_data,data)
	for i in range(0,k):
		for j in range(0,element):
			data[i][j]=0

# element : n
printf("{")
for i in range(1,element):
	printf("%d,"%i)
printf("%d"%element)
printf("} }\n")
stdin.readline()