# -*- encoding: utf-8 -*- n=gets.to_i a=$<.map{|s|s.split.map &:to_i}.select{|a|a[-1]>0} puts("A="+(a.size==0 ? "⊥" : "⊤"))+exit if a.size==0||a.size==2**n puts "A="+a.map{|t|?(+(1..n).map{|i|["¬",""][t[i-1]]+"P_"+i.to_s}*"∧"+?)}*"∨"