#include <bits/stdc++.h>
using namespace std;
const double pi = 2 * acos(0);
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ;
  int q;
  cin >> q;
  while (q--) {
    int n;
    cin >> n;
    string s;
    cin >> s;
    vector<int> a(n + 1);
    for (int i = 0; i < n; i++) {
      a[i + 1] = s[i] - '0';
    }
    if (n % 2 == 0) {
      bool ok = 0;
      for (int i = 1; i <= n; i++) {
        if (i % 2 == 0 && a[i] % 2 == 0) ok = 1;
      }
      if (ok)
        cout << 2 << "\n";
      else
        cout << 1 << "\n";
    } else {
      bool ok = 0;
      for (int i = 1; i <= n; i++) {
        if (i % 2 && a[i] % 2) ok = 1;
      }
      if (ok)
        cout << 1 << "\n";
      else
        cout << 2 << "\n";
    }
  }
  return 0;
}
