#include <bits/stdc++.h>
using namespace std;
long n, ar[1200][1200], res;
long tests, q, tp;
vector<long> av;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) cin >> ar[i][j];
  res = 0;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) res = res + ar[i][j] * ar[j][i];
  res %= 2;
  cin >> tests;
  for (; tests; --tests) {
    cin >> tp;
    if (tp == 3) {
      av.push_back(res);
    }
    if (tp < 3) {
      cin >> q;
      res = 1 - res;
    }
  }
  for (int i = 0; i < av.size(); i++) {
    cout << av[i];
  }
  cout << endl;
  cin.get();
  cin.get();
  return 0;
}
