#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, q, unusual_square = 0, temp;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      cin >> temp;
      if (i == j)
        if (temp) unusual_square = 1 - unusual_square;
    }
  }
  cin >> q;
  cin.ignore();
  string line, answer;
  for (int i = 1; i <= q; i++) {
    getline(cin, line);
    if (line[0] == '3')
      answer += (char)((int)'0' + unusual_square);
    else
      unusual_square = 1 - unusual_square;
  }
  cout << answer << endl;
  return 0;
}
