#include<stdio.h>
int main(void)
{
	int h,m,s;
	while(1){
		scanf("%d",&h);
		scanf("%d",&m);
		scanf("%d",&s);
		if(h == -1 && m == -1 && s == -1){
			break;
		}
		scanf("%d %1f %1f",&h,&m,&s);
	}
	return 0;
}