#include using namespace std; #ifdef LOCAL #include "settings/debug.cpp" #else #define Debug(...) void(0) #endif #define rep(i, n) for (int i = 0; i < (n); ++i) using ll = long long; using ull = unsigned long long; int main() { int n; cin >> n; vector, bool>> a(1 << n); rep(i, 1 << n) { a[i].first.resize(n); rep(j, n) { int x; cin >> x; a[i].first[j] = x; } int x; cin >> x; a[i].second = x; } Debug(a); { bool ok = true; rep(i, 1 << n) ok &= a[i].second; if (ok) { cout << "A=⊤" << endl; return 0; } } { bool ok = true; rep(i, 1 << n) ok &= !a[i].second; if (ok) { cout << "A=⊥" << endl; return 0; } } string ans = "A="; bool flg = false; rep(i, 1 << n) { if (a[i].second) { Debug(i); if (flg) ans += "∨"; flg = true; ans += "("; rep(j, n) { if (!a[i].first[j]) ans += "¬"; ans += "P_" + to_string(j + 1); if (j < n - 1) ans += "∧"; } ans += ")"; } } cout << ans << endl; return 0; }