H, M=map(int,input().split())
if 45<=M:
print(H,M-45)
elif H!=0 and M<=45:
print(H-1,60-(45-M))
elif M<=45:
print(H+23,60-(45-M))
H, M=map(int,input().split())
if 45<=M:
print(H,M-45)
elif H!=0 and M<=45:
print(H-1,60-(45-M))
elif M<=45:
print(H+23,60-(45-M))
댓글