#include <iostream>
using namespace std;

int main(){
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	int t1 = a * 60 + b;
	int t2 = c * 60 + d;
	
	int t = t2 - t1;
	cout<<t / 60<<" "<<t % 60<<endl;
}
/**************************************************************
	Problem: 1462
	User: admin
	Language: C++
	Result: Accepted
	Time:19 ms
	Memory:2072 kb
****************************************************************/