import java.util.Scanner;
/**
* @author dekuofa <br>
* @date 2019-07-30 <br>
*/
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt(),
b = sc.nextInt(),
c = sc.nextInt(),
d = sc.nextInt();
int m = d - b;
int h = c - a;
if (m < 0) {
h --;
m += 60;
}
System.out.printf("%d %d\n", h, m);
}
}