#include <bits/stdc++.h>
using namespace std;
int n, tab[1000007], t[1000007], sum, a;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      scanf("%d", &t[j]);
    }
    tab[i] = t[i];
    sum = (sum + tab[i]) % 2;
  }
  int _tests;
  scanf("%d", &_tests);
  for (int _test = 0; _test < _tests; _test++) {
    scanf("%d", &a);
    if (a == 3) {
      printf("%d", sum);
    } else {
      scanf("%d", &a);
      sum = 1 - sum;
    }
  }
  printf("\n");
  return 0;
}
