#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; int main() { int32_t n; cin >> n; string ans = ""; bool all0 = true, all1 = true; for (auto i = 0; i < (1 << n); ++i) { vector qs(n); for (auto j = 0; j < n; ++j) { int32_t q; cin >> q; qs[j] = q == 1; } int32_t r; cin >> r; if (r == 0) { all1 = false; continue; } all0 = false; if (ans != "") ans += "∨"; ans += "("; for (auto j = 0; j < n; ++j) { if (j != 0) ans += "∧"; if (!qs[j]) ans += "¬"; ans += "P_" + to_string(j + 1); } ans += ")"; } if (all0) ans = "⊥"; if (all1) ans = "⊤"; cout << "A=" << ans << endl; return 0; }