#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b,c,d,s,x,n,e,f;
	cin>>a>>b>>c>>d;
	s=a*60+b;
	x=c*60+d;
	n=x-s;
	e=n/60;
	f=n%60;
	printf("%d %d",e,f);
	return 0;
}
/**************************************************************
	Problem: 1462
	User: xiaojingxuan
	Language: C++
	Result: Accepted
	Time:17 ms
	Memory:2072 kb
****************************************************************/