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())
x=n-1
s=n*2*x+2
j=0
for i in range(2*n+1):
   if(i%x!=0):
       print("*  "*j+" "*s+"  *"*j)
       
       
       
   else:
       print("*  "*j+"*"*s+"  *"*j)
       j=j+1
       s=abs(s-2*x)
'''
'''
def fib(n):
   a=0
   b=1
   c=0
   for x in range(n-1):
      c=a+b
      a=b
      b=c
   print(c)

fib(71)   #only valid upto 71st fiboncci
n=71
a=((((1+5**0.5)/2)**n)-(((1-5**0.5)/2)**n))/(5**0.5)            
print(int(a))   
'''
'''
t=int(input())
for _ in range(t):
   n=int(input())
   li=list(map(int, input().split()))
   li.sort
   if(1 in li):
      

   else:
      print((2**n)%998,244,353)
   
'''
'''
t=int(input())
for _ in range(t):
    n,s=map(int,input().split())
    li=list(map(int,input().split()))
    i=0
    li1=[]
    for x in range(n):
        li1.append(li[x])
    li1.sort(reverse=True)


    while(s>0 and li1!=li):
        if(li[i]<li[i+1]):
            li[i],li[i+1]=li[i+1],li[i]
            s=s-1
        if(i+1==n-1):
            i=0
        i=i+1
    st=''
    for j in li:
        st=st+str(j)
    print(st)
'''
'''
t=int(input())
for _ in range(t):
    n=int(input())
    li=list(map(int, input().split()))
    p=max(li)
    li1=[0 for i in range(p+1)]
    take=1
    last=-1
    for x in li:
        if(last==x):
            take=not take
        else:
            take=1
        if(take):
            li1[x]+=1
            last=x
    print(li1)
    print(li1.index(max(li1)))
        
   '''         
'''
t=int(input())
for _ in range(t):
    n,k=map(int,input().split())
    if(n==0):
        print((k*(k+1))%1000000007)
    elif(k%2==0):
        k=k/2
        k=k-1
        q=n+k
        a=q*(q+1)
        a=a+n
    else:
        k=k//2
        q=n+k
        a=q*(q+1)
        a=a-n
    a=int(a)
    print(a%1000000007)
'''
'''
t=int(input())
for _ in range(t):
    n1=int(input())
    l1=list(map(int,input().split()))
    n2=int(input())
    l2=list(map(int,input().split()))
    c=0
    a=[]
    b=[]
    for x in range(n1):
        if(l1[x] in l2):
            a.append(l1[x])
            l2[l2.index(l1[x])]=0
        else:
            if(len(a)!=0):
                b.append(a)
                a=[]
    print(len(b))
'''
'''
t=int(input())
while(t>0):
    li=[]
    n=int(input())
    i=0
    while(i<n):
        a=[]
        a=list(map(int,input().split()))
        li.append(a)
        i+=1
    f=0
    x=0
    y=0
    while(x<n):
        while(y<n):
            if(li[x][y]==1):
                if(x==0):
                    if(li[x+1][y]==1 or li[x+1][y]==1 ):
                    f=1
                    x=101
                    y=101
            y+=1
        x+=1
    if(f==0):
        print("SAFE")
    t-=1
    '''
'''
n=int(input())
li=list(map(int,input().split()))
a=[]
for x in range(n):
    if(li[x] in a):
        continue
    print(li.count(li[x])+li[x],end=' ')
    a.append(li[x])
'''
'''
def tree(n,ind,h,tr):
    if(h==0):
        return
    b=n-1
    a=n-2**h
    tr[2*ind]=a
    tr[2*ind+1]=b
    tree(a,2*ind,h-1,tr)
    tree(b,2*ind+1,h-1,tr)
    
