import sys class Node: def __init__(self, val): self.val = val self.left = None self.right = None def set_l(self, node): self.left = node def set_r(self, node): self.right = node def create_tree(ls): root = len(ls) // 2 node = Node(ls[root]) if len(ls) >= 2: node.set_l(create_tree(ls[:root])) if len(ls) >= 3: node.set_r(create_tree(ls[root + 1:])) return node def print_ans(node): if node is None: return if node.val == 2: node.val = 3 elif node.val == 1: node.val = 2 elif node.val == 3: node.val = 1 sys.stdout.write(str(node.val) + ' ') print_ans(node.left) print_ans(node.right) k = int(input()) ls = list(range(1, 2**k)) tree = create_tree(ls) print_ans(tree) print('')