import sys input = sys.stdin.readline ans = [] cnt = 0 n = int(input()) for i in range(2 ** n): f = input().split() if f[-1] == '1': cnt += 1 tmp = [] for j in range(n): if f[j] == '1': tmp += ['P_' + str(j + 1)] else: tmp += ['¬P_' + str(j + 1)] ans += ['(' + '∧'.join(tmp) + ')'] if cnt == 0: ans = ['⊥'] elif cnt == 2 ** n: ans = ['⊤'] print('A=' + '∨'.join(ans))