n = gets.to_i ans = [] (2**n).times do q = gets.split.map(&:to_i) next if q[-1] == 0 s = "(" n.times do |i| s += "¬" if q[i] == 0 s += "P_#{i+1}" s += (i == n-1 ? ")" : "∧") end ans << s end print "A=" if ans.size == 0 puts "⊥" elsif ans.size == n**2 puts "⊤" else ans.size.times do |i| print ans[i] print "∨" if i != ans.size-1 end end