#include <bits/stdc++.h>
using namespace std;
const double EPS = 1E-8;
inline bool eq(double a, double b) { return a - b < EPS && b - a < EPS; }
inline bool ne(double a, double b) { return a + EPS < b || b + EPS < a; }
inline bool ls(double a, double b) { return a + EPS < b; }
inline bool gr(double a, double b) { return b + EPS < a; }
inline bool le(double a, double b) { return a - EPS < b; }
inline bool ge(double a, double b) { return b - EPS < a; }
int arr[1111][1111];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      scanf("%d", &arr[i][j]);
    }
  }
  int sum = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      sum = (sum + arr[i][j] * arr[j][i]) & 1;
    }
  }
  int q;
  scanf("%d", &q);
  for (int i = 0; i < q; i++) {
    int ctrl;
    scanf("%d", &ctrl);
    if (ctrl == 3)
      putchar('0' + sum);
    else {
      scanf("%d", &ctrl);
      sum = 1 - sum;
    }
  }
  return 0;
}
