a, b = map(int, input().split())
if b < 45:
    a -= 1
    b += 15
else:
    b -= 45
if a < 0:
    a = 24 + a
print(a, b)

889247fed6273509dab7c4f211b975a38d521737
<mask token>

<mask token>
if b < 45:
    a -= 1
    b += 15
else:
    b -= 45
if a < 0:
    a = 24 + a
print(a, b)

a, b = map(int, input().split())
if b < 45:
    a -= 1
    b += 15
else:
    b -= 45
if a < 0:
    a = 24 + a
print(a, b)
