#include using namespace std; int main() { int N; cin >> N; int n = 1; for( int i = 0; i < N; i++ ) n *= 2; vector> Q( n, vector( N ) ); vector R( n ); for( int i = 0; i < n; i++ ) { for( int j = 0; j < N; j++ ) { cin >> Q[i][j]; } cin >> R[i]; } int flag0 = 0; int flag1 = 0; for( int i = 0; i < n; i++ ) { if( R[i] ) flag1 = 1; else flag0 = 1; } if( flag0 == 0 ) { cout << u8"A=⊤" << endl; return 0; } if( flag1 == 0 ) { cout << u8"A=⊥" << endl; return 0; } string ans = "A="; int flag = 0; for( int i = 0; i < n; i++ ) { if( R[i] == 0 ) continue; if( flag ) ans += u8"∨"; string X = "("; for( int j = 0; j < N; j++ ) { string s; char c[16]; sprintf( c, "%d", j + 1); if( j ) s = u8"∧"; if( Q[i][j] ) s += "P_"; else s += u8"¬P_"; s += c; X += s; } X += ")"; ans += X; flag = 1; } cout << ans << endl; }