n = int(input()) for i in range(n): s = input() for i in range(5): if s[i] != "0": break print(s[i:])