#include <bits/stdc++.h>
int i, j, n, t1, t2, t3, k, q, a[1005][1005], sum = 0, ans;
int jisuan(int n, int a[1005][1005]) {
  sum = 0;
  for (i = 0; i < n; i++) sum += a[i][i] * a[i][i];
  return sum % 2;
}
int main() {
  scanf("%d", &n);
  {
    k = 0;
    for (i = 0; i < n; i++)
      for (j = 0; j < n; j++) scanf("%d", &a[i][j]);
    ans = jisuan(n, a);
    scanf("%d", &q);
    while (q--) {
      scanf("%d", &t1);
      if (t1 == 3)
        printf("%d", ans);
      else {
        scanf("%d", &t2);
        ans++;
        ans %= 2;
      }
    }
    printf("\n");
  }
  return 0;
}
