func_code_string: #include <bits/stdc++.h>   using namespace std;   const int MOD = 1000000007;   const long long INF = 1000000007;   const long long INF2 = 1000000007LL * 1000000007LL;   const long double EPS = 1e-9;   const int SIZE = 1001000;   int n, a, b;   string fn[SIZE];   int val[SIZE], ans[SIZE];   int z[SIZE];   vector<int> g[SIZE];   void setVal(int v) {     if (fn[v][0] ==  I ) {       return;     }     for (auto& i : g[v]) setVal(i);     if (fn[v][0] ==  A ) {       val[v] = val[g[v][0]] && val[g[v][1]];       return;     }     if (fn[v][0] ==  O ) {       val[v] = val[g[v][0]] || val[g[v][1]];       return;     }     if (fn[v][0] ==  X ) {       val[v] = (val[g[v][0]] + val[g[v][1]]) % 2;       return;     }     val[v] = !val[g[v][0]];   }   void dfs(int v, int zn) {     if (fn[v][0] ==  I ) {       z[v] = zn;       return;     }     if (zn == 0) {       for (auto& i : g[v]) dfs(i, 0);       return;     }     if (fn[v][0] ==  A ) {       if (val[v] == 1) {         for (auto& i : g[v]) dfs(i, 1);       } else {         if (!val[g[v][0]] && val[g[v][1]]) {           dfs(g[v][0], 1);           dfs(g[v][1], 0);         } else if (val[g[v][0]] && !val[g[v][1]]) {           dfs(g[v][0], 0);           dfs(g[v][1], 1);         } else {           for (auto& i : g[v]) dfs(i, 0);         }       }       return;     }     if (fn[v][0] ==  O ) {       if (val[v] == 0) {         for (auto& i : g[v]) dfs(i, 1);       } else {         if (val[g[v][0]] && val[g[v][1]]) {           dfs(g[v][0], 0);           dfs(g[v][1], 0);         } else if (!val[g[v][0]] && val[g[v][1]]) {           dfs(g[v][0], 0);           dfs(g[v][1], 1);         } else if (val[g[v][0]] && !val[g[v][1]]) {           dfs(g[v][0], 1);           dfs(g[v][1], 0);         }       }       return;     }     for (auto& i : g[v]) dfs(i, zn);   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     cin >> n;     for (int i = 0; i < n; ++i) {       cin >> fn[i];       if (fn[i] ==  IN ) {         cin >> val[i];       } else if (fn[i] ==  NOT ) {         cin >> a;         --a;         g[i].push_back(a);       } else {         cin >> a;         --a;         g[i].push_back(a);         cin >> a;         --a;         g[i].push_back(a);       }     }     setVal(0);     dfs(0, 1);     for (int i = 0; i < n; ++i) {       if (fn[i][0] ==  I ) {         if (z[i])           cout << !val[0];         else           cout << val[0];       }     }     return 0;   }   