#yuki792 n=int(input()) res=[] cnt=0 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)] res+=['('+'∧'.join(tmp)+')'] if cnt==0: res=['⊥'] elif cnt==2 ** n: res=['⊤'] print('A='+'∨'.join(res))