#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, ret = 0, x;
  scanf("%d", &n);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) {
      scanf("%d", &x);
      if (i == j) ret = (ret + x) % 2;
    }
  int q;
  scanf("%d", &q);
  for (int c = 0; c < q; c++) {
    int a, b;
    scanf("%d", &a);
    if (a != 3)
      scanf("%d", &b), ret = (ret + 1) % 2;
    else
      printf("%d", ret);
  }
  printf("\n");
  return 0;
}
