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