n = int(input()) for _ in range(n): s = input() while len(s) > 1: if s[0] == '0': s = s[1:] else: break print(s)