#include using namespace std; ifstream f("in.in"); ofstream g("out.out"); int main() { int n, test, h, m, y, z, ok, nr, p; string time, XY, ZT, mirror; f>>n; for(int i=0;i>time; ok=0; XY=time.substr(0, 2); ZT=time.substr(3, 2); h=time[3]-'0'; m=time[4]-'0'; y=time[0]-'0'; z=time[1]-'0'; nr=1000*y+100*z+10*h+m; if(y*10+z<=24){ if (ok==0 && ZT == "00" && (XY == "12" || XY == "13" || XY == "14" || XY == "15" || XY == "16" || XY == "17" || XY == "18" || XY == "19" || XY == "20" || XY == "21" || XY == "22" || XY == "23" || XY == "24" || XY == "11" || XY == "10" || XY == "09" || XY == "08" || XY == "07" || XY == "06" || XY == "05" || XY == "04" || XY == "03" || XY == "02" || XY == "01" || XY == "00")){ g<<"YES"<