n = int(input()) q = [[int(i) for i in input().split()] for j in range(2**n)] ans = "A=" f = False f_all = True for i in range(2**n): if q[i][-1] == 1: if ans != "A=": ans += "∨" f = True ans += "(" for j in range(n): if q[i][j] == 1: ans += "P_"+str(j+1) else: ans += "¬P_"+str(j+1) if j != n-1: ans += "∧" ans += ")" else: f_all = False if f == False: ans = "A=⊥" elif f_all == True: ans = "A=⊤" print(ans)