#include <bits/stdc++.h>
using namespace std;
inline bool EQ(double a, double b) { return fabs(a - b) < 1e-9; }
const int INF = 1 << 29;
const int MAXN = 2000;
int main() {
  int N;
  scanf("%d", &N);
  int total = 0;
  for (int i = 0; i < (N); ++i) {
    for (int j = 0; j < (N); ++j) {
      int x;
      scanf("%d", &x);
      if (i == j) total += x;
    }
  }
  total &= 1;
  int Q;
  scanf("%d", &Q);
  for (int q = 0; q < (Q); ++q) {
    int c, k;
    scanf("%d", &c);
    if (c == 3) {
      printf("%d", total);
      continue;
    }
    scanf("%d", &k);
    total = (total + 1) & 1;
  }
  printf("\n");
  return 0;
}
