#include using namespace std; using lint = long long; template using V = vector; template using VV = V< V >; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int n; cin >> n; bool bt = true, bf = true; string res; for (int bit = 0; bit < 1 << n; ++bit) { V<> q(n); for (auto&& e : q) cin >> e; int r; cin >> r; if (!r) { bt = false; continue; } bf = false; if (!res.empty()) res += "∨"; res += '('; for (int i = 0; i < n; ++i) { if (i) res += "∧"; if (q[i]) { res += "P_"; // res += '1' + i; res += to_string(i + 1); } else { res += "¬P_"; // res += '1' + i; res += to_string(i + 1); } } res += ')'; } cout << "A="; if (bt) return cout << "⊤" << '\n', 0; if (bf) return cout << "⊥" << '\n', 0; cout << res << '\n'; }