#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, n;
  cin >> i;
  for (int t = 0; t < i; t++) {
    cin >> n;
    char a[n];
    for (int j = 0; j < n; j++) {
      cin >> a[j];
    }
    int re = 0;
    int ro = 0;
    int be = 0;
    int bo = 0;
    for (int k = 0; k < n; k++) {
      if (k % 2 == 0) {
        if (a[k] % 2 == 0)
          re++;
        else
          ro++;
      } else {
        if (a[k] % 2 == 0)
          be++;
        else
          bo++;
      }
    }
    if (n % 2 == 0) {
      if (be > 0)
        cout << "2" << endl;
      else
        cout << "1" << endl;
    } else {
      if (ro > 0)
        cout << "1" << endl;
      else
        cout << "2" << endl;
    }
  }
}
