#include #define rep(i,s,n) for (int i = (int)(s); i < (int)(n); i++) #define all(v) begin(v),end(v) using namespace std; using ll = long long; bool chmin(auto &a, auto b){ return a > b ? a = b, 1 : 0; } bool chmax(auto &a, auto b){ return a < b ? a = b, 1 : 0; } template ostream &operator<<(ostream &os, const vector &a){ rep(i, 0, a.size()) os << (i ? " " : "") << a[i]; return os; } void dump(auto ...vs){ ((cerr << vs << ' '), ...) << endl; } int win(vector a){ int n = a.size(); unordered_map memo; auto dfs = [&](auto sfs, int s, int t) -> int { int key = s | (t << (n-1)); if (memo.contains(key)){ return memo[key]; } if (s == (1<<(n-1))-1){ int pre = -1; int score = 0; rep(i,0,n-1){ if (t >> i & 1) continue; // * int mul = 1; rep(j,pre+1,i+1){ mul &= a[j]; } score ^= mul; pre = i; } { int mul = 1; rep(j,pre+1,n){ mul &= a[j]; } score ^= mul; } return memo[key] = score; } int who = (popcount(s) & 1) ^ 1; rep(i,0,n-1){ if (s >> i & 1) continue; int ns = s ^ (1 << i); rep(j,0,2){ int nt = t ^ (j << i); int nxt = sfs(sfs,ns,nt); if (who == nxt){ return memo[key] = who; } } } return memo[key] = 1^who; }; return dfs(dfs,0,0); } int pred(vector a){ int n = a.size(); if (n % 2 == 0){ if (a[0] != 0 || a[n-1] != 0){ return 1; } rep(i,1,n-1){ if (a[i] == 1 && a[i+1] == 1){ return 1; } } return 0; } if (a[0] == a[n-1]){ return 0; } rep(i,0,n-1){ if (a[i] == 1 && a[i+1] == 1){ return 0; } } return 1; } void jikken1(){ int n; cin >> n; rep(s,0,1< a(n); rep(i,0,n){ a[i] = (s >> i & 1); } // dump(a,":",win(a),pred(a)); if (win(a) != pred(a)){ dump(a,":",win(a),pred(a)); } // if (win(a) == (n & 1)){ // dump(a); // } } } void solve(){ int n; cin >> n; string s; cin >> s; vector a(n); rep(i,0,n){ a[i] = (int(s[i] - '0') & 1); } cout << (pred(a) == 1 ? "Alice" : "Bob") << '\n'; } int main(){ cin.tie(0)->sync_with_stdio(0); int t; cin >> t; while (t--){ solve(); } }