def solution(h,q):
    tr=[0 for i in range(2**h)]
    tr[1]=2**h-1
    tree(2**h-1,1,h-1,tr)
    p=[]
    for x in q:
        c=tr.index(x)//2
        if(c==0):
            p.append(-1)
        else:
            p.append(tr[c])
    return p
print(solution(5, [19, 14, 28]))

def n2b(n, b):        
    if n == 0:
        return 0
    st=''
    while n:
        st=st+str(n%b)
        n //= b
    return st
'''
'''
def printMin(num,b): 
    count = [0 for x in range(b)] 
    string = str(num) 
    for i in range(len(string)): 
        count[int(string[i])] = count[int(string[i])] +  1
        
    result =''
  
    for i in range(b): 
        while count[i] > 0: 
            result = result + str(i)
            count[i] = count[i] - 1
  
    return result 


def sub(x,y,b):
    st=''
    l=len(y)
    a=b-1
    a=str(a)
    n=int(a*l)
    x=int(x)
    y=int(y)
    y=n-y
    c=1
    ans=0
    while(x and y):
       p=x%10
       q=y%10
       r=p+q+c
       st=st+str(r%b)
       c=r//b
       x//=10
       y//=10
    return st[::-1]

    
def solution(n, b):
    p=[]
    while(int(n)):
        l=len(n)
        x=str(printMin(n,b))
        y=x[::-1]
        n=sub(y,x,b)
        if(l!=len(n)):
            n='0'*(l-len(n))+n
        if(n in p):
            q=p.index(n)
            return len(p)-q
        p.append(n)
    return 1


def issorted(li,n):
    for x in range(n):
        if(x+1==li[x]):
            continue
        else:
            return False
    return True
'''
'''

for _ in range(int(input())):
    n,k=map(int,input().split())
    li=list(map(int,input().split()))
    a=[]
    ind=[]
    for x in range(n):
        if(li[x]!=x+1):
            a.append(li[x])
            ind.append(x)
    f=0
    ans=[]
    while(k):
        ti=[]
        i=[]
        for x in range(len(a)):
            if(a[x]!=ind[x]+1):
                ti.append(ind[x])
                i.append(x)
                if(len(i)==3):
                    ans.append(ti)
                    break
        if(len(i)< 3 and len(i) >0):
            print(-1)
            break
        if(len(i)==0):
            f=1
            break
        a[i[0]],a[i[1]],a[i[2]]=a[i[2]],a[i[0]],a[i[1]]
        k-=1
        print(ti)
    if(f==1):
        print(len(ans))
        for x in range(len(ans)):
            print(ans[x][0]+1,ans[x][1]+1,ans[x][2]+1)
    else:
        print(-1)
        
'''
'''
for _ in range(int(input())):
    x,y,l,r=map(int,input().split())
    if(x==0 or y==0):
        print(l)
    else:
        if(l==r):
            print(r)
        else:
            a=x|y
            a_bin=bin(a)
            r_bin=bin(r)
            a_bin=a_bin[2:]
            r_bin=r_bin[2:]
            ans=a_bin
            while(int(ans)>int(r_bin)):
                ans=ans[1:]
            print(int(ans,2))
       '''
'''

def is_safe(m,i,j,a,v):
    if(v[i][j]==False ):
        if(m[i][j]==0):
            return True
        
        elif(m[i][j]==1 and a[0]==0):
            a[0]+=1
            return True
        elif(m[i][j]==1 and a[0]==1):
            a[0]+=1
            return False
        else:
            return False
    else:
        return False
    
    
def solution(m):
    h=len(m)
    w=len(m[0])
    v=[]
    for x in range(h):
        a=[]
        for y in range(w):
            a.append(False)
        v.append(a)
    li=[]
    c=0
    p=1
    i=0
    j=0
    path_finder(m,i,j,h,w,li,p,c,v)
    return li[0]

