#include <bits/stdc++.h>
int linear[1005][1005];
int main() {
  int num;
  int i, j;
  int q, h, index, a, b, c;
  scanf("%d", &num);
  for (i = 0; i < num; ++i)
    for (j = 0; j < num; ++j) scanf("%d", &linear[i][j]);
  scanf("%d", &q);
  h = 0;
  c = 0;
  for (i = 0; i < num; ++i) c += linear[i][i] * linear[i][i];
  c %= 2;
  while (h++ < q) {
    scanf("%d", &index);
    switch (index) {
      case 1:
        scanf("%d", &a);
        c = !c;
        break;
      case 2:
        scanf("%d", &b);
        c = !c;
        break;
      case 3:
        printf("%d", c);
        break;
    }
  }
  printf("\n");
  return 0;
}
