#include <bits/stdc++.h>
using namespace std;
void Solve() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  int x = s.size();
  if (x % 2 == 1) {
    for (int i = 0; i < s.size(); i += 2) {
      if ((s[i] - '0') % 2 == 1) {
        cout << "1" << endl;
        return;
      }
    }
    cout << "2" << endl;
    return;
  }
  for (int i = 1; i < s.size(); i += 2) {
    if ((s[i] - '0') % 2 == 0) {
      cout << "2" << endl;
      return;
    }
  }
  cout << "1" << endl;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  cin >> t;
  while (t--) {
    Solve();
  }
  return 0;
}
