#include #define rep(i,n) for (int i=0; i<(n); ++i) using namespace std; using ll = long long; map mp; bool good(int x) { if (mp.count(x)) return mp[x]; bool ret = false; for (ll i=4; i<(1<<20); i<<=1) { if (i-1 == x) return true; if (x >= i) ret = good(x-i); } return mp[x] = ret; } string solve(int N, string S) { for (int i=0; i> T; while (T--) { int N; string S; cin >> N >> S; cout << solve(N, S) << endl; } return 0; }