def path_finder(m,i,j,h,w,li,p,c,v):
    if(len(li)==1 and p>=li[0]):
        return
    if(c==2):
       return
    if(i==h-1 and j==w-1):
        li.append(p)
        return
    a1=[c]
    a2=[c]
    a3=[c]
    a4=[c]
    
    v[i][j]=True
    if(i+1<h and is_safe(m,i+1,j,a1,v)):
        path_finder(m,i+1,j,h,w,li,p+1,a1[0],v)
        
    if(i-1>=0 and is_safe(m,i-1,j,a2,v)):
        path_finder(m,i-1,j,h,w,li,p+1,a2[0],v)

    if(j+1<w and is_safe(m,i,j+1,a3,v)):
        path_finder(m,i,j+1,h,w,li,p+1,a3[0],v)

    if(j-1>=0 and is_safe(m,i,j-1,a4,v)):
        path_finder(m,i,j-1,h,w,li,p+1,a4[0],v)
        
    v[i][j]=False

print(solution([[0, 1, 0, 1, 0, 0, 0], [0, 0, 0, 1, 0, 1, 0]]))




print(solution([[0,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0],
                [0,0,0,1,0,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0],
                [1,1,1,1,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0],
                [1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,0,0,0,0],
                [1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,0,0,0,0],
                [1,1,1,1,1,1,1,0,1,0,1,0,1,0,1,0,0,0,0,0],
                [0,0,0,1,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0],
                [1,0,0,0,0,1,0,1,1,0,1,1,1,1,1,1,0,0,0,0],
                [0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0],
                [1,0,0,0,0,0,1,1,1,0,1,0,1,0,1,1,0,0,0,0],
                [1,1,1,1,1,0,1,0,1,0,0,0,1,0,1,1,0,0,0,0],
                [1,1,1,1,1,0,1,1,1,0,0,0,1,0,1,0,0,0,0,0],
                [1,1,0,1,0,0,1,1,1,1,1,0,1,0,1,0,0,0,0,0],
                [0,1,0,1,1,1,0,0,0,0,1,0,0,1,1,1,0,0,0,0],
                [0,1,0,0,0,1,0,0,0,0,1,1,0,1,1,1,0,0,0,0],
                [1,1,1,1,0,1,1,1,1,1,1,0,0,1,1,1,0,0,0,0],
                [1,1,1,1,0,1,0,1,0,1,0,0,1,1,1,1,0,0,0,0],
                [0,0,0,1,0,1,0,1,0,1,1,0,0,1,1,1,0,0,0,0],
                [1,1,1,1,0,1,0,1,0,0,0,0,0,1,1,1,0,0,0,0],
                [1,1,1,1,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0]]))


print(solution([[0,1,1,1,0],
                [0,0,0,0,1],
                [1,1,1,0,0],
                [1,1,0,0,1],
                [1,1,0,1,1],
                [1,1,1,0,0],
                [1,1,1,0,0],
                [1,1,1,0,0]]))  
    
       '''
'''

def is_safe(i,j,h,w,m):
    if(i>=h or i<0 or j<0 or j>=w or m[i][j]):
        return False
    return True

def solution(m):
    h,w=len(m),len(m[0])
    q=[]
    q[0]=(0,0)
    val=[0]
    bfs=[]
    while(q):
        a=q.pop(0)
        bfs.append(a)
        i=a[0]
        j=a[1]
        if(is_safe(i+1,j,h,w,m)):
            if((i+1,j) not in q and (i+1,j) not in bfs):
                q[(i+1,j)]=q[(i,j)]+1

        if(is_safe(i-1,j,h,w,m)):
            if((i-1,j) not in q):
                q[(i-1,j)]=q[(i,j)]+1

        if(is_safe(i,j+1,h,w,m)):
            if((i,j+1) not in q):
                q[(i,j+1)]=q[(i,j)]+1

        if(is_safe(i,j-1,h,w,m)):
            if((i,j-1) not in q):
                q[(i,j-1)]=q[(i,j)]+1

    return q[(h-1,w-1)]

