n = int(input()) a = [] s0 = 0 s1 = 1 s = [] for i in range(2**n): a.append(list(map(int,input().split()))) s0 += a[i][n] s1 *= a[i][n] if s0 == 0: print('A=⊥') elif s1 == 1: print('A=⊤') else: for i in range(2**n): if a[i][n] == 1: tmp = [] for j in range(n): if a[i][j] == 0: tmp.append('¬P_'+str(j+1)) else: tmp.append('P_' + str(j + 1)) s.append('(' + '∧'.join(tmp) + ')') print('A=' + '∨'.join(s))