// Round1x.cpp : Defines the entry point for the console application. // #include #include #include #include using namespace std; std::vector &split(const std::string &s, char delim, std::vector &elems) { std::stringstream ss(s); std::string item; while (std::getline(ss, item, delim)) { elems.push_back(item); } return elems; } std::vector split(const std::string &s, char delim) { std::vector elems; split(s, delim, elems); return elems; } int rev(int x) { int y=0; while (x) { y = 10 * y + x % 10; x = x / 10; } return y; } int cons(int x) { while (x>9) { int c = x % 10; c--; x = x / 10; if (c != x % 10) return 0; } return 1; } int main() { int x; cin >> x; string s; for (int i = 0; i < x; i++) { cin >> s; std::vector x = split(s, ':'); int v1 = atoi(x[0].c_str()); int v2 = atoi(x[1].c_str()); if (v1>23) { cout << "NO\n"; continue; } if (v2 > 59) { cout << "NO\n"; continue; } if (v2 == 0) { cout << "YES\n"; continue; } if (v1 == v2) { cout << "YES\n"; continue; } if (v1 == rev(v2)) { cout << "YES\n"; continue; } if (cons((100*v1)+v2)) { cout << "YES\n"; continue; } if (((100 * v1) + v2)==1024) { cout << "YES\n"; continue; } if (((100 * v1) + v2) == 1024*2) { cout << "YES\n"; continue; } if (((100 * v1) + v2) == 1024 *4) { cout << "YES\n"; continue; } if (((100 * v1) + v2) == 1024 * 8) { cout << "YES\n"; continue; } cout << "NO\n"; } return 0; }