import Control.Monad (replicateM) import Data.List (intercalate) main :: IO () main = do xs <- flip replicateM (map read . words <$> getLine) . (2^) . read =<< getLine let ts = filter ((==1) . last) xs putStrLn $ "A=" ++ if length xs == length ts then "⊤" else if null ts then "⊥" else let tss = map init ts; nl = take (length (head tss)) $ iterate (+1) 1 in intercalate "∨" ["(" ++ intercalate "∧" (zipWith (\i b -> if b == 1 then "P_" ++ show i else "¬P_" ++ show i) nl xs) ++ ")" | xs <- tss]