#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<vector<int> > a(n, vector<int>(n));
  int sum = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      scanf("%d", &a[i][j]);
      if (i == j) sum += a[i][j];
    }
  }
  sum &= 1;
  int q;
  scanf("%d", &q);
  const char *cc = "01";
  while (q--) {
    int t;
    scanf("%d", &t);
    if (t == 3) {
      printf("%c", cc[sum]);
    } else {
      scanf("%d", &t);
      sum ^= 1;
    }
  }
  return 0;
}
