Alice guesses the strings that Bob made for her.

At first, Bob came up with the secret string a consisting of lowercase English letters. The string a has a length of 2 or more characters. Then, from string a he builds a new string b and offers Alice the string b so that she can guess the string a.

Bob builds b from a as follows: he writes all the substrings of length 2 of the string a in the order from left to right, and then joins them in the same order into the string b.

For example, if Bob came up with the string a="abac", then all the substrings of length 2 of the string a are: "ab", "ba", "ac". Therefore, the string b="abbaac".

You are given the string b. Help Alice to guess the string a that Bob came up with. It is guaranteed that b was built according to the algorithm given above. It can be proved that the answer to the problem is unique.

Input

The first line contains a single positive integer t (1 ≤ t ≤ 1000) — the number of test cases in the test. Then t test cases follow.

Each test case consists of one line in which the string b is written, consisting of lowercase English letters (2 ≤ |b| ≤ 100) — the string Bob came up with, where |b| is the length of the string b. It is guaranteed that b was built according to the algorithm given above.

Output

Output t answers to test cases. Each answer is the secret string a, consisting of lowercase English letters, that Bob came up with.

Example

Input


4
abbaac
ac
bccddaaf
zzzzzzzzzz


Output


abac
ac
bcdaf
zzzzzz

Note

The first test case is explained in the statement.

In the second test case, Bob came up with the string a="ac", the string a has a length 2, so the string b is equal to the string a.

In the third test case, Bob came up with the string a="bcdaf", substrings of length 2 of string a are: "bc", "cd", "da", "af", so the string b="bccddaaf".
"""n=int(input())
a=list(map(int,input().split()))
ct=[0]*20
for x in a:
	for sf in range(20):
		ct[sf]+=(x>>sf)&1
ans=[0]*n
for i in range(20):
	for j in range(ct[i]):
		print(ans[j],1<<i,ans[j] | 1<<i)
		ans[j]|=1<<i		
print(sum([x**2 for x in ans]))
"""

"""k=int(input())
s='codeforces'
i,sm=0,1
l=[1]*10
while sm<k:
	
	sm//=l[i]
	print(sm,l[i])
	l[i]+=1
	print(l[i])
	sm*=l[i]
	print(sm)
	i=(i+1)%10
print(l)
ans=[s[i]*l[i] for i in range(10)]
print(''.join(ans))"""
"""
import math
import collections
 
t = int(input())
for _ in range(t):
    n,k = map(int, input().split())
    s = input()
    ctr = collections.Counter(s)
 
    ans = 0
    for i in range(1,n+1):
        g = math.gcd(i, k)
        l = i // g
        print(i,k,g,l)
        cnt = sum([(v//l)*l for v in ctr.values()])
        print(cnt)
        if cnt >= i:
            ans = i
    print(ans)"""

T =int(input())
for _ in range(T):
	a=input()
	if len(a)==2:
		print(a)
	else:
		for i in range(0,len(a),2):
			print(a[i],end="")
		print(a[-1])