#include #define rep(i,n) for(int i = 0; i < (n); i++) using namespace std; typedef long long ll; int main(){ cin.tie(0); ios::sync_with_stdio(0); int N; cin >> N; string ans = "A="; int T = 1, F = 1; rep(S,1< Q(N); rep(i,N) cin >> Q[i]; int R; cin >> R; T &= R == 1; F &= R == 0; if(R == 1) { if(ans.size() != 2u) ans += "∨"; ans += "("; rep(i,N) { if(i) ans += "∧"; if(Q[i] == 0) ans += "¬"; ans += "P_" + to_string(i + 1); } ans += ")"; } } if(T) ans = "A=⊤"; if(F) ans = "A=⊥"; cout << ans << endl; }