#include <bits/stdc++.h>
int n, q, a, ans;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j) {
      scanf("%d", &a);
      if (i == j) ans ^= a;
    }
  scanf("%d", &q);
  while (q--) {
    scanf("%d", &a);
    if (a == 3)
      printf("%d", ans);
    else
      scanf("%d", &a), ans ^= 1;
  }
}
