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