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".
"""
ind=0
bal=True
a=0
top=''
S=str(input())
stack=[]
while(ind<len(S)):
    if(len(stack)==0):
        a=ind

    if(S[ind]=='[' or S[ind]=='{' or S[ind]=='('):
            stack.append(S[ind])
    else:
            if((S[ind]==']' or S[ind]=='}' or S[ind]==')')):
                if(len(stack)==0):
                    bal=False
                    break
                else:
                    top=stack[(len(stack)-1)]
                    stack.pop()
                    if((top=='[' and S[ind]!=']') or (top=='{' and S[ind]!='}') or (top=='(' and S[ind]!=')')):
                        bal=False
                        break
    ind=ind+1

if(bal and len(stack)==0):
    print("Success")
else:
    if(ind>=len(S) and len(stack)!=0):
        print(a+1)
    else:
        print(ind+1)"""

"""def binsrch(l,h,arr,x):
    mid=l+(h-l)//2
    if(h<l):
        return -1
    if(x==arr[mid]):
        return mid
    if(x>arr[mid]):
        return binsrch(mid+1,h,arr,x)
    else:
        return binsrch(l,mid-1,arr,x)




l=list(map(int,input().split()))
n=l[0]
a=l[1:n+1]


b=list(map(int,input().split()))



for i in range(1,len(b)):
    print(binsrch(0,n-1,a,b[i]),end=' ')
    r = 0
    le = n - 1
    ch=0
    while(r<=le):

        mid = r + (le - r) // 2;


        if a[mid] == b[i]:
            print(mid,end=' ')
            ch=1
            break


        elif a[mid] < b[i]:
            r = mid + 1


        else:
            le = mid - 1


    if(ch==0):
        print(-1, end=' ')
"""
"""def sftdn(i,arr):
    while(i<n):
        if (l[(2 * i) + 1] < l[(2 * i) + 2] and l[(2 * i) + 1] < l[i]):

            print(i, (2 * i) + 1)
            swap(l, i, (2 * i) + 1)

        elif (l[(2 * i) + 2] < l[(2 * i) + 1] and l[(2 * i) + 2] < l[i]):
            print(i, (2 * i) + 2)
            swap(l, i, (2 * i) + 2)
        elif (l[(2 * i) + 2] == l[(2 * i) + 1] and l[(2 * i) + 2] < l[i]):
            print(i, (2 * i) + 2)
            swap(l, i, (2 * i) + 2)
"""
"""ans=[]
def sftdn(i):

    minind=i
    li=(2*i)+1
    if(li<=n-1 and l[li]<l[minind]):
        minind=li
    ri=(2*i)+2
    if(ri<=n-1 and l[ri]<l[minind]):
        minind=ri
    if(i!=minind):
        swap(l,i,minind)
        ans.append(i)
        ans.append(minind)
        sftdn(minind)


def swap(arr,n1,n2):
    t=arr[n1]
    arr[n1]=arr[n2]
    arr[n2]=t



n=int(input())
ans=[]
l=list(map(int,input().split()))
for i in range (((n-1)//2),-1,-1):

    sftdn(i)"""






"""print(len(ans)//2)

for i in range(0,len(ans)-1,2):
    print(ans[i],ans[i+1])"""



"""m=1000
ht=[[] for _ in range(m)]
def hf(x,p,m):
    return ((x)%p)%m
def add(num,name,n):
    cf = 0
    hv = hf(num, p, m)
    for i in range(0, len(ht[hv]), 2):
        if (ht[hv][i] == num):
            ht[hv][i + 1] = name
            cf = 1
            n = n - 1
            return m,ht



    if(cf==0):
         ht[hf(num,p,m)].extend([num,name])
         return m,ht
def find(x):
    hv=hf(x,p,m)
    f=0
    for i in range(0,len(ht[hv]),2):
        if((ht[hv][i])==x):
            print(ht[hv][i+1])
            return
    print('not found')



p=10000019
n=0



for _ in range(int(input())):
    qr=list(map(str,input().split()))

    if(qr[0]=='add'):
        n=n+1
        m,ht= add(int(qr[1]),qr[2],n)


    elif(qr[0]=='find'):
        find(int(qr[1]))


    elif(qr[0]=='del'):
        hv1=hf(int(qr[1]),p,m)
        for i in range(0,len(ht[hv1]),2):
            if(ht[hv1][i]==int(qr[1])):
                ht[hv1].pop(i)
                ht[hv1].pop(i)
                break

    qr.clear()"""


t=int(input())
for _ in range(t):
    s=str(input())
    l=list(s)
    nl=[]

    if(len(l)>=3):
     for i in range(2,len(l)-1,2):
         l[i]='-'
     for i in l:
         if(i!='-'):
             nl.append(i)
     s=''.join(nl)
     print(s)
    else:
        print(s)








