a,b,c,d=map(int,input().split()) if b > d: e = c - 1 - a f = d + 60 - b print(e, '\t', f) else: e = c - a f = d - b print(e, '\t', f)