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