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