import sys def print_ans(ls): c = len(ls) // 2 val = ls[c] if val == 2: sys.stdout.write('3 2 1 ') elif val != 1 and val != 3: sys.stdout.write(str(val) + ' ') if len(ls) >= 2: print_ans(ls[:c]) if len(ls) >= 3: print_ans(ls[c + 1:]) k = int(input()) ls = list(range(1, 2**k)) print_ans(ls) print('')