s = int(input().split) if s[3]-s[1]<0: print(s[2]-s[0]-1,s[3]-s[1]+60) else: print(s[2]-s[0],s[3]-s[1])