#include<iostream>
#include<cstdio>
using namespace std;
int a,b,c,d,e,f,g;
int main()
{
cin>>a>>b>>c>>d;
e=a*60+b;
f=c*60+d;
g=f-e;
cout<<g/60<<" "<<g%60;
return 0;
}
#include<cstdio>
using namespace std;
int a,b,c,d,e,f,g;
int main()
{
cin>>a>>b>>c>>d;
e=a*60+b;
f=c*60+d;
g=f-e;
cout<<g/60<<" "<<g%60;
return 0;
}