human
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".
Solve the task in PYTHON3.
 ... Give me a the Python program you requested?
assistant
#Here is the Python program you requested.

#                                               |
#   _` |  __ \    _` |   __|   _ \   __ \    _` |   _` |
#  (   |  |   |  (   |  (     (   |  |   |  (   |  (   |
# \__,_| _|  _| \__,_| \___| \___/  _|  _| \__,_| \__,_|

import sys
import math
import operator as op
from functools import reduce
from bisect import *
from collections import deque

## I/O ##
def read_line():
	return sys.stdin.readline()[:-1]
 
def read_int():
	return int(sys.stdin.readline())
	
def read_int_line():
	return [int(v) for v in sys.stdin.readline().split()]

def read_float_line():
	return [float(v) for v in sys.stdin.readline().split()]
## ##

## ncr ##
def ncr(n, r):
	r = min(r, n-r)
	numer = reduce(op.mul, range(n, n-r, -1), 1)
	denom = reduce(op.mul, range(1, r+1), 1)
	return numer / denom
## ##

## Fenwick Tree ##
# N = int(1e6)+10
# fenwick = [0]*N

# def add(i,x,n):
# 	while i<n:
# 		fenwick[i]+=x
# 		i = i|(i+1)

# def fsum(i,n):
# 	res = 0
# 	while i>=0:
# 		res += fenwick[i]
# 		i = (i&(i+1))-1
# 	return res

# def fsum_range(i,j,n):
# 	return fsum(j,n)-fsum(i-1,n)
## ##	

## binary search ##
def index(a, x):
    'Locate the leftmost value exactly equal to x'
    i = bisect_left(a, x)
    if i != len(a) and a[i] == x:
        return i
    return -1

def find_lt(a, x):
    'Find rightmost value less than x'
    i = bisect_left(a, x)
    if i:
        return i-1
    return -1

def find_le(a, x):
    'Find rightmost value less than or equal to x'
    i = bisect_right(a, x)
    if i:
        return i-1
    return -1

def find_gt(a, x):
    'Find leftmost value greater than x'
    i = bisect_right(a, x)
    if i != len(a):
        return i
    return -1

def find_ge(a, x):
    'Find leftmost item greater than or equal to x'
    i = bisect_left(a, x)
    if i != len(a):
        return i
    return -1

## ##

## Main ##

mod = int(1e9)+7
mod2 = 998244353

t = read_int()
# t = 1
for i in range(t):
	# n = read_int()
	# a = read_int_line()
	b = read_line()
	ans = ""
	for i in range(0,len(b),2):
		ans += b[i]

	ans += b[-1]
	print(ans)