#include<stdio.h>main(){int H1,H2,M1,M2,H,M;scanf("%d %d",&H1,&M1);scanf("%d %d",&H2,&M2);M=(M2>=M1)*(M2-M1)+(M2<M1)*(M2-M1+60);H2-=(M2<M1); H2+=((H2<H1)*24); H=H2-H1;printf("%d %d\n",H,M);}