#include<iostream> using namespace std; int main() { int a,b,c,d,e,f; cin>>a>>b>>c>>d; if(b>d) { e=c-a-1; f=60-b+d; } else { e=a-c; f=d-b; } cout<<e<<" "<<f<<endl; return 0; }