n = int(input()) a = [list(map(int, input().split())) for _ in range(1 << n)] all_true = True all_false = True ans = "A=" for i in range(1 << n): if a[i][n] == 1: all_false = False if len(ans) > 2: ans += "∨" ans += "(" for j in range(n): if j > 0: ans += "∧" if a[i][j] == 0: ans += "¬" ans += "P_" + str(j+1) ans += ")" else: all_true = False if all_true: ans = "A=⊤" elif all_false: ans = "A=⊥" print(ans)