#include <bits/stdc++.h>
using namespace std;
bool vis[10000001];
int gcd(int a, int b) { return (b == 0 ? a : gcd(b, a % b)); }
int lcm(int a, int b) { return ((a * b) / gcd(a, b)); }
int main() {
  int n;
  scanf("%d", &n);
  int sum = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      int a;
      scanf("%d", &a);
      if (i == j) sum += a;
    }
  }
  sum %= 2;
  int q;
  cin >> q;
  for (int i = 0; i < q; i++) {
    int t;
    scanf("%d", &t);
    if (t == 3)
      cout << sum;
    else {
      int y;
      scanf("%d", &y);
      sum = 1 - sum;
    }
  }
}
