#!/usr/bin/env python3 from typing import * def solve(n: int, s: str) -> bool: for t in ('ooo', 'oo-', 'o-o', '-oo', '-o--', '--o-'): if t in s: return True return False # generated by online-judge-template-generator (https://github.com/kmyk/online-judge-template-generator) def main(): import sys tokens = iter(sys.stdin.read().split()) T = int(next(tokens)) N = [None for _ in range(T)] S = [None for _ in range(T)] for i in range(T): N[i] = int(next(tokens)) S[i] = next(tokens) assert next(tokens, None) is None for i in range(T): ans = solve(N[i], S[i]) print(ans and 'O' or 'X') if __name__ == '__main__': main()