#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);
}
/**************************************************************
Problem: 1462
User: tonghuatao
Language: C++
Result: Accepted
Time:14 ms
Memory:2072 kb
****************************************************************/