#include using namespace std; using int64 = long long; int main() { int N, Q[1 << 12][12], K[1 << 12]; cin >> N; cout << "A="; bool ok = false; bool all = false; for(int i = 0; i < 1 << N; i++) { int bit[12]; for(int j = 0; j < N; j++) { cin >> Q[i][j]; } cin >> K[i]; if(K[i] == 0) all = true; } if(!all) { cout << "⊤" << endl; return 0; } for(int i = 0; i < 1 << N; i++) { if(K[i] == 1) { if(ok) cout << "∨"; ok = true; cout << "("; for(int j = 0; j < N; j++) { if(j > 0) { cout << "∧"; } if(Q[i][j] == 0) { cout << "¬P_" << j + 1; } else { cout << "P_" << j + 1; } } cout << ")"; } } if(!ok) { cout << "⊥" << endl; } else { cout << endl; } }