n = read_line.to_i m = 2 ** n q = Array.new(m) { read_line.split.map &.to_i }.select { |a| a[n] == 1 } puts "A=#{if q.size == m "⊤" elsif q.size == 0 "⊥" else str_p = (1..n).map { |i| "P_#{i}" } str_not_p = str_p.map { |s| "¬" + s } q.join("∨") { |a| "(#{a[0...n].each_with_index.join("∧") { |v, i| v == 1 ? str_p[i] : str_not_p[i] }})" } end}"