#include <iostream>
using namespace std;
int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    
    int minutes = d - b;
    int hours = c - a;
    
    if (minutes < 0) {
        minutes += 60;
        hours--;
    }
    
    if (hours < 0) {
        hours += 24;
    }
    
    cout << hours << " " << minutes;
    
    return 0;
} 

/**************************************************************
	Problem: 1462
	User: linzihang
	Language: C++
	Result: Accepted
	Time:17 ms
	Memory:2072 kb
****************************************************************/