t = [int(x) for x in input().split()]
x = (t[0]*3600+t[1]*60+t[2])%86400
H = x//3600
M = (x-H*3600)//60
S = (x-H*3600-M*60)
print({}H,M,S,sep=":")
t = [int(x) for x in input().split()]
x = (t[0]*3600+t[1]*60+t[2])%86400
H = x//3600
M = (x-H*3600)//60
S = (x-H*3600-M*60)
print({}H,M,S,sep=":")
修正版:前一版忘記補零了
t = [int(x) for x in input().split()]
x = (t[0] * 3600 + t[1] * 60 + t[2]) % 86400
H = x // 3600
M = (x - H * 3600) // 60
S = x - H * 3600 - M * 60
print(f"{H:3d}:{M:3d}:{S:3d}")