#include <bits/stdc++.h>
using namespace std;
int n, a, b, q, ans, A[1001][1001];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      cin >> A[i][j];
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) ans += A[i][j] * A[j][i];
  }
  cin >> q;
  ans %= 2;
  for (int i = 0; i < q; i++) {
    cin >> a;
    if (a == 3)
      cout << ans;
    else {
      cin >> b;
      ans = !ans;
    }
  }
  return 0;
}
