#include <bits/stdc++.h>
using namespace std;
int a[1000 + 5][1000 + 5];
int n, q;
int ans() {
  int sum = 0;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) {
      sum += a[i][j] * a[j][i];
      sum = sum % 2;
    }
  return sum;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) scanf("%d", &a[i][j]);
  scanf("%d", &q);
  int tmp = ans();
  while (q--) {
    int value;
    scanf("%d", &value);
    if (value == 1) {
      int row;
      scanf("%d", &row);
      tmp = 1 - tmp;
    } else if (value == 2) {
      int col;
      scanf("%d", &col);
      tmp = 1 - tmp;
    } else {
      cout << tmp;
    }
  }
  cout << endl;
  return 0;
}
