def f(S): L = list(map(int, S)) for _ in range(len(L)-1): L2 = [] for i in range(len(L)-1): X = L[i] + L[i+1] if X < 10: L2 += [X] else: X = X//10 + X%10 L2 += [X] L = L2 print(*L) for _ in range(int(input())): f(input())