#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b,c,d,e,f,c1,x,y;
	cin>>a>>b>>c>>d;
	e=a*60+b;
	f=c*60+d;
	c=f-e;
	x=c/60;
	y=c%60;
	cout<<x<<" "<<y;
	return 0;
}

/**************************************************************
	Problem: 1462
	User: tangkaixuan
	Language: C++
	Result: Accepted
	Time:13 ms
	Memory:2072 kb
****************************************************************/