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