#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int test, n;
  cin >> test;
  while (test--) {
    cin >> n;
    string s;
    cin >> s;
    int flag1 = 0;
    int flag2 = 0;
    for (int i = 0; i < n; i += 2) {
      if (s[i] % 2 != 0) {
        flag1 = 1;
      }
    }
    for (int i = 1; i < n; i += 2) {
      if (s[i] % 2 == 0) {
        flag2 = 1;
      }
    }
    if (n % 2 == 0) {
      if (flag2 == 1) {
        cout << "2" << endl;
      } else {
        cout << "1" << endl;
      }
    } else {
      if (flag1 == 1) {
        cout << "1" << endl;
      } else {
        cout << "2" << endl;
      }
    }
  }
}
