문제 2884
h,m = map(int,input().split()) if m - 45 < 0: if h - 1 < 0: h = 23 m = m + 60 - 45 else: h -= 1 m = m + 60 -45 else: m -= 45 print(f'{h} {m}')