#include #include using namespace std; using namespace atcoder; using ll = long long int; using ld = long double; const ll MAX = 5000000000000000000; const ld PI = 3.14159265358979; const ll MOD = 0;//2024948111; ld dotorad(ld K){return PI * K / 180.0;} ld radtodo(ld K){return K * 180.0 / PI;} mt19937 mt; void randinit(){srand((unsigned)time(NULL));mt = mt19937(rand());} int main(){ ll T; cin >> T; for(ll t = 0;t < T;t++){ ll N; char ans = 'X'; string S; cin >> N >> S; for(ll i = 0;i < N - 2;i++){ if(S[i] == 'o' && S[i + 1] == 'o' && S[i + 2] == 'o') ans = 'O'; if(S[i] == 'o' && S[i + 1] == '-' && S[i + 2] == 'o') ans = 'O'; if(S[i] == 'o' && S[i + 1] == 'o' && S[i + 2] == '-') ans = 'O'; if(S[i] == '-' && S[i + 1] == 'o' && S[i + 2] == 'o') ans = 'O'; } for(ll i = 0;i < N - 3;i++){ if(S[i] == '-' && S[i + 1] == 'o' && S[i + 2] == '-' && S[i + 3] == '-') ans = 'O'; if(S[i] == '-' && S[i + 1] == '-' && S[i + 2] == 'o' && S[i + 3] == '-') ans = 'O'; } for(ll i = 0;i < N - 1;i++){ if(S[i] == 'o' && S[i + 1] == '-'){ ll p = i; i++; while(S[i] == '-') i++; if(S[i] == 'o' && (i - p) % 2 == 0){ ans = 'O'; } } } for(ll i = 0;i < N - 4;i++){ if(S[i] == 'o' && S[i + 1] == '-' && S[i + 2] == '-' && S[i + 3] == '-' && S[i + 4] == 'o') ans = 'O'; } cout << ans << endl; } }