N = int(input()) QR = [list(map(int, input().split())) for _ in range(2**N)] AND = "∧" OR = "∨" NOT = "¬" BOTTOM = "⊥" TOP = "⊤" s = 0 ans = [] for i in range(2**N): r = QR[i][-1] s += r if r==1: temp = [] for j in range(N): if QR[i][j]==1: temp.append(f"P_{j+1}") else: temp.append(f"{NOT}P_{j+1}") ans.append("(" + AND.join(temp) + ")") if s==0: print(f"A={BOTTOM}") exit() elif s==2**N: print(f"A={TOP}") exit() print("A=" + OR.join(ans))