p;main(t,s){for(;gets(s);printf("%s 00%.6s\n",s,ctime(&t)+13))p+=t=atoi(s+3)*60+atoi(s+6)-p;}