#include <bits/stdc++.h>
using namespace std;
int n, q;
int sg = 0;
int a;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (long long i = 0; i < (n); i++) {
    for (long long j = 0; j < (n); j++) {
      cin >> a;
      if (i == j && a == 1) sg ^= 1;
    }
  }
  cin >> q;
  for (long long i = 0; i < (q); i++) {
    cin >> n;
    if (n == 3) {
      cout << sg;
      continue;
    }
    sg ^= 1;
    cin >> n;
  }
  cout << "\n";
  return 0;
}
