package main import "fmt" func pow(a, b int) int { res := 1 for range make([]struct{}, b) { res *= a } return res } func main() { var n int fmt.Scan(&n) ans := make([][]bool, pow(2, n)) var notAllOkFlg, notAllNgFlg bool for i := range ans { q := make([]int8, n) for j := range q { fmt.Scan(&q[j]) } var r int8 fmt.Scan(&r) if r == 1 { ans[i] = make([]bool, n) for j, v := range q { if v == 1 { ans[i][j] = true } } notAllNgFlg = true } else { notAllOkFlg = true } } fmt.Print("A=") if !notAllNgFlg { fmt.Println("⊥") } else if !notAllOkFlg { fmt.Println("⊤") } else { flg := false for i := range ans { if ans[i] == nil { continue } if flg { fmt.Print("∨") } fmt.Print("(") for j, v := range ans[i] { if j != 0 { fmt.Print("∧") } if !v { fmt.Print("¬") } fmt.Print("P_") fmt.Print(j + 1) } fmt.Print(")") flg = true } fmt.Println() } }