A palindrome is a string that reads the same backward as forward. For example, the strings ${z}$, ${aaa}$, ${aba}$, and ${abccba}$ are palindromes, but ${codeforces}$ and ${ab}$ are not.

The double of a string $s$ is obtained by writing each character twice. For example, the double of ${seeing}$ is ${sseeeeiinngg}$.

Given a string $s$, rearrange its double to form a palindrome. Output the rearranged string. It can be proven that such a rearrangement always exists.


-----Input-----

The first line of input contains $t$ ($1 \leq t \leq 1000$) — the number of test cases.

The only line of each test case contains a single string $s$ ($1 \leq |s| \leq 100$) consisting only of lowercase English letters.

Note that the sum of $|s|$ over all test cases is not bounded.


-----Output-----

For each test case, output a palindromic string of length $2 \cdot |s|$ that is a rearrangement of the double of $s$.


-----Examples-----

Input
4
a
sururu
errorgorn
anutforajaroftuna
Output
aa
suurruurruus
rgnororerrerorongr
aannuuttffoorraajjaarrooffttuunnaa


-----Note-----

In the first test case, the double of ${a}$ is ${aa}$, which is already a palindrome.

In the second test case, the double of ${sururu}$ is ${ssuurruurruu}$. If we move the first ${s}$ to the end, we get ${suurruurruus}$, which is a palindrome.

In the third test case, the double of ${errorgorn}$ is ${eerrrroorrggoorrnn}$. We can rearrange the characters to form ${rgnororerrerorongr}$, which is a palindrome.

Difficulty: EASY
Tags: String algorithms

Constructive algorithms

Starter code:

Solutions:
print('\n'.join([i[:-1] + i[-2::-1] for i in [*open(0)][1:]]))


for _ in range(int(input())):
	s = input()
	print(s + s[::-1])


t = int(input())
for i in range(t):
	a = input()
	b = a[::-1]
	print(a + b)


