#include <bits/stdc++.h>
long long inf = 2e18;
long long minf = -inf;
using namespace std;
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  int a[n + 1][n + 1];
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      cin >> a[i][j];
    }
  }
  int sum = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      sum += a[i][j] * a[j][i];
    }
  }
  sum %= 2;
  int q, aa, f;
  cin >> q;
  while (q--) {
    cin >> aa;
    if (aa == 3)
      cout << sum;
    else {
      cin >> f;
      sum ^= 1;
    }
  }
}
