N=int(input()) for i in range(N): T=list(input()) i=-1 if T.count("0")==len(T): print(0) else: while True: i+=1 if T[i]!="0": break else: T.pop() print("".join(T))