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