#include<stdio.h>
int main(void)
{
int a, b, c, d, e, f, temp;
scanf("%d%d%d%d", &a, &b, &c, &d);
temp = 60 * (c - a) + (d - b);
printf("%d %d", temp / 60, temp % 60);
return(0);
}
07-21
2661
07-27
512
08-18
501