print(solution([[0,1,1,1,0],
                [0,0,0,0,1],
                [1,1,1,0,0],
                [1,1,0,0,1],
                [1,1,0,0,1],
                [1,1,1,0,0],
                [1,1,1,0,0],
                [1,1,1,0,0]])) 

'''
'''
def sht_pth(sx, sy, maze):
    w = len(maze[0])
    h = len(maze)
    board = [[None for i in range(w)] for i in range(h)]
    board[sx][sy] = 1

    arr = [(sx, sy)]
    while arr:
        x, y = arr.pop(0)
        for i in [[1,0],[-1,0],[0,-1],[0,1]]:
          nx, ny = x + i[0], y + i[1]
          if 0 <= nx < h and 0 <= ny < w:
            if board[nx][ny] is None:
                board[nx][ny] = board[x][y] + 1
                if maze[nx][ny] == 1 :
                  continue
                arr.append((nx, ny)) 
                  
    return board

def solution(m):
  w = len(m[0])
  h = len(m)
  tb = sht_pth(0, 0, m)
  bt = sht_pth(h-1, w-1, m)
  board = []

  ans = 2 ** 32-1
  for i in range(h):
      for j in range(w):
          if tb[i][j] and bt[i][j]:
              ans = min(tb[i][j] + bt[i][j] - 1, ans)
  return ans





print(solution([[0,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0],
                [0,0,0,1,0,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0],
                [1,1,1,1,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0],
                [1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,0,0,0,0],
                [1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,0,0,0,0],
                [1,1,1,1,1,1,1,0,1,0,1,0,1,0,1,0,0,0,0,0],
                [0,0,0,1,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0],
                [1,0,0,0,0,1,0,1,1,0,1,1,1,1,1,1,0,0,0,0],
                [0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0],
                [1,0,0,0,0,0,1,1,1,0,1,0,1,0,1,1,0,0,0,0],
                [1,1,1,1,1,0,1,0,1,0,0,0,1,0,1,1,0,0,0,0],
                [1,1,1,1,1,0,1,1,1,0,0,0,1,0,1,0,0,0,0,0],
                [1,1,0,1,0,0,1,1,1,1,1,0,1,0,1,0,0,0,0,0],
                [0,1,0,1,1,1,0,0,0,0,1,0,0,1,1,1,0,0,0,0],
                [0,1,0,0,0,1,0,0,0,0,1,1,0,1,1,1,0,0,0,0],
                [1,1,1,1,0,1,1,1,1,1,1,0,0,1,1,1,0,0,0,0],
                [1,1,1,1,0,1,0,1,0,1,0,0,1,1,1,1,0,0,0,0],
                [0,0,0,1,0,1,0,1,0,1,1,0,0,1,1,1,0,0,0,0],
                [1,1,1,1,0,1,0,1,0,0,0,0,0,1,1,1,0,0,0,0],
                [1,1,1,1,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0]]))



for _ in range(int(input())):
    n=int(input())
    li=list(map(int,input().split()))
    c=0
    for x in range(n):
        s=0
        for y in range(x,n):
            s=s+li[y]
            sq=s**.5
            if(sq==int(sq)):
                c+=1
    
    print("Case #"+str(_+1)+":",c)            
            
    
'''
'''
def find_max(li):
    m=-1
    ind=-1
    for x in range(len(li)):
        if(li[x]>m):
            m=li[x]
            ind=x
    return m,ind
        
def solve(arr):
    m,ind=find_max(arr)
    a=sorted(arr[:ind])
    b=sorted(arr[ind+1:])
    
    

arr=[2,3,1,7,5,4,5]
solve(arr)


'''
'''

for _ in range(int(input())):
    n=int(input())
    li=list(map(int, input().split()))
    li.sort()
    f=0
    o=0
    e=0
    for x in range(n):
        if(li[x]%2==0):
            e+=1
        else:
            o+=1
    if(e%2==0 and o%2==0):
        f=1
        print("YES")
    else:
        for x in range(n-1):
            if(li[x+1]-li[x]==1):
                f=1
                print("YES")
    if(f==0):
        print("NO")



