#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const double eps = 1e-9;
const int maxn = 1005;
int main() {
  int T, cas = 1;
  int n, ans = 0, tmp;
  int a, b, q;
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j) {
      scanf("%d", &tmp);
      if (i == j) ans ^= tmp;
    }
  scanf("%d", &q);
  while (q--) {
    scanf("%d", &a);
    if (a == 3)
      putchar(ans + '0');
    else {
      scanf("%d", &b);
      ans ^= 1;
    }
  }
  puts("");
  return 0;
}
