#include <bits/stdc++.h>
using namespace std;
template <class T>
vector<T> tokenize_to(const string &str) {
  vector<T> r;
  T x;
  istringstream is(str);
  while (is >> x) r.push_back(x);
  return r;
}
int main() {
  cin.sync_with_stdio(0);
  int n;
  cin >> n;
  int sol = 0;
  int x;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      cin >> x;
      if (i == j) {
        sol ^= x;
      }
    }
  }
  int m;
  cin >> m;
  int y;
  string ret = "";
  for (int i = 0; i < m; ++i) {
    cin >> x;
    if (x == 3) {
      if (sol)
        ret += "1";
      else
        ret += "0";
    } else {
      cin >> y;
      sol ^= 1;
    }
  }
  cout << ret << endl;
  return 0;
}
