import sys import pypyjit import itertools import heapq import math from collections import deque, defaultdict, Counter import string import random input = sys.stdin.readline sys.setrecursionlimit(10 ** 6) pypyjit.set_param('max_unroll_recursion=-1') N = int(input()) for _ in range(N): A = list(input()[:-1]) dq = deque(A) while True: if not dq[0] == '0': break dq.popleft() print(''.join(dq))