#include <bits/stdc++.h>
using namespace std;
void _fill_int(int* p, int val, int rep) {
  int i;
  for (i = 0; i < rep; i++) p[i] = val;
}
signed long long GETi() {
  signed long long i;
  scanf("%lld", &i);
  return i;
}
int N;
int A[1002][1002];
int Q;
int AA[1002][4];
int ST[1002];
void solve() {
  int f, i, j, k, l, x, y;
  int ct = 0;
  cin >> N;
  for (y = 0; y < N; y++)
    for (x = 0; x < N; x++) cin >> A[y][x];
  for (y = 0; y < N; y++) ct += A[y][y];
  ct %= 2;
  cin >> Q;
  while (Q--) {
    cin >> i;
    if (i == 1 || i == 2) {
      cin >> i;
      ct ^= 1;
    } else
      (void)printf("%d", ct);
  }
  (void)printf("\n");
}
int main(int argc, char** argv) {
  string s;
  if (argc == 1) ios::sync_with_stdio(false);
  for (int i = 1; i < argc; i++) s += argv[i], s += '\n';
  for (int i = s.size() - 1; i >= 0; i--) ungetc(s[i], stdin);
  solve();
  return 0;
}