import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def solve(a, p, g, b, c):
	if not a:
		return c
	s1 = c
	s2 = c
	s3 = c
	if p > a[0]:
		s1 = solve(a[1:], p + a[0] // 2, g, b, c + 1)
	if g > 0:
		s2 = solve(a, p * 2, g - 1, b, c)
	if b > 0:
		s3 = solve(a, p * 3, g, b - 1, c)
	return max(s1, s2, s3)

def ci(ar):
	i = len(ar) - 1
	zc = 0
	zeroA = [0] * len(ar)
	ic = [0] * len(ar)
	while i >= 0:
		zeroA[i] = zc
		if ar[i] == 1:
			ic[i] = zc
		else:
			zc += 1
		i -= 1
	i = 0
	oc = 0
	oneC = [0] * len(ar)
	while i < len(ar):
		oneC[i] = oc
		if ar[i] == 1:
			oc += 1
		i += 1
	return [ic, zeroA, oneC]
t = inp()
for _ in range(t):
	n = input().strip()
	print(n + n[::-1])


t = int(input())
ans = []
for i in range(t):
	s = input()
	ans.append(s + s[::-1])
print(*ans, sep='\n')


import sys
inputs = ''.join(sys.stdin.readlines()).strip().split('\n')[1:]
for i in inputs:
	print(i + i[::-1])


for _ in range(int(input())):
	a = input()
	b = a[::-1]
	c = a + b
	print(c)


t = int(input())
for _ in range(t):
	s = input()
	print(s, end='')
	print(s[::-1])


t = int(input())
for i in range(t):
	s = input()
	s1 = s[::-1]
	print(s + s1)


import sys
t = int(sys.stdin.readline())
for _ in range(t):
	a = sys.stdin.readline().strip()
	print(a + a[::-1])


for _ in range(int(input())):
	a = input()
	print(a + a[::-1])


for _ in range(int(input())):
	s = input()
	a = s[::-1]
	b = s + a
	print(b)


n = int(input())
for i in range(n):
	s = input()
	print(s + s[::-1])


n = int(input())
for i in range(n):
	word = input()
	new_word = word + word[-1:-len(word) - 1:-1]
	print(new_word)


t = int(input())
for _ in range(t):
	input_str = input()
	print(input_str + input_str[::-1])


def rearrangement(s):
	return s + s[::-1]
t = input('')
strings = []
for _ in range(int(t)):
	strings.append(input(''))
for s in strings:
	print(rearrangement(s))


tst = int(input())
arr = []
for i in range(0, tst):
	s = input()
	arr.append(s)
for s in arr:
	print(s + s[::-1])


def N():
	return int(input())

def A():
	return [int(x) for x in input().split()]

def S():
	return input()
for _ in range(N()):
	if 'codeforces' == 28226329:
		print('Tanmay')
	s = S()
	ss = s[::-1]
	print(s + ss)


import sys
input = lambda : sys.stdin.readline()[:-1]
ni = lambda : int(input())
na = lambda : list(map(int, input().split()))
yes = lambda : print('yes')
Yes = lambda : print('Yes')
YES = lambda : print('YES')
no = lambda : print('no')
No = lambda : print('No')
NO = lambda : print('NO')
for _ in range(ni()):
	s = input()
	print(s + s[::-1])


def solve():
	s = input().strip()
	return s + s[::-1]
for _ in range(int(input())):
	ans = solve()
	print(ans)


def sol():
	n = int(input())
	for i in range(n):
		s = input()
		s1 = s[::-1]
		s = s + s1
		print(s)
sol()


k = int(input())
for q in range(k):
	n = input()
	print(n + n[::-1])


t = int(input())
while t:
	t -= 1
	s = input()
	print(s + s[::-1])


def solution():
	s = input()
	print(s + s[::-1])
t = int(input())
while t:
	solution()
	t -= 1


ans = []
for _ in range(int(input())):
	s = input()
	ans.append(s + s[::-1])
print(*ans, sep='\n')


t = int(input())
for x in range(t):
	s = input()
	print(s + s[::-1])


n = int(input())
while n > 0:
	s = input()
	print(s + s[::-1])
	n -= 1


t = int(input())
for _ in range(t):
	s = str(input())
	a = s[::-1]
	print(s + a)


for t in range(0, int(input())):
	s = input()
	ss = s[::-1]
	print(s + ss)


import sys
t = int(sys.stdin.readline())
for line in sys.stdin:
	s = line[:-1]
	s += s[::-1]
	print(s)


def solution():
	s = input()
	return s + s[::-1]
for t in range(int(input())):
	print(solution())


t = int(input())
for i in range(t):
	val = input()
	val += val[::-1]
	print(val)


n = int(input())
for k in range(n):
	s = str(input())
	print(s + s[::-1])


t = int(input())
for i in range(t):
	s = input()
	st = s + s[::-1]
	print(st)


def check_palindrome(s1: str) -> str:
	s2 = s1[::-1]
	s1 = s1 + s2
	return s1

def main():
	t = int(input())
	while t:
		s1 = input()
		s2 = check_palindrome(s1)
		print(s2)
		t = t - 1
main()


def reverse(string):
	string = ''.join(reversed(string))
	return string
t = int(input())
for test in range(t):
	S = input().strip()
	newS = reverse(S)
	finalstring = ''.join([S, newS])
	print(finalstring)


import sys

def solve():
	input = sys.stdin.readline
	s = input().strip()
	ans = s
	for c in s[::-1]:
		ans += c
	print(ans)

def main():
	t = int(input())
	for _ in range(t):
		solve()
main()


n = int(input())
lis = []
for i in range(n):
	lis.append(input())
lis2 = []
for i in range(n):
	lis[i] = lis[i] + lis[i][::-1]
for i in range(n):
	print(lis[i])


for i in range(int(input())):
	s = input()
	x = s + s[::-1]
	print(x)


def get_string():
	string = input()
	print(string + string[::-1])

def main():
	x = int(input())
	for i in range(x):
		get_string()
main()


t = int(input())
for i in range(0, t):
	s = input()
	print(s + s[::-1])


iter = int(input())
for i in range(iter):
	s = input()
	s = s + s[::-1]
	print(s)


t = int(input())
for _ in range(t):
	s = input()
	res = s + s[::-1]
	print(res)


tc = input()
for i in range(int(tc)):
	s = input()
	s1 = s[::-1]
	ans = s + s1
	print(ans)


t = int(input())
d = []
while t > 0:
	Ex = input()
	d.append(Ex)
	t -= 1
for i in d:
	a = i
	A = i
	c = A[::-1]
	print(a + c)


a = int(input())
for i in range(a):
	l = input()
	s = l[::-1]
	s = l + s
	print(s)


a = int(input())
for x in range(a):
	k = input()
	m = k[::-1]
	m = k + m
	print(m)


t = int(input())
while t > 0:
	t -= 1
	s = input()
	ans = s + s[::-1]
	print(ans)


def solve():
	s = str(input())
	ans = s + s[::-1]
	print(ans)
for i in range(int(input())):
	solve()


for t in range(int(input())):
	a = input()
	print(a + a[::-1])


T = int(input())
for _ in range(T):
	s = input()
	print(s, s[::-1], sep='')


n = int(input())
for _ in range(n):
	s = input().strip()
	print(s + s[::-1])


for i in range(int(input())):
	a = input()
	print(a + a[::-1])


def exe():
	return s + s[::-1]
for _ in range(int(input())):
	s = input()
	print(exe())


def solve():
	s = input()
	print(s + s[::-1])
t = int(input())
for _ in range(t):
	solve()


t = int(input())
results = []
for i in range(t):
	s = input().strip()
	results.append(s + s[::-1])
for k in results:
	print(k)