a,b,c,d = map(int,input().split()) e = a + b / 60 f = c + d / 60 whole_time = f - e time1 = int(whole_time) time2 =int((whole_time - time1) * 60) print(time1,time2)