#include using namespace std; int is_valid(char vv[]){ int h = (vv[0]-48)*10+(vv[1]-48); int m = (vv[3]-48)*10+(vv[4]-48); int i_m = (vv[4]-48)*10+(vv[3]-48); int full = h*100+m; if(h >= 0 && h < 24 && vv[2]==58){ if(m >= 0 && m < 60){ if(m == 0 || h == m || h == i_m || ((h+22) == m && (h-1)%11 == 0) || full == 1024 || full == 2048){ return true; }else{ return false; } } } return false; } int main(){ int n; cin >> n; bool tb[n]; char dt[6]; for(int i = 0; i < n; ++i){ cin >> dt; tb[i]=is_valid(dt); } for(int i = 0; i < n; ++i){ if(tb[i] == true){ cout << "YES" << endl; }else{ cout << "NO" << endl; } } }