n = int(input())
st = [0] * (n + 1)
def dfs(x):
if x > n:
for i in range(1,n+1):
if st[i]:
print(i,end = ‘ ‘)
print()
return 0
st[x] = 1
dfs(x + 1)
st[x] = 0
dfs(x + 1)
dfs(1)