'''
'''

for _ in range(int(input())):
    n=int(input())
    li=list(map(int,input().split()))
    v=0
    l=[0,0,0]
    f=0
    for x in range(n):
        if(li[x]==5):
            l[0]+=1
        elif(li[x]==10):
            l[1]+=1
            if(l[0]==0):
                f=1
                print("NO")
                break
            else:
                l[0]-=1
        elif(li[x]==15):
            if(l[1]==0):
                if(l[0]<2):
                    f=1
                    print("NO")
                    break
                else:
                    l[0]-=2
            else:
                l[1]-=1
        
    if(f==0):
        print("YES")

for _ in range(int(input())):
    ts=int(input())
    n=ts
    d=2
    while(ts%2==0):
        d*=2
        ts=ts//2
    print(n//d)

        

for _ in range(int(input())):
    ts=int(input())
    if(ts%2!=0):
        print(ts//2)

    else:
        d=1
        n=ts
        while(n%2==0):
            d+=1
            n=n/2
        ts_bin=bin(ts)
        ts_bin=ts_bin[2:len(ts_bin)-d]
        if(len(ts_bin)==0):
            print(0)
        else:
            print(int(ts_bin,2))
       
'''
'''
for _ in range(int(input())):
    n=int(input())
    i=1
    pos=0
    while(i<n):
        pos=i
        i*=2
    print(pos)
    pos=pos%60
    if(pos==0):
        print(0)
    elif(pos==1):
        print(1)
    else:
        a=0
        b=1
        c=a+b
        for x in range(2,pos-1):
            a=b
            b=c
            c=(a+b)%10
        print(c)

for _ in range(int(input())):
    n,m=map(int,input().split())
    li=[]
    c=0
    for i in range(n):
        a=[]
        a=list(map(int,input().split()))
        li.append(a)
        
    for i in range(n):
        for l in range(m):
            f=0
            for j in range(m):
                if(li[i][j]==1):
                    f=1
            for k in range(n):
                if(li[k][l]==1):
                    f=1
            if(f==0):
                li[i][l]=1
                c+=1

            
    if(c%2==0):                       
        print('Vivek')
    else:
        print("Ashish")
        

class m:
    li=[]
    def add(self,val):
        self.li.append(val)
    def show(self):
        for x in self.li:
            print(x)
        
a=m()
a.add(1)
a.show()
    
'''
'''

x=120
r=[1,0]
r[1]=int(input())
while(x):
    print(r[1])
    ans=input()
    if(ans=="G"):
        print((r[0]+r[1])//2)
        ans1=input()
        if(ans1=='G'):
            r[0]=(r[0]+r[1])//2
        elif(ans1=='L'):
            r[1]=(r[0]+r[1])//2
        else:
            break
    elif(ans=='L'):
        print((r[0]+r[1])//2)
        ans1=input()
        print((r[0]+r[1])//2)
        ans2=input()
        if(ans1==ans2):
            if(ans1=='G'):
                r[0]=(r[0]+r[1])//2
            else:
                r[1]=(r[0]+r[1])//2
        if(ans1!=ans2):
            print(r[1])
            ans3=input()
            if(ans3=='L'):
                continue             #check
            elif(ans3=='G'):
                if(ans2=='L'):
                    r[1]=(r[0]+r[1])//2
                else:
                    r[0]=(r[0]+r[1])//2  
    else:
        break
    x=x-1

'''
for _ in range(int(input())):
    b=input()
    ans=b[0]
    for x in range(1,len(b)-1):
        if(x&1):
            ans=ans+b[x]
    ans=ans+b[len(b)-1]
    print(ans)
        


            
            
            
    



        
        
