#include <bits/stdc++.h>
using namespace std;
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << endl;
  err(++it, args...);
}
using ULL = unsigned long long;
using LL = long long;
int n, a[1001][1001], q, type, row, sum;
string s;
void input() {
  cin >> n;
  for (int i = 1; i <= (int)n; i++) {
    for (int j = 1; j <= (int)n; j++) {
      cin >> a[i][j];
      if (i == j) sum = (sum + a[i][j]) % 2;
    }
  }
  cin >> q;
  for (int i = 1; i <= (int)q; i++) {
    cin >> type;
    if (type != 3) {
      cin >> row;
      sum = 1 - sum;
    }
    if (type == 3) {
      s += to_string(sum);
    }
  }
  cout << s << '\n';
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  input();
  return 0;
}
