a = int(input())
hours = a // 60
minutes = a % 60
if (minutes == 0) :
print (hours, ":0", minutes)
else :
print (hours, ":", minutes)
a = int(input())
hours = a // 60
minutes = a % 60
if (minutes == 0) :
print (hours, ":0", minutes)
else :
print (hours, ":", minutes)