#include<bits/stdc++.h>
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: wengsihan
	Language: C++
	Result: Accepted
	Time:18 ms
	Memory:2072 kb
****************************************************************/