#include <bits/stdc++.h>
using namespace std;
int t;
int n;
string b;
int a[1011];
bool flag;
int read() {
  int _ = 1, __ = 0;
  char ___;
  ___ = getchar();
  while (___ > '9' || ___ < '0') {
    if (___ == '-') _ = -1;
    ___ = getchar();
  }
  while (___ <= '9' && ___ >= '0') {
    __ = __ * 10 + ___ - '0';
    ___ = getchar();
  }
  return _ * __;
}
int main() {
  ios::sync_with_stdio(false);
  cin >> t;
  while (t--) {
    cin >> n >> b;
    flag = 0;
    for (int i = 1; i <= n; i++) {
      a[i] = b[i - 1] - '0';
    }
    if (n % 2 == 0) {
      for (int i = 2; i <= n; i += 2) {
        if (a[i] % 2 == 0) {
          flag = 1;
          break;
        }
      }
      if (flag)
        cout << "2" << endl;
      else
        cout << "1" << endl;
    } else {
      for (int i = 1; i <= n; i += 2) {
        if (a[i] % 2 == 1) {
          flag = 1;
          break;
        }
      }
      if (flag)
        cout << "1" << endl;
      else
        cout << "2" << endl;
    }
  }
  return 0;
}
