exec"a,b,c=map(int,raw_input().split(':'));print((':%02d'*3)[1:]%(23-a,59-b+0**c,-c%60));"*input()