#include <iostream>
using namespace std;
 
int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    int total_minutes = (c * 60 + d) - (a * 60 + b);
    int hours = total_minutes / 60;
    int minutes = total_minutes % 60;
    cout << hours << " " << minutes << endl;
    return 0;
}    
/**************************************************************
	Problem: 1462
	User: baizhoudeyueguang
	Language: C++
	Result: Accepted
	Time:18 ms
	Memory:2072 kb
****************************************************************/