#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  srand(time(0));
  long long qwe = 1;
  cin >> qwe;
  while (qwe--) {
    long long n, f = 0;
    string s;
    cin >> n >> s;
    if (n % 2 == 0) {
      for (int i = 1; i < s.size(); i += 2)
        if ((s[i] - '0') % 2 == 0) f = 1;
      if (f)
        cout << "2\n";
      else
        cout << "1\n";
    } else {
      for (int i = 0; i < s.size(); i += 2)
        if ((s[i] - '0') % 2 == 1) f = 1;
      if (f)
        cout << "1\n";
      else
        cout << "2\n";
    }
  }
}
