map(int, a)
a = '1 2'
a = list(map(int, a.split()) #[1, 2] int형
cf. map 함수를 이용한 문제
https://velog.io/@letsbebrave/%EB%B0%B1%EC%A4%80-1330%EB%B2%88-%EB%8B%A8%EC%96%B4-%EA%B3%B5%EB%B6%80
# time = [None] * 2
# time[0], time[1] = input().split()
# H = int(time[0])
# M = int(time[1])
H, M = map(int,input().split()) #위의 긴 코드를 이렇게 한 줄로 바꿀 수 있다!
M = H*60 + M - 45
H = M // 60
if H == -1 :
H = 23
M = M % 60
print(f'{H} {M}')