using System; using System.Collections.Generic; using System.Linq; using System.Text; public class Yuki792 { public static void Main() { var n = int.Parse(Console.ReadLine()); Console.Write("A="); string q = ""; var cnt = 0; var ans = new StringBuilder(); while((q = Console.ReadLine()) != null) { var qij = q.Split().Select(x => int.Parse(x)).ToList(); if(qij[qij.Count() - 1] == 0) continue; else { cnt++; ans.Append("("); for(var i = 0; i < qij.Count() - 1; ++i) { if(qij[i] != 1) ans.Append("¬"); ans.Append("P_" + (i + 1) + "∧"); } ans.Remove(ans.Length - 1, 1); ans.Append(")∨"); } } if(ans.Length == 0) { Console.WriteLine("⊥"); return; } ans.Remove(ans.Length - 1, 1); if(cnt == Math.Pow(2, n)) Console.WriteLine("⊤"); else Console.WriteLine(ans.ToString()); } }