
# coding: utf-8
# 自分の得意な言語で
# Let's チャレンジ!!
# get data
num = int(input())
for i in range(num):
s = input().rstrip().split(' ')
# print("hello = "+s[0]+" , world = "+s[1])
start_time = s[0]
const_h = int(s[1]) # 工事 時
const_m = int(s[2]) # 工事 分
start_h = int(start_time[:2])
start_m = int(start_time[3:])
# print(start_h, start_m)
#processing
end_h = start_h + const_h
end_m = start_m + const_m
if end_m > 59:
end_h += 1
end_m -= 60
if end_h > 23:
end_h -= 24
# 一桁の場合は0をつける
if len(str(end_h))<2:
end_h = "0"+str(end_h)
if len(str(end_m))<2:
end_m = "0"+str(end_m)
#output answer
print(str(end_h)+":"+str(end_m))
一桁の場合に頭に0を付ける処理をつけ忘れて、また最初8点になってしまいました。
問題はよく読みましょう。
あと、解答例をみたら、もっと楽に3つの変数を配列に入れられるっぽい。
[t, h, m] = input().split()
これで済むらしい。なんて便利な。

https://paiza.jp/works/mondai/c_rank_level_up_problems/c_rank_string_boss
0