N = int(input()) for i in range(N): tmp = input() tmp = list(tmp) tmp.reverse() flag = True while flag: if len(tmp) == 1: flag = False break elif tmp[-1] == "0": tmp.pop() else: flag = False break tmp.reverse() print("".join(tmp))