#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, n;
  cin >> t;
  string s;
  for (int i = 0; i < t; i++) {
    cin >> n;
    cin >> s;
    int k = 0;
    if (n % 2 == 0) {
      for (int i = 1; i < n; i += 2)
        if ((int(s[i]) - 48) % 2 == 0) {
          k = 1;
          cout << 2 << "\n";
          break;
        }
      if (k == 0) cout << 1 << "\n";
    }
    if (n % 2 == 1) {
      for (int i = 0; i < n; i += 2)
        if ((int(s[i]) - 48) % 2 == 1) {
          k = 1;
          cout << 1 << "\n";
          break;
        }
      if (k == 0) cout << 2 << "\n";
    }
  }
  return 0;
}
