#include <bits/stdc++.h>
using namespace std;
int num[1004][1004], n, q, p, a;
int main() {
  while (~scanf("%d", &n)) {
    for (int i = 1; i <= n; i++)
      for (int j = 1; j <= n; j++) scanf("%d", &num[i][j]);
    int cnt = 0;
    for (int i = 1; i <= n; i++) {
      int t = i;
      for (int j = 1; j <= n; j++) {
        cnt += num[t][j] * num[j][t];
      }
    }
    cnt %= 2;
    scanf("%d", &q);
    while (q--) {
      scanf("%d", &a);
      if (a == 1) {
        scanf("%d", &p);
        cnt ^= 1;
      }
      if (a == 2) {
        scanf("%d", &p);
        cnt ^= 1;
      }
      if (a == 3) {
        printf("%d", cnt);
      }
    }
    printf("\n");
  }
  return 0;
}
