n = int(input()) for _ in range(n): s = input().strip() stripped = s.lstrip('0') print(stripped if stripped else '0')