#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9;
const int MAXN = 1e3 + 10;
int ar[MAXN];
int n;
int main() {
  scanf("%d", &n);
  int a;
  int sum = 0;
  for (int(i) = (1); (i) <= (n); (i)++)
    for (int(j) = (1); (j) <= (n); (j)++) {
      scanf(" %d", &a);
      if (i == j) {
        sum += a;
      }
    }
  sum %= 2;
  int m;
  cin >> m;
  int type;
  for (int(i) = (1); (i) <= (m); (i)++) {
    scanf(" %d", &type);
    if (type == 1 || type == 2) {
      scanf(" %d", &a);
      sum = 1 - sum;
    } else
      printf("%d", sum);
  }
  cout << endl;
  return 0;
}
