#include <bits/stdc++.h>
using namespace std;
inline void pisz(int n) { printf("%d\n", n); }
template <typename T, typename TT>
ostream &operator<<(ostream &s, pair<T, TT> t) {
  return s << "(" << t.first << "," << t.second << ")";
}
template <typename T>
ostream &operator<<(ostream &s, vector<T> t) {
  for (int i = 0; i < ((int)((t).size())); i++) s << t[i] << " ";
  return s;
}
const int fx[4][2] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}};
int n, q;
int a[1000][1000];
int main(int argc, char *argv[]) {
  scanf("%d", &n);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) scanf("%d", &a[i][j]);
  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 &= 1;
  scanf("%d", &q);
  while (q--) {
    int type, num;
    scanf("%d", &type);
    if (type != 3) {
      scanf("%d", &num);
      sum ^= 1;
    } else {
      printf("%d", sum);
    }
  }
  printf("\n");
  return EXIT_SUCCESS;
}
