#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef unsigned int ui; const ll mod = 1000000007; const ll INF = (ll)1000000007 * 1000000007; typedef pair P; #define stop char nyaa;cin>>nyaa; #define rep(i,n) for(int i=0;i=0;i--) #define Rep(i,sta,n) for(int i=sta;i=1;i--) #define Rep1(i,sta,n) for(int i=sta;i<=n;i++) typedef long double ld; typedef complex Point; const ld eps = 1e-2; const ld pi = acos(-1.0); int n; int q[1 << 12][12]; int r[1 << 12]; int main() { cin >> n; int cnt = 0; rep(i, 1 << n) { rep(j, n) { cin >> q[i][j]; } cin >> r[i]; if (r[i])cnt++; } if (cnt == (1 << n)) { cout << "A=⊤" << endl; } bool f = false; rep(i, (1 << n)) { if (!r[i])continue; if (!f) { cout << "A="; f = true; } else { cout << "∨"; } cout << "("; rep(j, n) { if (j > 0)cout << "∧"; if (q[i][j]) { cout << "P_" << j + 1; } else { cout << "¬P_" << j + 1; } } cout << ")"; } if (!f) { cout << "A=⊥"; } cout << endl; //stop return 0; }