n = int(input()) grid = [list(map(int, input().split())) for _ in range(1 << n)] ans = ["A="] se = set() for i in range(1 << n): if grid[i][-1] == 0: se.add(0) continue se.add(1) ans.append("(") for j in range(n): if grid[i][j] == 1: ans.append(f"P_{j + 1}") else: ans.append(f"¬P_{j + 1}") ans.append("∧") ans.pop() ans.append(")") ans.append("∨") ans.pop() if len(se) == 1: if 0 in se: print("A=⊥") else: print("A=⊤") else: print("".join(ans))