#include <bits/stdc++.h>
using namespace std;
int main() {
  bool a[1100][1100];
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      scanf("%d", &a[i][j]);
    }
  }
  int sum = 0;
  for (int i = 0; i < n; i++) sum += a[i][i];
  sum = sum % 2;
  int q;
  scanf("%d", &q);
  while (q--) {
    scanf("%d", &n);
    if (n == 3)
      printf("%d", sum);
    else {
      int p;
      scanf("%d", &p);
      sum++;
      sum = sum % 2;
    }
  }
}
