#include <bits/stdc++.h>
using namespace std;
int main(int argc, char** argv) {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n;
    string s;
    cin >> n;
    cin >> s;
    int ok = 0;
    int even = 0;
    for (int i = 0; i < n; i += 2) {
      if (s[i] % 2 == 1) {
        ok = 1;
        break;
      }
    }
    for (int i = 1; i < n; i += 2) {
      if (s[i] % 2 == 0) {
        even = 1;
        break;
      }
    }
    if (n % 2 == 1) {
      cout << (ok ? 1 : 2) << endl;
    } else {
      cout << (even ? 2 : 1) << endl;
    }
  }
  return 0;
}
