#include #define rep(i, n) for(int i=0; i<(n); ++i) #define rep2(i, s, n) for(int i=s; i<(n); ++i) #define ALL(v) (v).begin(), (v).end() using namespace std; typedef long long ll; template using priority_queue_rev = priority_queue, greater >; static const int INTINF = (2147483647 >> 1); // 10^9 + 5000 static const ll LLINF = (9223372036854775807 >> 1); static const int MAX = 1e5+1; static const ll MOD = 1e9+7; namespace Kunitaka{ template< typename TYPE, std::size_t SIZE > std::size_t array_length(const TYPE (&array)[SIZE]) { return SIZE; } template inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } } using namespace Kunitaka; namespace Printer{ void br(){ cout << endl; } void loop_cnt(int i){ cout << "i = " << i << endl; } void loop_cnt(int i, int j){ cout << "i = " << i << ", " << "j = " << j << endl; } template void print(T x){ cout << x << endl; } template void print(T x, S y){ cout << x << "," << y << endl; } template void print(T x, S y, U z){ cout << x << "," << y << "," << z << endl; } template void print(pair p){ cout << p.first << ", " << p.second << endl; } template< typename TYPE, std::size_t SIZE > void print(const TYPE (&array)[SIZE]){ int lim = array_length(array); for(int i=0; i void print(vector v){ for(int i=0; i void print(vector > vv){ for(int i=0; i> T; rep(i, T){ int N; cin >> N; string str; cin >>str; if(str.size() < 3){ ans_p(false); continue; } str += "x"; rep(i, N+1){ if(i-1 >=0 && i+1 < str.size()) if(str[i-1] == '-' && str[i] == '-' && str[i+1] == '-'){ str[i] = 'o'; if(i+2 < str.size()){ if(str[i+2] == 'o'){ str[i+1] = 'x'; continue; } } if(i-2 >= 0){ if(str[i-2] == 'o'){ str[i-1] = 'x'; continue; } } } } // print(str); bool ok = false; char a = str[0]; char b = str[1]; char c = str[2]; char d = str[3]; rep2(j, 3, N+1){ a = str[j-3]; b = str[j-2]; c = str[j-1]; d = str[j]; if(a == 'o' && b == 'o' && c == '-') ok = true; if(a == '-' && b == 'o' && c == 'o') ok = true; if(a == '-' && b == 'o' && c == '-' && d == '-') ok = true; if(a == '-' && b == '-' && c == 'o' && d == '-') ok = true; if(a == 'o' && b == 'o' && c == 'o') ok = true; if(a == 'o' && b == '-' && c == 'o') ok = true; } ans_p(ok); // break; } return 0; }