# -*- coding: utf-8 -*- def main(): n = int(input()) f=[] for x in range(2**n): x = input().split() if x[-1]=='1': tmp = '' for i in range(0,n): if x[i]=='0': tmp+='¬' tmp += 'P_{}∧'.format(i+1) tmp = tmp[:-1] f.append(tmp) l = len(f) res = 'A=' if l ==0: res+='⊥' elif l==2**n: res+=chr(8868) else: for x in f: res +='({})∨'.format(x) res=res[:-1] print(res) main()