#include <bits/stdc++.h>
using namespace std;
const long long INF = 0x3f3f3f3f3f3f3f3fLL;
const int inf = 0x3f3f3f3f;
const int maxn = 5e5 + 5;
string s;
int main() {
  int T, n;
  cin >> T;
  while (T--) {
    cin >> n;
    cin >> s;
    int k;
    if (n % 2 == 0) {
      k = 1;
      for (int i = 2; i <= n; i += 2) {
        if ((s[i - 1] - '0') % 2 == 0) {
          k = 0;
          break;
        }
      }
    } else {
      k = 0;
      for (int i = 1; i <= n; i += 2) {
        if ((s[i - 1] - '0') % 2 == 1) {
          k = 1;
          break;
        }
      }
    }
    if (k) {
      printf("1\n");
    } else {
      printf("2\n");
    }
  }
  return 0;
}
