#include <bits/stdc++.h>
using namespace std;
bool a[1005][1005];
string ans1;
int main() {
  int n, m;
  while (~scanf("%d", &n)) {
    ans1 = "";
    for (int i = 0; i < n; ++i)
      for (int j = 0; j < n; ++j) scanf("%1d", &a[i][j]);
    int ans = 0;
    for (int i = 0; i < n; ++i)
      for (int j = 0; j < n; ++j) ans ^= a[i][j] * a[j][i];
    scanf("%d", &m);
    while (m--) {
      int ct, temp;
      scanf("%d", &ct);
      switch (ct) {
        case 1:
        case 2:
          scanf("%d", &temp);
          ans = 1 - ans;
          break;
        case 3:
          ans1 += char(ans + 48);
          break;
      }
    }
    cout << ans1 << endl;
  }
}
