#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, odd = 0, even = 0, i;
    cin >> n;
    char ara[n + 1];
    for (i = 0; i < n; i++) cin >> ara[i];
    if (n % 2 == 0) {
      for (i = 1; i < n; i += 2) {
        if ((ara[i] - '0') % 2 == 0)
          even++;
        else
          odd++;
      }
      if (even)
        cout << "2" << endl;
      else
        cout << "1" << endl;
    } else {
      for (i = 0; i < n; i += 2) {
        if ((ara[i] - '0') % 2 == 0)
          even++;
        else
          odd++;
      }
      if (odd)
        cout << "1" << endl;
      else
        cout << "2" << endl;
    }
  }
}
