N=int(input()) T=[list(map(int,input().split())) for i in range(2**N)] V=[T[i][-1] for i in range(2**N)] if min(V)==1: print("A=⊤") elif max(V)==0: print("A=⊥") else: ANS=[] for v in T: if v[-1]==0: continue ANSSTR=[] for i in range(N): if v[i]==0: ANSSTR.append("¬P_"+str(i+1)) else: ANSSTR.append("P_"+str(i+1)) #print(ANSSTR) ANS.append("("+"∧".join(ANSSTR)+")") print("A="+"∨".join(ANS))