T=int(input()) for i in range(T): hit=input() print(hit[:11]+str(int(hit[11:-5])+1)+hit[-5:])