from math import ceil

x = int(input())

t_1 = 9.00 + 0.75
h_1 = int(t_1)
m_1 = ceil((t_1 - h_1) * 60)

t_2 = t_1 + 0.08 + 0.75
h_2 = int(t_2)
m_2 = ceil((t_2 - h_2) * 60)

t_3 = t_2 + 0.25 + 0.75
h_3 = int(t_3)
m_3 = ceil((t_3 - h_3) * 60)

t_4 = t_3 + 0.08 + 0.75
h_4 = int(t_4)
m_4 = ceil((t_4 - h_4) * 60)

t_5 = t_4 + 0.25 + 0.75
h_5 = int(t_5)
m_5 = ceil((t_5 - h_5) * 60)

t_6 = t_5 + 0.08 + 0.75
h_6 = int(t_6)
m_6 = ceil((t_6 - h_6) * 60)

t_7 = t_6 + 0.25 + 0.75
h_7 = int(t_7)
m_7 = ceil((t_7 - h_7) * 60)

t_8 = t_7 + 0.08 + 0.75
h_8 = int(t_8)
m_8 = ceil((t_8 - h_8) * 60)

t_9 = t_8 + 0.25 + 0.75
h_9 = int(t_9)
m_9 = ceil((t_9 - h_9) * 60)

t_10 = t_9 + 0.08 + 0.75
h_10 = int(t_10)
m_10 = ceil((t_10 - h_10) * 60)
if x == 1:
    print(h_1, m_1)
elif x == 2:
    print(h_2, m_2)
elif x == 3:
    print(h_3, m_3)
elif x == 4:
    print(h_4, m_4)
elif x == 5:
    print(h_5, m_5)
elif x == 6:
    print(h_6, m_6)
elif x == 7:
    print(h_7, m_7)
elif x == 8:
    print(h_8, m_8)
elif x == 9:
    print(h_9, m_9)
elif x == 10:
    print(h_10, m_10)

# Reference solution

x = int(input())
x = x * 45 + (x // 2) * 5 + ((x + 1) // 2 - 1) * 15
print(x // 60 + 9, x % 60)
