#include <bits/stdc++.h>
const int MAX_N = 1001;
int m[MAX_N][MAX_N];
int main() {
  int ans = 0, n, q;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      scanf("%d", &m[i][j]);
    }
  }
  for (int i = 0; i < n; ++i) {
    ans += m[i][i];
  }
  ans %= 2;
  scanf("%d", &q);
  for (int i = 0; i < q; ++i) {
    int t;
    scanf("%d", &t);
    if (t == 1 || t == 2) {
      int x;
      scanf("%d", &x);
      ans = 1 - ans;
    }
    if (t == 3) {
      printf("%d", ans);
    }
  }
  puts("");
  return 0;
}
