Let's say string $s$ has period $k$ if $s_i = s_{i + k}$ for all $i$ from $1$ to $|s| - k$ ($|s|$ means length of string $s$) and $k$ is the minimum positive integer with this property.

Some examples of a period: for $s$="0101" the period is $k=2$, for $s$="0000" the period is $k=1$, for $s$="010" the period is $k=2$, for $s$="0011" the period is $k=4$.

You are given string $t$ consisting only of 0's and 1's and you need to find such string $s$ that:  String $s$ consists only of 0's and 1's;  The length of $s$ doesn't exceed $2 \cdot |t|$;  String $t$ is a subsequence of string $s$;  String $s$ has smallest possible period among all strings that meet conditions 1—3. 

Let us recall that $t$ is a subsequence of $s$ if $t$ can be derived from $s$ by deleting zero or more elements (any) without changing the order of the remaining elements. For example, $t$="011" is a subsequence of $s$="10101".


-----Input-----

The first line contains single integer $T$ ($1 \le T \le 100$) — the number of test cases.

Next $T$ lines contain test cases — one per line. Each line contains string $t$ ($1 \le |t| \le 100$) consisting only of 0's and 1's.


-----Output-----

Print one string for each test case — string $s$ you needed to find. If there are multiple solutions print any one of them.


-----Example-----
Input
4
00
01
111
110

Output
00
01
11111
1010


-----Note-----

In the first and second test cases, $s = t$ since it's already one of the optimal solutions. Answers have periods equal to $1$ and $2$, respectively.

In the third test case, there are shorter optimal solutions, but it's okay since we don't need to minimize the string $s$. String $s$ has period equal to $1$.

Source: codeforces | Difficulty: EASY
Tags: String algorithms

Constructive algorithms


Solutions:
t = int(input())
for i in range(t):
	s = input()
	if '1' not in s:
		print(s)
	elif '0' not in s:
		print(s)
	else:
		print('10' * len(s))


N = int(input())
for _ in range(N):
	t = input()
	s = ''
	(y, l) = (0, 0)
	for i in range(len(t) - 1):
		if t[i] == t[i + 1]:
			if t[i] == '0':
				s += '01'
			else:
				s += '10'
		else:
			s += t[i]
		if t[i] == '0':
			l += 1
		else:
			y += 1
	s += t[len(t) - 1]
	if t[len(t) - 1] == '0':
		l += 1
	else:
		y += 1
	if y != 0 and l != 0:
		print(s)
	else:
		print(t)


for _ in range(int(input())):
	x = list(input())
	size = len(set(x))
	if size == 1:
		print(''.join(x), end='')
	else:
		i = 0
		prev = str((int(x[0]) + 1) % 2)
		while i < len(x):
			if prev != x[i]:
				print(x[i], end='')
				prev = x[i]
				i += 1
			else:
				print(str((int(x[i]) + 1) % 2), end='')
				prev = str((int(x[i]) + 1) % 2)
	print()


import sys

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

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

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7
for _ in range(INT()):
	S = input()
	N = len(S)
	if not S.count('0') or not S.count('1'):
		print(S)
	else:
		print('10' * N)


for _ in range(int(input())):
	s = input()
	l = []
	if len(s) <= 2:
		print(s)
	elif len(set(list(s))) == 1:
		print(s)
	else:
		l.append(s[0])
		for i in range(1, len(s)):
			if s[i] == s[i - 1]:
				if s[i] == '1':
					l.append('0')
				else:
					l.append('1')
			l.append(s[i])
		print(''.join(l))


t = int(input())
while t:
	s = list(input())
	flag = True
	for c in s:
		if c != s[0]:
			flag = False
	if flag:
		print(''.join(s))
	else:
		print(s[0], end='')
		for i in range(1, len(s)):
			if s[i] == s[i - 1]:
				if s[i] == '0':
					print('1', end='')
				else:
					print('0', end='')
			print(s[i], end='')
		print()
	t -= 1


for _ in range(int(input())):
	t = input()
	check = True
	for i in range(1, len(t)):
		if t[i] != t[i - 1]:
			check = False
			break
	if check == True:
		print(t)
	else:
		s = ''
		for _ in range(len(t)):
			s += '10'
		print(s)


for _ in range(int(input())):
	s = list(map(int, input()))
	if sum(s) == 0 or sum(s) == len(s):
		print(''.join(list(map(str, s))))
	else:
		start = s[0]
		ans = [start]
		j = 0
		while j < 2 * len(s) - 1:
			ans.append(1 - ans[j])
			j += 1
		print(''.join(list(map(str, ans))))


import os
import sys
from math import *
from collections import *
from bisect import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

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

def array():
	return [int(i) for i in input().split()]

def cal(c):
	if c == '0':
		return '1'
	else:
		return '0'
for _ in range(int(input())):
	s = input()
	if len(s) == 2 or len(set(s)) == 1:
		print(s)
		continue
	n = len(s)
	ans = ''
	for i in range(0, n):
		ans += s[i]
		if i + 1 < n and s[i] == s[i + 1]:
			ans += cal(s[i])
	print(ans)


from sys import stdin

def main():
	tests_num = int(stdin.readline())
	tests = []
	for t in range(tests_num):
		received = stdin.readline()
		string = received[0:len(received) - 1]
		tests.append(string)
	for test in tests:
		if len(test) == 2 or len(test) == 1:
			print(test)
			continue
		chars = {}
		for char in test:
			if char in chars:
				continue
			else:
				chars[char] = True
		if len(chars) == 1:
			print(test)
			continue
		res = ''
		pos = 0
		for char in test[:-1]:
			if char == '1' and test[pos + 1] == '1':
				res += '10'
			elif char == '0' and test[pos + 1] == '0':
				res += '01'
			else:
				res += char
			pos += 1
		res += test[-1]
		print(res)
main()


t = int(input())
for i in range(t):
	s = input()
	flag1 = 0
	flag2 = 0
	for j in range(len(s) - 1):
		if s[j] != s[j + 1]:
			flag1 = 1
			break
	if flag1 == 0:
		print(s)
		continue
	else:
		t = ''
		for j in range(len(s) - 1):
			if s[j] == s[j + 1]:
				t += s[j]
				t += str(1 - int(s[j]))
			else:
				t += s[j]
		t += s[len(s) - 1]
		print(t)


for i in range(int(input())):
	st = input()
	if st.find('0') == -1 or st.find('1') == -1:
		print(st)
	else:
		print(len(st) * '01')


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import math

def fact(x):
	if x == 0:
		return 1
	else:
		return x * fact(x - 1)

def abs(x):
	return x if x >= 0 else -x

def sumelem(x, start, end):
	sum = 0
	for i in range(start, end + 1):
		sum += x[i]
	return sum
for t in range(int(input())):
	string = input()
	itr = 0
	flag = 1
	allok = 0
	for j in range(1, len(string) + 1):
		itr += 1
		upto = len(string) - itr
		if upto == 0:
			break
		for i in range(upto):
			if string[i] == string[i + itr]:
				allok = 1
				continue
			else:
				allok = 0
				break
		if allok == 1:
			ans = itr
			break
	temp = ''
	if itr == 1 or itr == 2:
		print(string)
	else:
		for i in range(len(string)):
			if string[i] == '1':
				temp += '10'
			elif string[i] == '0':
				temp += '10'
		print(temp)


T = int(input())
for i in range(T):
	t = input()
	if t.count('0') == 0 or t.count('1') == 0:
		print(t)
	else:
		print('10' * len(t))


for i in range(int(input())):
	t = input()
	c = [0, 0]
	f = t[0]
	for i in t:
		if i == '0':
			c[0] += 1
		else:
			c[1] += 1
	if f == '0':
		if c[0] == len(t):
			print(t)
		else:
			print('01' * len(t))
	if f == '1':
		if c[1] == len(t):
			print(t)
		else:
			print('10' * len(t))


for tt in range(int(input())):
	l = list(input())
	if l.count('1') == 0:
		print(''.join(l))
	elif l.count('0') == 0:
		l.append('1' * len(l))
		print(''.join(l))
	else:
		print('10' * len(l))


def solve(s):
	n = len(s)
	if s in ['1' * n, '0' * n]:
		return s
	return '10' * n

def main():
	inp = lambda : [int(x) for x in input().split()]
	tc = int(input())
	for _ in range(tc):
		s = input()
		print(solve(s))
main()


template = '10' * 100
tc = int(input())
while tc > 0:
	s = input()
	diff = 0
	for c in s:
		diff += 1 if c == '1' else -1
	if abs(diff) == len(s):
		print(s)
	else:
		start = 0 if s[0] == '1' else 1
		end = start + len(s) * 2 - 1
		print(template[start:end])
	tc -= 1


t = int(input())
for _ in range(t):
	s = input()
	if '0' not in s or '1' not in s:
		print(s)
	elif s[0] == '0':
		for i in range(len(s)):
			print('01', end='')
		print()
	else:
		for i in range(len(s)):
			print('10', end='')
		print()


def convert(s):
	new = ''
	for x in s:
		new += x
	return new
t = int(input())
for i in range(t):
	S = input()
	zeroflag = 0
	oneflag = 0
	for j in range(len(S)):
		if S[j] == '0':
			zeroflag = 1
		if S[j] == '1':
			oneflag = 1
	if zeroflag == 1 and oneflag == 1:
		ans = []
		for j in range(len(S)):
			ans.append('0')
			ans.append('1')
		print(convert(ans))
	else:
		print(S)


from collections import Counter
for _ in range(int(input())):
	s = list(input())
	x = Counter(s)
	if x['0'] == 0 or x['1'] == 0:
		print(*s, sep='')
	else:
		l = ['1', '0'] * len(s)
		print(*l, sep='')


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import ceil, floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque, Counter as c
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
mod = pow(10, 9) + 7
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(var):
	sys.stdout.write(str(var))

def outln(var):
	sys.stdout.write(str(var) + '\n')

def l():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
for _ in range(int(data())):
	s = data()
	if len(set(s)) == 1:
		outln(s)
		continue
	n = len(s)
	answer = [s[0]]
	for i in range(n - 1):
		if s[i + 1] == s[i]:
			if s[i] == '1':
				answer.append('0')
			else:
				answer.append('1')
		answer.append(s[i + 1])
	outln(''.join(answer))


for _ in range(int(input())):
	s = input()
	if s.count('0') == 0 or s.count('1') == 0:
		print(s)
	else:
		print('10' * len(s))


t = int(input())
for q in range(t):
	sub = input()
	string = ''
	if sub[0] == '0':
		ini = '0'
		if '1' in sub:
			ini += '1'
	else:
		ini = '1'
		if '0' in sub:
			ini += '0'
	for k in range(len(sub)):
		string += ini
	print(string)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def RL():
	return map(int, sys.stdin.readline().rstrip().split())

def RLL():
	return list(map(int, sys.stdin.readline().rstrip().split()))

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

def comb(n, m):
	return factorial(n) / (factorial(m) * factorial(n - m)) if n >= m else 0

def perm(n, m):
	return factorial(n) // factorial(n - m) if n >= m else 0

def mdis(x1, y1, x2, y2):
	return abs(x1 - x2) + abs(y1 - y2)
mod = 998244353
INF = float('inf')
from math import factorial
from collections import Counter, defaultdict, deque
from heapq import heapify, heappop, heappush

def main():
	for _ in range(N()):
		t = input()
		le = len(t)
		one = t.count('1')
		zero = le - one
		if one == 0 or zero == 0:
			print(t)
		else:
			res = ''
			for i in range(le):
				if i != le - 1 and t[i] == t[i + 1]:
					res += t[i]
					res += str(int(t[i]) ^ 1)
				else:
					res += t[i]
			print(res)
main()


from sys import stdin
from heapq import nsmallest
ip = stdin.readline
for _ in range(int(ip())):
	t = ip().strip()
	n = len(t)
	s = set(t)
	ans = t
	if n > 2 and len(s) > 1:
		ans = t[0]
		for i in range(1, n):
			val = t[i]
			if ans[-1] == val:
				ans += '1' if val == '0' else '0'
			ans += val
	print(ans)


t = int(input())
for i in range(t):
	s = input()
	k = s.count('0')
	if k == len(s) or k == 0:
		print(s)
	else:
		print('10' * len(s))


T = int(input())
for test in range(T):
	lst = list(input())
	if len(list(set(lst))) == 1 or len(lst) <= 2:
		print(''.join(lst))
	else:
		newlst = []
		for i in range(len(lst)):
			if i == '1':
				newlst.append('1')
			else:
				newlst.append('1')
				newlst.append('0')
		print(''.join(newlst))


for t in range(int(input())):
	t = input()
	(cont1, cont0) = (False, False)
	for i in t:
		if i == '1':
			cont1 = True
		if i == '0':
			cont0 = True
	if cont1 and cont0:
		s = t[0]
		for i in range(1, len(t)):
			if t[i] == s[-1]:
				if t[i] == '0':
					s += '1'
				else:
					s += '0'
			s += t[i]
		print(s)
	else:
		print(t)


t = int(input())
for ds in range(t):
	s = input()
	k = 0
	for i in range(len(s) - 1):
		if s[i] != s[i + 1]:
			k += 1
	if k == 0:
		print(s)
	else:
		print('01' * len(s))


from sys import stdin
for j in range(int(stdin.readline())):
	a = input()
	s = 0
	for x in a:
		s += int(x)
	if s == 0 or s == len(a):
		print(a)
	else:
		for i in range(2 * len(a)):
			if i % 2 == 0:
				print(1, end='')
			else:
				print(0, end='')
		print('')


inp = lambda cast=int: [cast(x) for x in input().split()]
printf = lambda s='', *args, **kwargs: print(str(s).format(*args), flush=True, **kwargs)
(t,) = inp()
for _ in range(t):
	(S,) = inp(str)
	first = S[0]
	flag = True
	for c in S:
		if c != first:
			flag = False
			break
	if flag:
		print(S)
	else:
		print('10' * len(S))


import sys
t = int(input())
for _ in range(t):
	s = input()
	if s.count('1') % len(s) == 0:
		print(s)
	else:
		ch = '0' if s[0] == '1' else '1'
		print((s[0] + ch) * len(s))


from collections import Counter
T = int(input())
ss = []
for _ in range(T):
	ss.append(input())
for s in ss:
	counter = Counter(s)
	if counter['1'] > 0 and counter['0'] > 0:
		if s[0] == '1':
			print(''.join(['1', '0'] * len(s)))
		else:
			print(''.join(['0', '1'] * len(s)))
	else:
		print(s)


t = int(input())
for i in range(0, t):
	s = input()
	e = 0
	f = 0
	for j in range(0, len(s)):
		if s[j] == '0':
			e = 1
		else:
			f = 1
	if e == 0:
		print(s)
	elif f == 0:
		print(s)
	else:
		print('10' * len(s))


from collections import Counter

def solve():
	data = input()
	d = Counter(data)
	if '0' in d and '1' in d:
		if len(data) == 2:
			print(data)
		else:
			t = d.most_common(2)
			c1 = '10'
			c2 = '01'
			if data[0] == '1':
				print('{0}'.format((t[0][1] + t[1][1]) * c1))
			else:
				print('{0}'.format((t[0][1] + t[1][1]) * c2))
	else:
		print(data)
nums = int(input())
for _ in range(1, nums + 1):
	solve()


import sys
from collections import deque, Counter
inp = sys.stdin.readline
read = lambda : list(map(int, inp().split()))

def a():
	ans = ''
	for _ in range(int(inp())):
		(x, y) = sorted(read())
		(a, b) = read()
		d = min((y - x) * a + b * x, (y + x) * a)
		ans += str(d) + '\n'
	print(ans)

def b():
	ans = ''
	for _ in range(int(inp())):
		t = inp().strip()
		if t.count('0') == 0 or t.count('1') == 0:
			ans += t + '\n'
		else:
			tem = t[0]
			for i in range(1, len(t)):
				if t[i - 1] == t[i]:
					tem += '01' if t[i] == '1' else '10'
				else:
					tem += t[i]
			ans += tem + '\n'
	print(ans)
b()


for i in range(int(input())):
	String = input()
	print(''.join(set(String)) * len(String))


try:
	T = int(input())
	for i in range(T):
		t = input()
		l = list(t)
		s = set(l)
		if len(s) == 1:
			print(t)
		else:
			print('01' * len(t))
except:
	pass


for _ in ' ' * int(input()):
	s = input()
	if len(set(s)) == 1:
		print(s)
	else:
		print('10' * len(s))


test = int(input())

def odd_or_even(i):
	return '1' if i % 2 == 1 else '0'
for case in range(test):
	s = input()
	if '0' in s and '1' in s:
		print(''.join([odd_or_even(i) for i in range(len(s) * 2)]))
	else:
		print(s)


for _ in range(int(input())):
	s = input()
	n0 = 0
	n1 = 0
	for i in s:
		if i == '0':
			n0 += 1
		elif i == '1':
			n1 += 1
	if n0 > 0 and n1 > 0 and (s[0] == '1'):
		print('10' * len(s))
	elif n0 > 0 and n1 > 0 and (s[0] == '0'):
		print('01' * len(s))
	elif n0 > 0:
		print('0' * n0)
	else:
		print('1' * n1)


import sys
t = int(input())
for q in range(t):
	s = input()
	same = True
	for i in range(len(s) - 1):
		if s[i] != s[i + 1]:
			same = False
	if same:
		print(s)
	else:
		rtn = ''
		for i in range(2 * len(s)):
			if i % 2 == 1:
				rtn += '1'
			if i % 2 == 0:
				rtn += '0'
		print(rtn)


for iq in range(int(input())):
	t = input()
	ctr1 = t.count('1')
	ctr2 = t.count('0')
	if ctr1 == 0 or ctr2 == 0:
		print(t)
	else:
		for i in range(0, len(t)):
			print('10', end='')
		print()


from sys import stdin, stdout
t = int(input())
for _ in range(t):
	t = stdin.readline().strip()
	sm = sum([int(i) for i in t])
	if sm == 0 or sm == len(t):
		print(t)
		continue
	s = ''
	prev = t[0]
	for char in t[1:]:
		if prev == char:
			s += prev + ('1' if prev == '0' else '0')
			prev = char
		else:
			s += prev
			prev = char
	s += char
	print(s)


def areall1(s):
	for i in s:
		if i != '1':
			return 0
	return 1

def areall0(s):
	for i in s:
		if i != '0':
			return 0
	return 1
t = int(input())
for you in range(t):
	s = input()
	if areall1(s) or areall0(s):
		print(s)
	else:
		for i in range(len(s)):
			print('10', end='')
		print()


t = int(input())
for _ in range(t):
	S = input()
	l = 2 * len(S)
	count = 0
	for i in range(len(S)):
		if S[i] == '1':
			count += 1
	if count == len(S) or count == 0:
		print(S)
	else:
		arr = ['0'] * l
		for i in range(0, l, 2):
			arr[i] = '1'
			arr[i + 1] = '0'
		for i in range(l):
			print(arr[i], end='')
	print()


import math
import bisect
t = int(input())
for _ in range(t):
	s = input()
	s1 = ''
	i = 0
	while i < len(s):
		if s[0] == '0':
			if s[i] == '1':
				break
		if s[0] == '1':
			if s[i] == '0':
				break
		i += 1
	if i == len(s):
		print(s)
	else:
		s1 += s[0]
		for i in range(1, len(s)):
			if s[i - 1] == s[i] and s[i] == '0':
				s1 += '1' + s[i]
			elif s[i - 1] == s[i] and s[i] == '1':
				s1 += '0' + s[i]
			else:
				s1 += s[i]
		print(s1)


t = int(input())
for i in range(t):
	s = input().strip()
	k0 = 0
	k1 = 0
	for i in s:
		if i == '0':
			k0 += 1
		else:
			k1 += 1
	if k0 == 0 or k1 == 0:
		print(s)
	else:
		if s[0] == '0':
			for i in range(2 * len(s)):
				if i % 2 == 1:
					print(1, end='')
				else:
					print(0, end='')
		else:
			for i in range(2 * len(s)):
				if i % 2 == 1:
					print(0, end='')
				else:
					print(1, end='')
		print()


n = int(input())
p1 = '10'
p2 = '11'
p3 = '00'
for _ in range(n):
	t = input()
	if '0' in t and '1' in t:
		print(p1 * len(t))
	elif '0' in t:
		print(p3 * len(t))
	elif '1' in t:
		print(p2 * len(t))


t = int(input())
for _ in range(t):
	t = input()
	if len(set(list(t))) == 1:
		print(t)
	else:
		s = [t[0]]
		for i in range(1, len(t)):
			if t[i] == t[i - 1]:
				if t[i] == '0':
					s.append('1')
				else:
					s.append('0')
			s.append(t[i])
		print(''.join(s))


t = int(input())
for _ in range(t):
	n = str(input())
	if len(n) == 2:
		print(n)
		continue
	elif len(set(n)) == 1:
		print(n)
	else:
		print('10' * len(n))


for _ in range(int(input())):
	s = input()
	l = [s[0]]
	(z, o) = (s.count('0'), s.count('1'))
	if z == 0 or o == 0:
		print(s)
	else:
		for i in range(1, len(s)):
			if s[i] == l[-1]:
				l.append(str(int(s[i]) ^ 1))
				l.append(s[i])
			else:
				l.append(s[i])
		print(''.join(l))


t = int(input())
while t:
	t -= 1
	a = input()
	n = len(a)
	s = ['1', '0']
	equal = True
	for i in range(n - 1):
		if a[i] != a[i + 1]:
			equal = False
			break
	if equal:
		print(a)
	else:
		for i in range(2 * n):
			print(s[i % 2], end='')
		print()


from collections import deque
tc = int(input())
for _ in range(tc):
	t = input()
	size = len(t)
	one = 1
	for i in range(size - 1):
		one += int(t[i] == t[i + 1])
	if one == size or size <= 2:
		print(t)
		continue
	stack = deque()
	for i in range(size - 1):
		stack.append(t[i])
		if t[i] == t[i + 1]:
			if t[i] == '0':
				stack.append('1')
			else:
				stack.append('0')
	stack.append(t[size - 1])
	ans = ''.join(stack)
	if len(ans) <= 2 * size:
		print(ans)


m = {'1': '0', '0': '1'}
for t in range(int(input().strip())):
	t = input().strip()
	if '01' in t or '10' in t:
		pc = t[0]
		res = [pc]
		for i in range(1, len(t)):
			if pc == t[i]:
				res.append(m[pc])
			res.append(t[i])
			pc = t[i]
		print(''.join(res))
	else:
		print(t)


import sys
sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline

def solve():
	t = rl().rstrip()
	if t.find('0') == -1:
		print(t)
	elif t.find('1') == -1:
		print(t)
	else:
		if t[0] == '0':
			ans = ''
			for i in range(2 * len(t)):
				if i % 2 == 0:
					ans += '0'
				else:
					ans += '1'
		else:
			ans = ''
			for i in range(2 * len(t)):
				if i % 2 == 0:
					ans += '1'
				else:
					ans += '0'
		print(ans)
T = int(rl())
for _ in range(T):
	solve()


for t in range(int(input())):
	string = list(input())
	stringset = set(string)
	if '0' not in stringset or '1' not in stringset:
		print(''.join(string))
	else:
		result = [string[0]]
		last = '0' if string[0] == '0' else '1'
		for j in range(1, len(string)):
			if last == string[j]:
				if last == '0':
					result.append('1')
				else:
					result.append('0')
			result.append(string[j])
			last = string[j]
		print(''.join(result))


for test_i in range(int(input())):
	t = input()
	if t.count('0') == 0 or t.count('1') == 0:
		print(t)
	else:
		print('10' * len(t))


def binaryperiod(s, dic):
	l = len(s)
	if dic['1'] == l or dic['0'] == l:
		print(s)
		return
	elif s[0] == '0':
		print('01' * l)
	else:
		print('10' * l)
t = int(input())
for i in range(t):
	s = input()
	dic = {'0': 0, '1': 0}
	for i in s:
		if i not in dic:
			dic[i] = 1
		else:
			dic[i] += 1
	binaryperiod(s, dic)


t = int(input())
for _ in range(t):
	a = input()
	ze = a.count('0')
	on = a.count('1')
	if ze == 0:
		print('1' * len(a))
	elif on == 0:
		print('0' * len(a))
	else:
		print('10' * len(a))


for _ in range(int(input())):
	t = input()
	if len(set(t)) == 1:
		print(t)
	else:
		for i in range(len(t) - 1):
			print(t[i], end='')
			if t[i] == t[i + 1]:
				if t[i] == '0':
					print('1', end='')
				else:
					print('0', end='')
		print(t[-1])


t = int(input())
for _ in range(t):
	s = input()
	n = len(s)
	same = True
	for i in range(n):
		if s[i] != s[0]:
			same = False
	if same:
		print(s[0] * n)
	else:
		print('10' * n)


Q = int(input())
for i in range(Q):
	s = input()
	if len(set(s)) == 1:
		print(s)
	else:
		print('10' * len(s))


def s(t):
	n = len(t)
	flag = 0
	for i in range(1, n):
		if t[i] != t[0]:
			flag = 1
			break
	if flag == 0:
		return t
	i = 0
	while i != len(t) - 1:
		if t[i] == t[i + 1]:
			t = t[:i + 1] + str(int(t[i]) ^ 1) + t[i + 1:]
		i += 1
	return t
tt = int(input())
while tt:
	t = input()
	t = print(s(t))
	tt -= 1


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	s = input().rstrip()
	if len(set(s)) == 1:
		print(s)
		continue
	ans = []
	for i in range(len(s) - 1):
		ans.append(s[i])
		if s[i] == s[i + 1]:
			ans.append('1' if s[i] == '0' else '0')
	ans.append(s[-1])
	print(*ans, sep='')


for i in range(int(input())):
	s = input()
	if len(s) == 2:
		print(s)
	elif len(s) == 1:
		print(s * 2)
	elif len(set(s)) == 1:
		print(s * 2)
	else:
		print('01' * len(s))


from collections import Counter

def solve():
	t = input()
	c = Counter(t)
	if len(c) == 1:
		print(t)
	else:
		print('01' * len(t))
t = int(input())
for _ in range(t):
	solve()


def solve():
	t = input()
	s = set(t)
	if len(s) == 1:
		print(t)
	else:
		print('10' * len(t))
for i in range(int(input())):
	solve()


for _ in range(int(input())):
	s = input()
	print('01' * len(s) if len(set(s)) - 1 else s)


for i in range(int(input())):
	t = input()
	ch = True
	count = [0, 0]
	for j in t:
		if j == '1':
			count[1] += 1
		else:
			count[0] += 1
	if count[0] == 0 or count[1] == 0:
		print(t)
	else:
		s = t[0]
		for j in range(1, len(t)):
			if t[j] != t[j - 1]:
				s += t[j]
			elif t[j] == '1':
				s += '0' + '1'
			else:
				s += '1' + '0'
		print(s)


for _ in range(int(input())):
	s = input()
	for i in range(1, len(s) + 1):
		if s[:i] * (len(s) // i) + s[:len(s) % i] == s:
			break
	if i <= 2:
		print(s)
	else:
		print('10' * len(s))


for _ in range(int(input())):
	s = input()
	x = s.count('0')
	y = s.count('1')
	if x * y == 0 or x == y == 1:
		print(s)
	else:
		t = len(s)
		if x > y:
			print('01' * t)
		elif y > x:
			print('10' * t)
		elif s[0] == '0':
			print('01' * t)
		else:
			print('10' * t)


import math
t = int(input().strip())

def allSame(s):
	ints = int(s, 2)
	if ints == 0:
		return True
	for x in s:
		if x == '0':
			return False
	return True
for _ in range(t):
	s = input()
	if allSame(s):
		print(s)
	else:
		print('01' * len(s))


t = int(input())
for i in range(t):
	s = input()
	if len(set(s)) == 1:
		print(s)
		continue
	print('10' * len(s))


def solve():
	ans = ''
	s = input()
	cntz = 0
	for i in range(len(s)):
		if s[i] == '0':
			ans += s[i]
			ans += '1'
			cntz += 1
		else:
			ans += '0'
			ans += s[i]
	if not cntz or cntz == len(s):
		print(s)
	else:
		print(ans)
t = int(input())
for _ in range(t):
	solve()


for _ in range(0, int(input())):
	st = input()
	(c1, c2) = (st.count('0'), st.count('1'))
	if c1 == 0 or c2 == 0:
		print(st)
	else:
		for i in range(0, len(st)):
			print('01', end='')
		print()


t = int(input())
for tt in range(t):
	str_t = input()
	if str_t.count('0') == len(str_t) or str_t.count('1') == len(str_t):
		print(str_t)
	else:
		ans = ''
		for i in range(len(str_t) - 1):
			if str_t[i] == '1' and str_t[i + 1] == '1':
				ans += str_t[i] + '0'
			elif str_t[i] == '0' and str_t[i + 1] == '0':
				ans += str_t[i] + '1'
			else:
				ans += str_t[i]
		if ans[-1] == str_t[-1]:
			ans += str(abs(int(str_t[-1] - 1))) + str_t[-1]
		else:
			ans += str_t[-1]
		print(ans)


T = int(input())
for _ in range(T):
	t = input()
	same = True
	for i in range(1, len(t)):
		if t[i] != t[0]:
			same = False
			break
	if same:
		print(t)
		continue
	print('01' * len(t))


import sys
from collections import defaultdict, deque
from math import sqrt, gcd, factorial

def input():
	return sys.stdin.readline()[:-1]

def solve():
	a = [int(x) for x in input()]
	d = deque(a)
	n = len(d)
	if len(set(a)) == 1:
		print(str(a[0]) * n)
	elif a[0]:
		print('10' * n)
	else:
		print('01' * n)
t = 1
t = int(input())
for _ in range(t):
	solve()


for _ in range(int(input())):
	s = input()
	o = s.count('1')
	e = s.count('0')
	if o == 0 or e == 0:
		print(s)
	else:
		for i in range(0, 2 * len(s), 2):
			print('01', end='')
		print()


t = int(input())
while t:
	x = input()
	if len(set(x)) == 1:
		print(x)
	elif x[0] == '0':
		c = ''
		for i in range(len(x)):
			c += '01'
		print(c)
	else:
		c = ''
		for i in range(len(x)):
			c += '10'
		print(c)
	t -= 1


for _ in range(int(input())):
	data = input()
	count_0 = data.count('0')
	count_1 = data.count('1')
	if count_0 == 0:
		print(data)
	elif count_1 == 0:
		print(data)
	else:
		n = len(data)
		for i in range(n):
			if data[i] == '0':
				if i > 0 and data[i - 1] == '1':
					print(data[i], end='')
					continue
				print('1', end='')
			if data[i] == '1':
				if i > 0 and data[i - 1] == '1':
					print('0', end='')
			print(data[i], end='')
		if data[n - 1] == '1':
			print('0', end='')
		print()


n = int(input())
for i in range(n):
	s = input()
	st = list(s)
	d = {}
	d[1] = 0
	d[0] = 0
	m = ''
	for j in st:
		if j == '0':
			d[0] = d[0] + 1
		else:
			d[1] = d[1] + 1
	if d[1] == 0 or d[0] == 0:
		print(s)
	else:
		m += st[0]
		for j in range(1, len(st)):
			if st[j - 1] == '0' and st[j] != '1':
				m += '1'
				m += st[j]
			elif st[j - 1] == '1' and st[j] != '0':
				m += '0'
				m += st[j]
			else:
				m += st[j]
		print(m)


t = int(input())
while t:
	t -= 1
	s = list(input())
	if set(s) == {'1'} or set(s) == {'0'}:
		print(''.join(s))
		continue
	ans = [s[0]]
	for i in range(1, len(s)):
		if s[i] == ans[-1]:
			if s[i] == '1':
				ans.append('0')
				ans.append(s[i])
			else:
				ans.append('1')
				ans.append(s[i])
		else:
			ans.append(s[i])
	if ans[0] == ans[-1]:
		if s[0] == '0':
			ans.append('1')
		else:
			ans.append('0')
	print(''.join(ans))


n = int(input())
for _ in range(n):
	a = input()
	if len(set(a)) == 1:
		print(a)
	elif a[0] == '0':
		print('01' * len(a))
	else:
		print('10' * len(a))


for _ in range(int(input())):
	t = input()
	s = set(t)
	b = len(s)
	if b == 1:
		print(t)
	else:
		l = ['01' for i in range(len(t))]
		print(''.join(l))


T = int(input())
for _ in range(T):
	t = input()
	isEqual = True
	for i in range(len(t) - 1):
		if t[i] != t[i + 1]:
			isEqual = False
			break
	if isEqual:
		print(t)
	else:
		output = ''
		for i in range(len(t) - 1):
			if t[i] == t[i + 1]:
				output += t[i]
				if t[i] == '0':
					output += '1'
				else:
					output += '0'
			else:
				output += t[i]
		output += t[len(t) - 1]
		print(output)


def cnt(s):
	zero = 0
	one = 0
	for i in s:
		if i == '0':
			zero += 1
		else:
			one += 1
	return (zero, one)
test = int(input())
for t in range(test):
	s = input()
	(z, o) = cnt(s)
	if o == 0:
		print('0' * z)
	elif z == 0:
		print('1' * o)
	else:
		print(len(s) * '01')


T = int(input())
for _ in range(T):
	s = input()
	n = len(s)
	s = s[:] + str(1 - int(s[-1]))
	X = [[], []]
	cnt = 1
	for i in range(len(s) - 1):
		if s[i] != s[i + 1]:
			X[int(s[i])].append(cnt)
			cnt = 1
		else:
			cnt += 1
	if X[0] == []:
		print('1' * n)
	elif X[1] == []:
		print('0' * n)
	else:
		M = sum(X[0]) + sum(X[1])
		for i in range(M):
			print('01', end='')
		print()


t = int(input())
for i in range(t):
	s = input()
	a = 0
	b = 0
	for j in s:
		if j == '0':
			a += 1
		else:
			b += 1
	if a > 0 and b > 0:
		print('01' * len(s))
	elif a == 0:
		print('1' * b)
	else:
		print('0' * a)


t = int(input())
for i in range(t):
	string = list(input())
	if len(string) <= 2 or string.count('1') == len(string) or string.count('0') == len(string):
		pass
	else:
		ans = []
		n = len(string)
		c = 0
		while c < n - 1:
			if string[c] == string[c + 1]:
				if string[c] == '1':
					string.insert(c + 1, '0')
				else:
					string.insert(c + 1, '1')
				n += 1
			c += 1
	print(''.join(map(str, string)))


t = int(input())
for _ in range(t):
	s = input()
	is_all_same = True
	for i in range(1, len(s)):
		if s[i] != s[i - 1]:
			is_all_same = False
	if is_all_same:
		print(s)
	else:
		print('01' * len(s))


t = int(input())
for i in range(t):
	s = list(input())
	len_s = len(s)
	if s.count('0') == 0:
		s.append('1' * len_s)
		print(''.join(s))
	elif s.count('1') == 0:
		s.append('0' * len_s)
		print(''.join(s))
	else:
		print('10' * len_s)


for _ in range(int(input())):
	s = input()
	n = len(s)
	ok = True
	for i in range(n - 1):
		if s[i] != s[i + 1]:
			ok = False
	if ok:
		print(s)
	else:
		for i in range(2 * n):
			if not i % 2:
				print(s[0], end='')
			elif s[0] == '1':
				print('0', end='')
			else:
				print('1', end='')
	print()


t = int(input())
for i in range(t):
	s = input()
	if len(s) == s.count('0'):
		ans = '00' * len(s)
	elif len(s) == s.count('1'):
		ans = '11' * len(s)
	else:
		ans = '01' * len(s)
	print(ans)


for _ in range(int(input())):
	t = input()
	if '0' in t and '1' in t:
		print('01' * len(t))
	else:
		print(t)


t = int(input())
for _ in range(t):
	s = input()
	l = len(s)
	if len(set(s)) == 1:
		print(s)
	elif s[0] == '0':
		print('01' * l)
	else:
		print('10' * l)


from sys import stdin
from math import sqrt

def r():
	return stdin.readline().strip()

def r_t(tp):
	return map(tp, r().strip().split())

def r_a(tp):
	return list(r_t(tp))

def all_zeros(t):
	for c in t:
		if c != '0':
			return False
	return True

def all_ones(t):
	for c in t:
		if c != '1':
			return False
	return True

def main():
	cases = int(r())
	for case in range(cases):
		t = r()
		if all_ones(t) or all_zeros(t):
			print(t)
		elif t[0] == '1':
			print('10' * len(t))
		else:
			print('01' * len(t))
main()


from sys import stdin

def solve(t):
	if len(t) == t.count('1') or len(t) == t.count('0'):
		print(t)
		return
	for i in range(len(t)):
		print('10', end='')
	print()
	return

def main():
	inp = stdin.readline
	for _ in range(int(inp())):
		t = inp().strip()
		solve(t)
main()


t = int(input())
for i in range(t):
	n = input()
	(cc, cv) = (0, 0)
	s = ''
	k = len(n) * 2
	m = k // 2
	for j in range(len(n)):
		if n[j] == '0':
			cc += 1
		else:
			cv += 1
	if cc == 0:
		s += '1' * k
	elif cv == 0:
		s += '0' * k
	else:
		while m > 0:
			s += '1'
			s += '0'
			m -= 1
	print(s)


for _ in range(int(input())):
	(t, i) = (input(), 0)
	if len(set(t)) == 2:
		while i < len(t) - 1:
			if t[i] == '1' and t[i + 1] == t[i]:
				t = t[:i + 1] + '0' + t[i + 1:]
			elif t[i + 1] == t[i]:
				t = t[:i + 1] + '1' + t[i + 1:]
			i += 1
	print(t)


for i in range(int(input())):
	s = input()
	l = []
	s1 = '10'
	for j in s:
		l.append(j)
	if l.count('1') == len(l) or l.count('0') == len(l):
		print(s)
		continue
	else:
		s1 *= len(l)
		print(s1)


for _ in range(int(input())):
	i = input()
	n = len(i)
	a = i.count('0')
	b = i.count('1')
	if a == 0 or b == 0:
		if a == 0:
			print('1' * n, end='')
		else:
			print('0' * n, end='')
	else:
		for j in range(0, n):
			if i[0] == '1':
				print('1', end='')
				print('0', end='')
			else:
				print('0', end='')
				print('1', end='')
	print('')


import sys
input = sys.stdin.readline
MOD = 1000000007
MOD2 = 998244353
ii = lambda : int(input().strip('\n'))
si = lambda : input().strip('\n')
dgl = lambda : list(map(int, input().strip('\n')))
f = lambda : map(int, input().strip('\n').split())
il = lambda : list(map(int, input().strip('\n').split()))
ls = lambda : list(input().strip('\n'))
let = 'abcdefghijklmnopqrstuvwxyz'
for _ in range(ii()):
	s = si()
	cnt = len(set(s))
	if cnt == 1:
		print(s)
	else:
		ans = []
		ans.append(s[0])
		for i in s[1:]:
			if i == '1':
				if ans[-1] == '0':
					ans.append(i)
				else:
					ans.extend(['0', '1'])
			elif ans[-1] == '1':
				ans.append(i)
			else:
				ans.extend(['1', '0'])
		print(''.join(ans))


t = int(input())
for tt in range(t):
	s = input()
	(ones, zeros) = (s.count('0'), s.count('1'))
	if ones == 0 or zeros == 0:
		print(s)
	else:
		print('10' * len(s))


for _ in range(int(input())):
	t = input()
	all_same = True
	ch = t[0]
	for c in t:
		if c != ch:
			all_same = False
			break
	if all_same:
		print(t)
	else:
		l = len(t)
		s = ''
		for i in range(l):
			s += '01'
		print(s)


for _ in range(int(input())):
	t = input()
	z = t.count('0')
	o = t.count('1')
	import re
	if z == 0 or o == 0:
		print(t)
		continue
	if z > o:
		while '00' in t:
			t = re.sub('00', '010', t)
		while '11' in t:
			t = re.sub('11', '101', t)
		print(t)
	else:
		while '00' in t:
			t = re.sub('00', '010', t)
		while '11' in t:
			t = re.sub('11', '101', t)
		print(t)


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

def ii():
	return int(input())
testcases = int(input())
for t in range(testcases):
	s = input()
	if len(set(list(s))) == 1:
		ans = s
	else:
		ans = ''
		ans += s[0]
		i = 1
		ai = 0
		while i < len(s):
			if ans[ai] == '0':
				if s[i] == '1':
					ans += '1'
					i += 1
					ai += 1
				else:
					ans += '1'
					ai += 1
			elif s[i] == '0':
				ans += '0'
				i += 1
				ai += 1
			else:
				ans += '0'
				ai += 1
	print(ans)


for _ in range(int(input())):
	s = input()
	ans = str
	ans = s[0]
	if len(set(s)) == 1:
		print(s)
	else:
		for i in range(1, len(s)):
			if s[i] == s[i - 1]:
				if s[i] == '0':
					ans += '10'
				else:
					ans += '01'
			else:
				ans += s[i]
		print(ans)


def fun(a):
	x = len(a)
	fz = 0
	fo = 0
	for i in range(x):
		if a[i] == '0':
			fz = 1
		else:
			fo = 1
		if fo == 1 and fz == 1:
			break
	if fo == 1 and fz == 1:
		if a[0] == '0':
			for i in range(x):
				print('01', end='')
		else:
			for i in range(x):
				print('10', end='')
	else:
		for i in range(x):
			print(a[i], end='')
for T in range(int(input())):
	a = list(input())
	fun(a)
	print()


t = int(input())
for i in range(t):
	a = list(input())
	if len(list(set(a))) == 1:
		print(''.join(a))
	else:
		print('10' * len(a))


for _ in range(0, int(input())):
	t = input()
	n = len(t)
	f = 1
	for i in range(1, n):
		if t[i] != t[i - 1]:
			f = 0
	if f == 1 or n <= 2:
		print(t)
	else:
		s = '10' * n
		print(s)


import sys
readline = sys.stdin.readline
flush = sys.stdout.flush
T = int(readline())
for t in range(1, T + 1):
	line = readline().strip()
	ans = []
	ones = zeros = 0
	for c in line:
		if c == '1':
			ones += 1
		else:
			zeros += 1
	if ones == 0 or zeros == 0:
		print(line)
	else:
		print('10' * len(line))


tests = int(input())
for _ in range(tests):
	n = input()
	st = set(n)
	if len(st) == 1:
		print(len(n) * n[0])
	else:
		print('10' * len(n))


for t in range(int(input())):
	t = input().strip()
	if all((c == t[0] for c in t)):
		ans = t
	else:
		ans = [t[0]]
		for c in t[1:]:
			if ans[-1] == c:
				ans.append('1' if c == '0' else '0')
			ans.append(c)
		ans = ''.join(ans)
	print(ans)


import sys
import math

def main():
	input = sys.stdin.readline
	t = int(input())
	while t > 0:
		t -= 1
		s = str(input().strip())
		n = len(s)
		cnt_0 = 0
		cnt_1 = 0
		for c in s:
			if c == '0':
				cnt_0 += 1
			else:
				cnt_1 += 1
		if cnt_0 > 0 and cnt_1 > 0:
			res = '10' * n
		elif cnt_0 > 0:
			res = '0' * n
		else:
			res = '1' * n
		print(res)
main()


def linput():
	return [int(i) for i in input().split()]
q = int(input())
for ______ in range(q):
	n = input()
	if '0' not in n or '1' not in n:
		print(n)
	else:
		print('10' * len(n))


n = int(input())
for _ in range(n):
	s = input()
	output = []
	check = sum(list(map(int, s))) // len(s)
	if check == 1 or int(s) == 0:
		print(s)
	else:
		for i in range(len(s) - 1):
			output.append(s[i])
			if s[i] == s[i + 1]:
				if s[i] == '0':
					output.append('1')
				else:
					output.append('0')
		output.append(s[-1])
		print(''.join(output))


t = int(input())
res = []
for _ in range(t):
	arr = str(input())
	if '0' in arr and '1' in arr:
		r = arr[0]
		i = 1
		j = 0
		while i < len(arr):
			if r[j] == arr[i]:
				r += str(int(not int(arr[i])))
				j += 1
			r += arr[i]
			i += 1
			j += 1
		res.append(r)
	else:
		res.append(arr)
for r in res:
	print(r)


def main_function():
	t = int(input())
	for _ in range(t):
		substring = input()
		if len(set(substring + substring)) == 1:
			print(substring)
		elif substring[0] == '0':
			print('01' * len(substring))
		else:
			print('10' * len(substring))
main_function()


t = int(input())
for _ in range(t):
	a = input()
	if a.count('1') * a.count('0') != 0:
		for i in range(len(a)):
			print('10', end='')
		print()
	else:
		print(a)


import sys
t = int(input())
for _ in range(t):
	s = input()
	(o, z) = (0, 0)
	for i in range(len(s)):
		if s[i] == '0':
			z += 1
		else:
			o += 1
	ans = ''
	for i in range(len(s)):
		ans += '0'
		ans += '1'
	if o == 0:
		print(s)
	elif z == 0:
		print(s)
	else:
		print(ans)


t = int(input())
for ii in range(t):
	s = input()
	first = s[0]
	q = ''
	q += first
	flag = 0
	for i in range(1, len(s)):
		if s[i - 1] == s[i]:
			continue
		else:
			flag = 1
			break
	if flag:
		for i in range(1, len(s)):
			if s[i - 1] == '0' and s[i] == '1' or (s[i - 1] == '1' and s[i] == '0'):
				q += s[i]
			elif s[i] == '1':
				q += '0'
				q += '1'
			else:
				q += '1'
				q += '0'
		print(q)
	else:
		print(s)


for _ in range(int(input())):
	t = input()
	s = [0] * (2 * len(t))
	flag = True
	for i in range(1, len(t)):
		if t[i] is not t[i - 1]:
			flag = False
	if flag:
		print(t)
	else:
		for i in range(1, 2 * len(t), 2):
			s[i] = 1
		print(''.join(map(str, s)))


t = int(input())
for _ in range(t):
	s = input()
	if len(set(s)) is 1:
		print(s)
	else:
		print('10' * len(s))


import math
t = int(input())
for _ in range(t):
	x = input()
	f = x[0]
	for i in x:
		if f != i:
			f = -1
	if f != -1:
		print(x)
	else:
		print('01' * len(x))


test = int(input())
for yy in range(test):
	s = input()
	if s.count('0') == 0 or s.count('1') == 0:
		print(s)
	else:
		for i in range(2 * len(s)):
			print(i % 2, end='')
		print()


from collections import Counter
t = int(input())
for _ in range(t):
	s = input()
	dic = Counter(s)
	if '0' not in dic:
		print(s)
	elif '1' not in dic:
		print(s)
	else:
		front = s[0]
		ans = ''
		if front == '1':
			ans = '10'
			for i in range(1, len(s)):
				ans += '10'
			print(ans)
		else:
			ans = '01'
			for i in range(1, len(s)):
				ans += '01'
			print(ans)


x = int(input())
for i in range(x):
	t = input()
	if t.count('1') == 0 or t.count('0') == 0:
		print(t + t)
	else:
		print('01' * len(t))


from sys import stdin, stdout
for __ in range(int(stdin.readline())):
	s = stdin.readline().strip()
	n = len(s)
	CountOfOne = s.count('1')
	CountOfZero = s.count('0')
	if CountOfOne == n or CountOfZero == n:
		newString = s
	elif s[0] == '0':
		if s[n - 1] == 0:
			newString = '01' * n
		else:
			newString = '01' * n
	elif s[n - 1] == '1':
		newString = '10' * n
	else:
		newString = '10' * n
	stdout.write(newString + '\n')


for _ in range(int(input())):
	s = input()
	l = list(s)
	n = 0
	if set(s) == {'0'} or set(s) == {'1'}:
		print(s)
		n += 1
	m = max(s.count('1'), s.count('0'))
	if n != 1:
		if s[0] == '0':
			print('01' * len(s))
		else:
			print('10' * len(s))


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

def I():
	return int(input())

def S():
	return str(input())

def L():
	return list(R())
from collections import Counter
import math
import sys
from itertools import permutations
import bisect
for _ in range(I()):
	t = S()
	l = len(t)
	if t == '0' * l or t == '1' * l:
		print(t + t)
		continue
	print('01' * l)


t = int(input())
while t:
	t = t - 1
	s = input()
	p = ''
	if '1' not in s:
		print(s)
	elif '0' not in s:
		print(s)
	else:
		for w in range(len(s) - 1):
			if s[w] != s[w + 1]:
				p += s[w]
			else:
				p += s[w]
				if s[w] == '0':
					p += '1'
				else:
					p += '0'
		p += s[-1]
		print(p)


for i in range(int(input())):
	s = input()
	n = len(s)
	if len(s) <= 2:
		print(s)
	elif s == '0' * n or s == '1' * n:
		print(s)
	elif s[0] == 0:
		print('01' * n)
	else:
		print('10' * n)


t = int(input())
for z in range(t):
	s = input()
	n = len(s)
	ans = ''
	count0 = 0
	count1 = 0
	for i in range(n):
		if s[i] == '0':
			count0 += 1
		else:
			count1 += 1
	if count0 != 0 and count1 == 0 or (count0 == 0 and count1 != 0):
		print(s)
	else:
		if s[0] == '0':
			for i in range(0, n):
				ans += '01'
		else:
			for i in range(0, n):
				ans += '10'
		print(ans)


test = int(input())
while test > 0:
	s = input()
	test -= 1
	flag = 0
	for i in range(len(s) - 1):
		if s[i] != s[i + 1]:
			flag = 1
			break
	if flag == 0:
		print(s)
	else:
		p = s[0]
		if p == '1':
			t = len(s)
			ans = [1, 0] * t
			for i in ans:
				print(i, end='')
			print()
		if p == '0':
			t = len(s)
			ans = [0, 1] * t
			for i in ans:
				print(i, end='')
			print()


def is_period_1_or_2(string):
	if string.find('0') == -1 or string.find('1') == -1:
		return True
	partitioned_str = []
	for i in range(0, len(string) - (len(string) % 2 != 0), 2):
		partitioned_str.append(string[i:i + 2])
	p_style = partitioned_str[0]
	for p in partitioned_str:
		if p != p_style or (p.find('0') == -1 or p.find('1') == -1):
			return False
	if len(string) % 2 != 0:
		return p_style[0] == string[-1]
	return True

def sol_str(target_str):
	if is_period_1_or_2(target_str):
		return target_str
	solution_string = target_str[0]
	prev_char = target_str[0]
	for i in range(1, len(target_str)):
		if prev_char == target_str[i]:
			solution_string += '0' if prev_char == '1' else '1'
		solution_string += target_str[i]
		prev_char = target_str[i]
	return solution_string
num_tests = int(input())
for _ in range(num_tests):
	target_str = input()
	print(sol_str(target_str))


from sys import stdin
input = stdin.readline
INF = 10 ** 9 + 7
MAX = 10 ** 7 + 7
MOD = 10 ** 9 + 7
for Ti in range(int(input().strip())):
	s = input().strip()
	if '0' in s and '1' in s:
		print('01' * len(s))
	else:
		print(s)


import sys
import math
for i in range(int(input())):
	s = input()
	if '1' in s and '0' in s:
		if s[0] == '1':
			for i in range(len(s)):
				print('10', end='')
		else:
			for i in range(len(s)):
				print('01', end='')
		print()
	else:
		print(s)


from sys import stdin, stdout
from math import gcd, ceil, sqrt
ii1 = lambda : int(stdin.readline().strip())
is1 = lambda : stdin.readline().strip()
iia = lambda : list(map(int, stdin.readline().strip().split()))
isa = lambda : stdin.readline().strip().split()
mod = 1000000007
tc = ii1()
for _ in range(tc):
	s = is1()
	if len(s) == 2:
		print(s)
	elif s.count('1') == len(s) or s.count('0') == len(s):
		print(s)
	else:
		pos = 0
		res = ''
		flip = False
		while pos < len(s):
			if flip:
				res += '0'
				if s[pos] == '0':
					pos += 1
				flip = False
			else:
				res += '1'
				if s[pos] == '1':
					pos += 1
				flip = True
		print(res)


t = int(input())
cnt = 0
while cnt < t:
	cnt += 1
	s = [int(i) for i in input()]
	set_str1 = set(s)
	if len(set_str1) == 1:
		print(''.join((str(i) for i in s)))
	else:
		for i in range(len(s)):
			if s[i] == 1:
				print(''.join([str(s[i]), str(1 - s[i])]), end='')
			else:
				print(''.join([str(1 - s[i]), str(s[i])]), end='')
		print()


for _ in range(int(input())):
	z = input()
	(a, b) = (0, 0)
	for i in z:
		if int(i) == 0:
			a += 1
		else:
			b += 1
	if a != 0 and b != 0:
		s = ''
		for i in range(len(z)):
			s += '10'
		print(s)
	else:
		print(z + z)


T = int(input())
for t in range(T):
	s = input()
	target = s[0]
	for i in s:
		if i != target:
			ans = '01' * len(s)
			print(ans)
			break
	else:
		print(s)


for _ in range(int(input())):
	t = input()
	n = len(t)
	s = set()
	for i in t:
		s.add(i)
	if len(s) == 1:
		print(t[0] * (2 * n))
	else:
		print('10' * n)


def solve(s):
	if not s.count('0'):
		return s
	elif not s.count('1'):
		return s
	else:
		return '01' * len(s)

def main():
	n = int(input())
	for _ in range(n):
		s = input()
		ans = solve(s)
		print(ans)
main()


t = int(input())
while t:
	t -= 1
	s = input()
	uniq = len(set(s))
	if uniq == 1:
		print(s)
		continue
	for i in range(len(s)):
		print('10', sep='', end='')
	print()


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def ii():
	return int(input())

def si():
	return input()

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

def li():
	return list(mi())

def read():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x
mod = 1000000007
import math
import bisect
abc = 'abcdefghijklmnopqrstuvwxyz'

def main():
	for _ in range(ii()):
		s = list(si())
		t = ''
		if s.count('0') == len(s) or s.count('0') == 0:
			t = ''.join(s)
		else:
			t += s[0]
			i = 1
			while i < len(s):
				if s[i] != s[i - 1]:
					t += s[i]
				else:
					if s[i - 1] == '0':
						t += '1'
						s[i - 1] = '1'
					else:
						t += '0'
						s[i - 1] = '0'
					i -= 1
				i += 1
		print(t)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


for _ in range(int(input())):
	t = list(map(int, list(input())))
	a = sorted(t)
	t = list(map(str, t))
	if a[0] == a[-1]:
		print(''.join(t))
	else:
		a = []
		for i in range(2 * len(t)):
			if i % 2 == 0:
				a.append('1')
			else:
				a.append('0')
		print(''.join(a))
	del a


for _ in range(int(input())):
	s = input()
	ans = ''
	n = 0
	if len(set(s)) == 1:
		print(s)
		continue
	for i in range(len(s) - 1):
		ans += s[i]
		if s[i] == s[i + 1]:
			ans += str(1 - int(s[i]))
	ans += s[-1]
	print(ans)


t = int(input())
for cnt in range(t):
	stri = input()
	ans = []
	if '0' in stri and '1' in stri:
		for i in range(0, len(stri)):
			ans.append('0')
			ans.append('1')
		print(''.join(ans))
	else:
		print(stri)


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	s = list((int(x) for x in input().strip()))
	n = len(s)
	if len(set(s)) == 1:
		print(''.join((str(x) for x in s)))
		continue
	if s[0] == 0:
		print('01' * n)
	else:
		print('10' * n)


for _ in range(int(input())):
	n = input()
	s = list(n)
	ans = '1'
	if s.count('1') == len(s) or s.count('1') == 0:
		print(n)
	else:
		for i in range(len(s)):
			if s[i] == '1':
				if s[i] == ans[-1]:
					ans += '01'
				else:
					ans += '1'
			elif s[i] == ans[-1]:
				ans += '1' + s[i]
			else:
				ans += s[i]
		print(ans)


line = input()
t = int(line)
for _ in range(t):
	line = input()
	cnt_one = line.count('1')
	if cnt_one == 0 or cnt_one == len(line):
		print(line)
	else:
		print('10' * len(line))


for _ in range(int(input())):
	t = input()
	flag = t.count('1') and t.count('0')
	if flag:
		print(len(t) * '10')
	else:
		print(t)


for _ in range(int(input())):
	s = input()
	correct = True
	for i in range(1, len(s)):
		if s[i] != s[i - 1]:
			correct = False
			break
	if correct:
		print(s)
	else:
		out = ['0'] * 2 * len(s)
		for i in range(0, len(out), 2):
			out[i] = '1'
		print(''.join(out))


for _ in range(int(input())):
	x = input()
	if len(x.replace('0', '')) == len(x) or len(x.replace('1', '')) == len(x):
		print(x)
	else:
		while '11' in x or '00' in x:
			x = x.replace('00', '010').replace('11', '101')
		print(x)


t = int(input())
for _ in range(t):
	tt = input()
	if len(set(tt)) == 1:
		print(tt)
	else:
		s = ''
		for i in range(len(tt) - 1):
			if tt[i] == tt[i + 1]:
				s += tt[i]
				s += str(1 - int(tt[i]))
			else:
				s += tt[i]
		s += tt[-1]
		print(s)


for case in range(int(input())):
	s = input()
	c_z = s.count('0')
	c_o = s.count('1')
	if c_z * c_o == 0:
		print(s)
	else:
		print('01' * (c_z + c_o))


t = int(input())
for i1 in range(t):
	s = input()
	s = s.strip()
	z1 = s.count('0')
	z2 = s.count('1')
	if z1 == len(s) or z2 == len(s):
		print(s)
	else:
		z = '10' * len(s)
		print(z)


t = int(input())
for _ in range(t):
	s = input()
	One = 0
	Zero = 0
	for ss in s:
		if ss == '0':
			Zero += 1
		else:
			One += 1
	if Zero > 0 and One > 0:
		print('10' * len(s))
	else:
		print(s)


def check(t):
	arr = list(t)
	if len(set(arr)) == 1:
		return t
	else:
		s = ''
		p = '1'
		for i in range(2 * len(t)):
			s += p
			if p == '1':
				p = '0'
			else:
				p = '1'
		return s
t = int(input())
while t:
	T = input()
	print(check(T))
	t -= 1


t = int(input())
for _ in range(t):
	s = list(input())
	distinct = list(dict.fromkeys(s))
	result = ''
	for _ in range(len(s)):
		result += ''.join(distinct)
	print(result)


t = int(input())
while t:
	s = input()
	zer = s.count('0')
	one = s.count('1')
	if one == 0:
		print('0' * len(s))
	elif zer == 0:
		print('1' * len(s))
	else:
		print('01' * len(s))
	t -= 1


t = int(input())
for x in range(t):
	s = input()
	n = len(s)
	if len(set(s)) == 1:
		print(s * 2)
	else:
		a = s[0]
		for c in s[1:]:
			if c == a[-1]:
				if c == '0':
					a += '1'
				else:
					a += '0'
			a += c
		if s[-1] == s[0]:
			if s[0] == '0':
				a += '1'
			else:
				a += '0'
		print(a)


t = int(input())
for i in range(t):
	s = input()
	lst = set(list(s))
	if len(lst) == 1:
		print(s, end='')
	elif s[0] == '1':
		for i in range(len(s)):
			print('10', end='')
	else:
		for i in range(len(s)):
			print('01', end='')
	print('')


T = int(input())
for _ in range(T):
	t = input()
	n = len(t)
	t = set(t)
	if len(t) == 1:
		t = t.pop()
		print(t * 2 * n)
	else:
		print('10' * n)


t = int(input())
for case in range(t):
	string = str(input())
	first_char = string[0]
	period = 1
	for char in string:
		if char != first_char:
			period = 2
	if period == 1:
		answer = len(string) * first_char
	else:
		answer = len(string) * '10'
	print(answer)


t = int(input())
for _ in range(t):
	s = input()
	if len(s) == 1:
		print(s)
		continue
	elif len(set(list(s))) == 1:
		print(s)
		continue
	else:
		print('10' * len(s))


t = int(input())
for tt in range(t):
	s = input()
	temp = list(filter(lambda x: x == '1', s))
	one = len(temp) == 0 or len(temp) == len(s)
	if one:
		ans = s[0] * len(s)
	else:
		ans = '01' * len(s)
	print(ans)


for i in range(int(input())):
	s = input()
	if '0' in s and '1' in s:
		s = '10' * len(s)
	print(s)


t = int(input())
for i in range(t):
	score = 0
	s = input()
	x = s[0]
	for j in s:
		if j != x:
			score += 1
	if score != 0:
		print('01' * len(s))
	else:
		print(s[0] * len(s))


n = int(input())
for _ in range(n):
	t = input()
	if len(set(t)) == 1:
		print(t)
	else:
		print('01' * len(t))


for i in range(int(input())):
	s = input()
	l = list(s)
	c = 0
	ans = ''
	if l.count('1') == len(l) or l.count('0') == len(l):
		c = 1
	if len(l) < 3:
		print(s)
	elif c == 1:
		print(s)
	else:
		for i in range(len(l) - 1):
			if l[i] == l[i + 1]:
				if l[i] == '0':
					ans += l[i] + '1'
				else:
					ans += l[i] + '0'
			else:
				ans += l[i]
		ans += l[i + 1]
		if len(ans) % 2 != 0:
			if l[0] == '0':
				ans += '1'
			else:
				ans += '0'
		print(ans)


from collections import Counter
T = int(input())
for _ in range(T):
	t = input()
	b = Counter(t)
	zero = b['0']
	one = b['1']
	if zero == 0 or one == 0:
		print(t)
	else:
		ans = '01' * (zero + one)
		print(ans)


t = int(input())
for _ in range(t):
	a = input()
	m = []
	for i in range(len(a)):
		if a[i] in m:
			continue
		else:
			m.append(a[i])
	if len(m) == 1:
		print(a)
	else:
		x = '01' * int(len(a))
		print(x)


for t in range(int(input())):
	t = input()
	if len(t) < 3:
		print(t)
	elif len(set(t)) == 1:
		print(t)
	else:
		ans = ''
		ans += t[0]
		for i in range(1, len(t)):
			if t[i] == t[i - 1]:
				if t[i] == '0':
					ans += '1'
					ans += t[i]
				else:
					ans += '0'
					ans += t[i]
			else:
				ans += t[i]
		print(ans)


t = int(input())
while t:
	str = input()
	one = 0
	zero = 0
	for i in range(0, len(str)):
		if str[i] == '0':
			zero = zero + 1
		else:
			one = one + 1
	if zero == 0 or one == 0:
		print(str)
	else:
		str = list(str)
		for i in range(0, len(str) - 1):
			print(str[i], end='')
			if str[i] == str[i + 1]:
				r = 1 - int(str[i])
				print(r, end='')
		print(str[len(str) - 1])
	t = t - 1


n = int(input())
while n > 0:
	n = n - 1
	(p, q) = (0, 0)
	s = input()
	for a in s:
		if a == '0':
			p += 1
		else:
			q += 1
	if p == 0 or q == 0 or len(s) == 2:
		print(s)
	else:
		t = ''
		for i in range(len(s) - 1):
			if s[i] == s[i + 1]:
				if s[i] == '1':
					t += '10'
				else:
					t += '01'
			else:
				t += s[i]
		t += s[len(s) - 1]
		print(t)


cases = int(input())
for i in range(cases):
	s = input()
	if '1' not in s or '0' not in s or len(s) == 2:
		print(s)
	else:
		while '11' in s or '00' in s:
			if '11' in s:
				y = s.index('11')
				p = s[:y + 1] + '0' + s[y + 1:]
				s = p
			if '00' in s:
				y = s.index('00')
				p = s[:y + 1] + '1' + s[y + 1:]
				s = p
		print(s)


T = int(input())

def solve():
	S = input()
	if S == '0' * len(S) or S == '1' * len(S):
		return S
	if S[0] == '1':
		return '10' * len(S)
	return '01' * len(S)
for _ in range(T):
	print(solve())


for _ in range(int(input())):
	s = input()
	if '1' not in s or '0' not in s:
		print(s)
		continue
	print('01' * len(s))


for i in range(int(input())):
	t = input()
	if '0' not in t or '1' not in t:
		print(t)
		continue
	ns = ''
	for i in range(len(t) - 1):
		if t[i] == t[i + 1]:
			ns += t[i] + ('1' if t[i] == '0' else '0')
		else:
			ns += t[i]
	print(ns + t[i + 1])


for _ in range(int(input())):
	str1 = input()
	s = ''
	count0 = 0
	count1 = 0
	for i in range(len(str1)):
		if str1[i] == '0':
			count0 += 1
		elif str1[i] == '1':
			count1 += 1
	if count1 != 0 and count0 != 0:
		s = ''
		for i in range(2 * len(str1)):
			if i % 2 == 0:
				s += '1'
			else:
				s += '0'
		print(s)
	else:
		print(str1)


import sys
import math
import bisect

def solve(s):
	if len(set(list(s))) == 1:
		return s
	A = []
	for i in range(len(s)):
		A.append('0')
		A.append('1')
	return ''.join(A)

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


t = int(input())

def period(s, k):
	val = 1
	for i in range(len(s) - k):
		val &= s[i] == s[i + k]
	return val
while t > 0:
	t -= 1
	s = input()
	if period(s, 1) or period(s, 2):
		print(s)
		continue
	print('01' * len(s))


for _ in ' ' * int(input()):
	a = input()
	print(''.join(set(a)) * len(a))


from sys import stdin, stdout
for testcases in range(int(stdin.readline())):
	string = stdin.readline()
	one = string.count('1')
	zero = string.count('0')
	if one == len(string) - 1 or zero == len(string) - 1:
		print(string[0:len(string) - 1])
	else:
		count = max(one, zero)
		if string[0] == '0':
			print('01' * (len(string) - 1))
		else:
			print('10' * (len(string) - 1))


import io, sys, atexit, os
import math as ma
from sys import exit
from decimal import Decimal as dec
from itertools import permutations
from itertools import combinations

def li():
	return list(map(int, sys.stdin.readline().split()))

def num():
	return map(int, sys.stdin.readline().split())

def nu():
	return int(input())

def find_gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def lcm(x, y):
	gg = find_gcd(x, y)
	return x * y // gg
mm = 1000000007

def solve():
	t = nu()
	for tt in range(t):
		s = input()
		n = len(s)
		p = set(list(s))
		if len(p) == 1:
			print(s)
		else:
			xp = ''
			if s[0] == '0':
				for i in range(2 * n):
					if i % 2 == 0:
						xp += '0'
					else:
						xp += '1'
			else:
				for i in range(2 * n):
					if i % 2 == 1:
						xp += '0'
					else:
						xp += '1'
			print(xp)
solve()


n = int(input())
for i in range(n):
	t = input()
	if len(t) <= 2:
		print(t)
	else:
		o = t.count('1')
		z = t.count('0')
		if o == 0 or z == 0:
			print(t)
		else:
			s = [t[0]]
			a = t[0]
			j = 1
			while j < len(t):
				if t[j] != a:
					s.append(t[j])
					a = t[j]
					j += 1
				else:
					a = str(1 - int(t[j]))
					s.append(a)
			if len(s) % 2 == 0:
				st = ''.join(s)
				print(st)
			else:
				s.append(str(1 - int(a)))
				st = ''.join(s)
				print(st)


import sys
import math
for _ in range(int(input())):
	tt = input()
	t = list(tt)
	n = len(t)
	zeros = t.count('0')
	ones = t.count('1')
	if zeros == n or ones == n:
		print(tt)
	else:
		i = 0
		while i < n - 1:
			print(t[i], end='')
			if t[i] == t[i + 1]:
				if t[i] == '0':
					print('1', end='')
				else:
					print('0', end='')
			i += 1
		print(t[-1])


t = int(input())
while t > 0:
	t = t - 1
	s = input()
	s0 = 0
	s1 = 0
	for x in range(len(s)):
		if s[x] == '1':
			s1 = 1
		elif s[x] == '0':
			s0 = 1
	if s1 * s0 == 0:
		print(s)
	else:
		for i in range(len(s) - 1):
			print('10', end='')
		print('10')


a = int(input())
final = []
for z in range(a):
	t = input()
	l = len(t)
	p = ['0' for i in range(l)]
	q = ['1' for i in range(l)]
	r = ['01' for i in range(l - 1)]
	r.append('0')
	(zero, one, alt) = ('', '', '')
	for i in range(l):
		zero += p[i]
		one += q[i]
		alt += r[i]
	if t == zero or t == one:
		final.append(t)
	else:
		final.append(alt)
for j in range(a):
	print(final[j])


for _ in range(int(input())):
	s = str(input())
	t = len(s)
	S = set(list(s))
	for i in range(t):
		for i in S:
			print(i, end='')
	print()


from sys import stdin, stdout
m = 10 ** 9 + 7
t = int(stdin.readline())
while t:
	t -= 1
	s = input()
	if '0' in s and '1' in s:
		ans = s[0]
		for i in range(len(s) - 1):
			if s[i] == s[i + 1]:
				if s[i] == '0':
					ans += '10'
				else:
					ans += '01'
			else:
				ans += s[i + 1]
	else:
		ans = s
	print(ans)


from bisect import bisect_left as bl
from bisect import bisect_right as br
from heapq import heappush, heappop
import math
from collections import *
from functools import reduce, cmp_to_key
import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
M = mod = 10 ** 9 + 7

def factors(n):
	return sorted(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0))))

def inv_mod(n):
	return pow(n, mod - 2, mod)

def li():
	return [int(i) for i in input().rstrip().split()]

def st():
	return str(input().rstrip())[2:-1]

def val():
	return int(input().rstrip())

def li2():
	return [str(i)[2:-1] for i in input().rstrip().split()]

def li3():
	return [int(i) for i in input().rstrip()]
for _ in range(val()):
	t = st()
	s = ''
	zeros = ones = 0
	n = len(t)
	zeros = t.count('0')
	ones = n - zeros
	if not zeros or not ones:
		print(t)
		continue
	s = '10' * n
	print(s)


T = int(input())
while T:
	s = input()
	if '1' not in s:
		print(s, end='')
	elif '0' not in s:
		print(s, end='')
	else:
		for i in range(len(s)):
			print('10', end='')
	print('\n', end='')
	T -= 1


from math import gcd
from sys import stdin
inp = stdin.readline
t = int(inp().strip())
for _ in range(t):
	x = [int(x) for x in str(inp().strip())]
	if min(x) == max(x):
		print(''.join(map(str, x)))
	else:
		ans = []
		if x.count(0) == x.count(1):
			for i in range(len(x) * 2):
				ans.append(i % 2)
			if x[0] == 1:
				ans.reverse()
			print(''.join(map(str, ans)))
		else:
			maxCount = max(x.count(0), x.count(1))
			for i in range(len(x) * 2):
				ans.append(i % 2)
			if x[0] == 1:
				ans.reverse()
			print(''.join(map(str, ans)))


ans = []
for _ in range(int(input())):
	s = list(input())
	for i in range(1, len(s)):
		if s[i] != s[0]:
			break
	else:
		ans.append(''.join(s))
		continue
	t = '01' * len(s)
	ans.append(t)
print('\n'.join(map(str, ans)))


for _ in range(int(input())):
	s = input()
	res = ''
	(z, o) = (0, 0)
	for i in range(len(s)):
		if s[i] == '0' and z == 0:
			res += '0'
			z += 1
		elif s[i] == '1' and o == 0:
			res += '1'
			o += 1
		if o == 1 and z == 1:
			break
	while len(res) <= 2 * len(s):
		res = res + res
	for i in range(2 * len(s)):
		print(res[i], end='')
	print()


import sys
import bisect
import heapq
from math import *
from collections import Counter as counter
from itertools import combinations as comb
from itertools import permutations as permutate
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
mod = pow(10, 9) + 7

def inp():
	return sys.stdin.readline().strip()

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def graph(vertex):
	return [[] for i in range(0, vertex + 1)]

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def lcm(a, b):
	return a * b // gcd(a, b)

def solve():
	s = inp()
	f = 0
	for i in range(1, len(s)):
		if s[i] != s[0]:
			f = 1
			break
	if f == 0:
		out(s)
		nextline()
	else:
		ans = '01' * len(s)
		print(ans)
		nextline()
testcase(int(inp()))


for _ in range(int(input())):
	s = input()
	n = len(s)
	if s.count('0') == 0 or s.count('1') == 0:
		print(s)
		continue
	i = 0
	while i < len(s) - 1:
		if s[i] == s[i + 1]:
			s = s[:i + 1] + ('0' if s[i] == '1' else '1') + s[i + 1:]
		i += 1
	print(s)


for _ in range(int(input())):
	t = input()
	l = list(t)
	p = list(set(l))
	o = ''
	while len(o) < 2 * len(t):
		if len(p) == 1:
			o = o + p[0]
		else:
			o = o + p[0] + p[1]
	print(o)


for tt in range(int(input())):
	t = input()
	if t == '0' * len(t) or t == '1' * len(t):
		print(t)
	else:
		print('01' * len(t))


t = int(input())
for tc in range(t):
	s = input()
	co = s.count('0')
	le = len(s)
	if co == le or co == 0:
		print(s)
	else:
		ca = le * 2 - 1
		if s[0] == '0':
			for i in range(ca):
				if i % 2 == 0:
					print(0, end='')
				else:
					print(1, end='')
			print()
		else:
			for i in range(ca):
				if i % 2 == 0:
					print(1, end='')
				else:
					print(0, end='')
			print()


import sys
input = sys.stdin.readline

def getInt():
	return int(input())

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

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

def getStr():
	return input().strip()
tt = getInt()
for _ in range(tt):
	t = getStr()
	x1 = 0
	x0 = 0
	for i in range(len(t)):
		if t[i] == '0':
			x0 += 1
		if t[i] == '1':
			x1 += 1
	if x1 == 0 or x0 == 0:
		s = t
	elif t[0] == '1':
		s = '10' * len(t)
	else:
		s = '01' * len(t)
	print(s)


ans = ''
for _ in range(int(input())):
	s = input()
	if s.count('1') == 0 or s.count('0') == 0:
		ans += f'{s}\n'
		continue
	ans += f"{('10' * len(s) if s[0] == '1' else '01' * len(s))}\n"
print(ans)


p = int(input())
for i in range(p):
	t = input()
	flag = 0
	for j in range(len(t) - 1):
		if t[j] != t[j + 1]:
			flag = 1
	if flag == 0:
		print(t)
	else:
		if t[0] == '0':
			for j in range(len(t)):
				print('01', end='')
		else:
			for j in range(len(t)):
				print('10', end='')
		print()


t = int(input())
for _ in range(t):
	s = input()
	n = len(s)
	if n == 1 or n == 2:
		print(s)
		continue
	zeros = s.count('0')
	ones = s.count('1')
	d = max(zeros, ones)
	ans = ''
	if zeros > 0 and ones > 0:
		if s[0] == '0':
			j = 0
			while j < n - 1:
				if s[j] == '0' and s[j + 1] != '1':
					ans += '01'
				elif s[j] == '0' and s[j + 1] == '1':
					ans += '01'
					j += 1
				elif s[j] == '1' and s[j - 1] != '0':
					ans += '01'
				j += 1
			if s[n - 1] == '0':
				ans += '01'
			elif s[n - 1] == '1' and s[n - 2] != '0':
				ans += '01'
		else:
			j = 0
			while j < n - 1:
				if s[j] == '1' and s[j + 1] != '0':
					ans += '10'
				elif s[j] == '1' and s[j + 1] == '0':
					ans += '10'
					j += 1
				elif s[j] == '0' and s[j - 1] != '1':
					ans += '10'
				j += 1
			if s[n - 1] == '1':
				ans += '10'
			elif s[n - 1] == '0' and s[n - 2] != '1':
				ans += '10'
	else:
		ans = s
	print(ans)


t = int(input())
while t:
	t -= 1
	s = input()
	new = ''
	for i in range(len(s)):
		new += '1'
		new += '0'
	flag = 0
	for i in range(len(s) - 1):
		if s[i] != s[i + 1]:
			flag = 1
			break
	if flag == 1:
		print(new)
	if flag == 0:
		print(s)


import io, os
import sys
from atexit import register
tokens = []
tokens_next = 0

def next_str():
	global tokens, tokens_next
	while tokens_next >= len(tokens):
		tokens = input().split()
		tokens_next = 0
	tokens_next += 1
	return tokens[tokens_next - 1]

def nextInt():
	return int(next_str())
T = nextInt()
for _ in range(T):
	t = next_str()
	if len(set(t)) == 1:
		print(t)
	else:
		print('01' * len(t))


def solve(s):
	if (int(s) == 0) | (int(s) == int('1' * len(s))):
		print(s)
	else:
		prev_num = int(s[0])
		i = 1
		building_s = s[0]
		while i < len(s):
			curr_num = int(s[i])
			if curr_num != prev_num:
				prev_num = curr_num
				i += 1
			elif curr_num == 1:
				s = s[:i] + '0' + s[i:]
			else:
				s = s[:i] + '1' + s[i:]
		print(s)
t = int(input())
for i in range(t):
	solve(input())


def solution(string):
	x = string.count('0')
	y = string.count('1')
	if x == 0 or y == 0:
		return string
	return '10' * (x + y)
n = int(input())
for _ in range(n):
	string = input()
	print(solution(string))


t = int(input())
for i in range(t):
	b = input()
	f = 0
	k = len(b)
	for j in range(k - 1):
		if b[j] != b[j + 1]:
			f = 1
			break
	if f == 0:
		print(b)
	else:
		p = ['10'] * k
		print(''.join(p))


def main():
	string = str(input())
	if len(string) <= 2:
		print(string)
		return
	cnt = 1
	for i in range(len(string) - 1):
		if string[i] == string[i + 1]:
			cnt += 1
	if cnt == len(string):
		print(string)
		return
	cntone = 0
	cntzero = 0
	indexone = 10000
	indexzero = 10000
	for i in range(len(string)):
		if string[i] == '0':
			indexzero = min(indexzero, i)
			cntzero += 1
		else:
			indexone = min(indexone, i)
			cntone += 1
	res = ''
	if indexone > indexzero:
		string2 = '01'
	else:
		string2 = '10'
	for _ in range(cntzero + cntone):
		res += string2
	print(res)
	return
n = int(input())
while n:
	main()
	n -= 1


for t in range(int(input())):
	string = input()
	if len(set(string)) == 1:
		ans = string
	else:
		ans = '10' * len(string)
	print(ans)


t = int(input())
for i in range(t):
	t = input()
	one = t.count('1')
	zero = t.count('0')
	if zero > 0 and one > 0:
		if zero >= one:
			print('01' * len(t))
		else:
			print('10' * len(t))
	else:
		print(t)


t = int(input())
rez = []
for i in range(t):
	tt = input()
	tt1 = tt[0]
	if '0' not in tt or '1' not in tt:
		rez.append(tt)
	else:
		for j in range(1, len(tt)):
			if tt[j] == tt[j - 1]:
				if tt[j] == '0':
					tt1 += '1'
				else:
					tt1 += '0'
			tt1 += tt[j]
		rez.append(tt1)
for i in range(t):
	print(rez[i])


for _ in range(int(input())):
	myinput = input()
	result = ''
	if '1' in myinput and '0' in myinput:
		result11 = myinput[0]
		if result11 == '1':
			result12 = '0'
		else:
			result12 = '1'
		for i in range(2 * len(myinput)):
			if i % 2 == 0:
				result += result11
			else:
				result += result12
	else:
		result = myinput
	print(result)


from sys import stdin, stdout
import math, collections
mod = 998244353
for _ in range(int(stdin.readline())):
	t = input()
	if t.count('1') == 0 or t.count('0') == 0:
		print(t)
	else:
		s = t[0]
		temp = t[0]
		for i in range(1, len(t)):
			if temp == t[i]:
				if temp == '1':
					s += '0'
				else:
					s += '1'
			s += t[i]
			temp = t[i]
		stdout.write(s + '\n')


for _ in range(int(input())):
	s = input()
	z = 0
	o = 0
	n = len(s)
	for i in s:
		if i == '0':
			z += 1
		else:
			o += 1
	if o == 0 or z == 0:
		print(s)
	else:
		for i in range(n):
			print('01', end='')
		print()


t = int(input())
out = ''
while t > 0:
	t -= 1
	x = input()
	n = len(x)
	if len(set(x)) == 1:
		out += x + '\n'
		continue
	a = ''
	digit = int(x[0])
	for i in range(n * 2):
		a += str(digit)
		digit ^= 1
	out += a + '\n'
print(out)


import sys
input = sys.stdin.readline
from math import log2, log, ceil

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def nCr(n, k):
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return res

def upper_bound(a, x, lo=0):
	hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if a[mid] < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def primefs(n):
	primes = {}
	while n % 2 == 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	while x != link[x]:
		x = link[x]
	return x

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
MAXN = int(1000000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def factoriazation(x):
	ret = {}
	while x != 1:
		ret[spf[x]] = ret.get(spf[x], 0) + 1
		x = x // spf[x]
	return ret

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

def str_array():
	return input().strip().split()
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
for _ in range(int(input())):
	string = input().strip()
	tt = string.count('1')
	if tt == len(string) or tt == 0:
		print(string)
		continue
	ans = ''
	for i in string:
		if ans == '':
			ans += i
		elif ans[-1] == i:
			if i == '0':
				ans += '1'
			else:
				ans += '0'
			ans += i
		else:
			ans += i
	if ans[0] == ans[-1]:
		if ans[-1] == '0':
			ans += '1'
		else:
			ans += '0'
	print(ans)


q = int(input())
for w in range(q):
	t = input()
	s = [x for x in t]
	if len(list(set(s))) == 1:
		print(t)
		continue
	addons = []
	for x in range(1, len(s)):
		if s[x] == s[x - 1]:
			if s[x] == '0':
				addons.append((x, '1'))
			else:
				addons.append((x, '0'))
	added = 0
	for x in addons:
		s = s[:x[0] + added] + [x[1]] + s[x[0] + added:]
		added += 1
	for x in s:
		print(x, end='')
	print()


MOD = 1000000007
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
from collections import *
for _ in range(ii()):
	a = si()
	b = list(a)
	c = b.count('1')
	d = b.count('0')
	k = []
	if len(a) <= 2:
		print(a)
	elif b.count('1') == 0 or b.count('0') == 0:
		print(a * 2)
	elif a[0] == '1':
		for i in range(0, 2 * len(a)):
			if i % 2 == 0:
				k.append('1')
			else:
				k.append('0')
		print(''.join(k))
	elif a[0] == '0':
		for i in range(0, 2 * len(a)):
			if i % 2 == 0:
				k.append('0')
			else:
				k.append('1')
		print(''.join(k))


def solve(t):
	n = len(t)
	if '1' not in t:
		return '0' * n
	elif '0' not in t:
		return '1' * n
	else:
		return '10' * n
[print(solve(input())) for _ in range(int(input()))]


from sys import stdin, stdout
from math import *
for __ in range(int(input())):
	s = input()
	if '0' not in s:
		print(s)
	elif '1' not in s:
		print(s)
	else:
		print('10' * len(s))


t = int(input())
buf = []
for _ in range(t):
	t = input()
	c0 = t.count('0')
	c1 = len(t) - c0
	if c0 == 0 or c1 == 0:
		buf.append(t)
	else:
		buf.append('01' * len(t))
print('\n'.join(buf))


T = int(input())
for _ in range(T):
	s = input()
	if s.count('0') == 0 or s.count('1') == 0:
		print(s)
	else:
		print('01' * len(s))


T = int(input())
for _ in range(T):
	t = input()
	t1 = t.count('1')
	if t1 == len(t) or t1 == 0:
		print(t)
	else:
		t2 = ''
		if t[0] == '0':
			for i in range(2 * len(t)):
				if i % 2 == 0:
					t2 += '0'
				else:
					t2 += '1'
		elif t[0] == '1':
			for i in range(2 * len(t)):
				if i % 2 == 0:
					t2 += '1'
				else:
					t2 += '0'
		print(t2)


numTests = int(input())

def test():
	t = [i for i in list(input())]
	substring = t[0:2]
	s = []
	if len(t) <= 2:
		s = t
	elif t.count('0') % len(t) != 0:
		for i in range(0, len(t)):
			if t[i] == '0':
				s.append('0')
				s.append('1')
			else:
				s.append('0')
				s.append('1')
	else:
		s = t
	print(''.join(s))
for _ in range(0, numTests):
	test()


t = int(input())
for tt in range(t):
	inp = input()
	if len(set(inp)) == 1:
		print(inp)
	else:
		print(len(inp) * '01')


for i in range(int(input())):
	a = input()
	if '0' in a and '1' in a:
		print('10' * len(a))
	else:
		print(a)


t = int(input())
for _ in range(t):
	s = input()
	raj = {'0': 0, '1': 0}
	for i in s:
		if i == '0':
			raj['0'] += 1
		else:
			raj['1'] += 1
	x = raj['0']
	y = raj['1']
	if x == 0 or y == 0:
		print(s)
	else:
		s = list(s)
		arr = []
		if x > y:
			for i in range(2 * len(s)):
				if i % 2 == 0:
					arr.append('0')
				else:
					arr.append('1')
		else:
			for i in range(2 * len(s)):
				if i % 2 == 0:
					arr.append('1')
				else:
					arr.append('0')
		print(''.join(arr))


for _ in range(int(input())):
	x = input()
	y = x[0] * len(x)
	if x == y:
		print(x)
	else:
		print('01' * len(x))


t = int(input())
for _ in range(t):
	s = input()
	s1 = s.count('1')
	s2 = s.count('0')
	s3 = len(s)
	if s1 == s3 or s2 == s3:
		print(s)
	else:
		print('10' * (s1 + s2))


for ekbaar in range(1):
	for tin in range(int(input())):
		t = str(input())
		if t.count('1') == 0 or t.count('0') == 0:
			print(t)
		elif t[0] == 0:
			print('01' * len(t))
		else:
			print('10' * len(t))


for t in range(int(input())):
	st = input()
	ans = ''
	if '1' not in st or '0' not in st:
		print(st)
	else:
		print('01' * len(st))


res = []

def rev(s):
	if s == '1':
		return '0'
	return '1'
for _ in range(int(input())):
	t = input()
	l = len(t)
	if len(set(t)) == 1:
		res.append(t)
	else:
		j = 0
		r = []
		for i in range(2 * l):
			if i % 2 == 0:
				r.append(t[j])
				j += 1
			else:
				r.append('')
		for i in range(l):
			if i == l - 1:
				if (2 * l - r.count('')) % 2:
					r[2 * i + 1] = rev(t[i])
			elif t[i] == t[i + 1]:
				r[2 * i + 1] = rev(t[i])
		res.append(''.join(r))
for i in res:
	print(i)


for _ in range(int(input())):
	t = input()
	n = len(t)
	a = t.count('0')
	b = t.count('1')
	if a != 0 and b != 0:
		for i in range(0, n):
			if t[0] == '1':
				print('1', end='')
				print('0', end='')
			else:
				print('0', end='')
				print('1', end='')
	elif a == 0:
		print('1' * n, end='')
	else:
		print('0' * n, end='')
	print('')


for _ in range(int(input())):
	s = input()
	n = len(s)
	c1 = c2 = 0
	for i in range(n):
		if s[i] == '0':
			c1 += 1
		else:
			c2 += 1
	if c1 == 0 or c2 == 0:
		print(s)
	else:
		k = s[0]
		p = c1 + c2
		if k == '1':
			z = '10'
		else:
			z = '01'
		s1 = ''
		for i in range(p):
			s1 += z
		print(s1)


t = int(input())
for _ in range(t):
	s = input()
	zero = 0
	ones = 0
	for si in s:
		if si == '0':
			zero += 1
		else:
			ones += 1
	if ones == 0 or zero == 0:
		print(s)
	else:
		sout = ''
		s0 = s[0]
		sout += s0
		if s0 == '0':
			f = 1
		else:
			f = -1
		for i in range(1, len(s)):
			if s[i] == '0' and f == 1:
				sout += '10'
			elif s[i] == '1' and f == -1:
				sout += '01'
			else:
				sout += s[i]
				f *= -1
		print(sout)


t = int(input())
while t != 0:
	t = t - 1
	str = input()
	n = len(str)
	flag = 1
	for i in range(0, n - 1):
		if str[i] != str[i + 1]:
			flag = 0
			break
	if flag:
		print(str)
	else:
		ans = ''
		for i in range(0, n):
			ans = ans + '01'
		print(ans)


n = int(input())
for _ in range(n):
	t = input()
	l = len(t)
	flag = 1
	s = []
	if t.count('1') == l or t.count('0') == l:
		print(t)
	else:
		for i in range(1, l):
			if t[i] == '0':
				val = '1'
			else:
				val = '0'
			s.append(t[i - 1])
			if t[i] == s[-1]:
				s.append(val)
				if i == l - 1:
					flag = 0
		s.append(t[-1])
		print(''.join(s))


def checker(s):
	(zeros, ones, n) = (s.count('0'), s.count('1'), len(s))
	if zeros * ones == 0 or zeros == ones == 1:
		return s
	elif zeros > ones:
		return '01' * n
	elif ones > zeros:
		return '10' * n
	elif s[0] == '0':
		return '01' * n
	else:
		return '10' * n
for _ in range(int(input())):
	t = input()
	print(checker(t))


import math, sys
from sys import stdin, stdout
from collections import Counter, defaultdict, deque
input = stdin.readline
I = lambda : int(input())
li = lambda : list(map(int, input().split()))

def case():
	s = input().strip()
	if len(s) == 1 or len(s) == 2:
		print(s)
	elif '1' not in s or '0' not in s:
		print(s)
	else:
		print('10' * len(s))
for _ in range(int(input())):
	case()


t = int(input())
for i in range(t):
	s = input()
	zero = s.count('0')
	one = s.count('1')
	if zero == 0 or one == 0:
		print(s)
	elif s[0] == '0':
		print((max(zero, one) + min(zero, one) - 1) * '01')
	else:
		print((max(zero, one) + min(zero, one) - 1) * '10')


for _ in range(int(input())):
	m = input()
	s = list(m)
	n0 = s.count('0')
	n1 = s.count('1')
	if n0 == len(s) or n1 == len(s):
		print(m)
		continue
	else:
		p = ''
		for i in range(len(m)):
			p += '10'
		print(p)


for _ in range(int(input())):
	t = input()
	n = len(t)
	l = ['1', '0']
	if n <= 2:
		s = t
	else:
		s = '' + t[0]
		c = t.count('1')
		c1 = t.count('0')
		if c == n or c1 == n:
			s = t
		else:
			for i in range(1, n):
				if t[i] == s[-1]:
					s += l[int(t[i])]
				s += t[i]
	print(s)


for _ in range(int(input())):
	t = input()
	if '0' not in t or '1' not in t:
		print(t)
	else:
		s = t[0]
		for i in range(1, len(t)):
			c = ''
			if t[i - 1] == t[i]:
				c = str(1 - int(t[i]))
			s += c + t[i]
		print(s)


for T in range(int(input())):
	s = input()
	count_0 = 0
	count_1 = 0
	for i in s:
		if i == '1':
			count_1 += 1
		else:
			count_0 += 1
	if count_0 == 0:
		if count_1 % 2 == 0:
			print(s)
		else:
			print(s + '1')
	elif count_1 == 0:
		if count_0 % 2 == 0:
			print(s)
		else:
			print(s + '0')
	else:
		st = s[0]
		res = ''
		if s[0] == '1':
			res = '10'
		else:
			res = '01'
		print(res * (count_1 + count_0 - 1))


for _ in range(int(input())):
	s = input()
	c_0 = 0
	c_1 = 0
	for i in s:
		if i == '0':
			c_0 += 1
		else:
			c_1 += 1
	if c_0 == 0 or c_1 == 0:
		print(s)
	else:
		t = s[0]
		for i in range(1, len(s)):
			if t[-1] != s[i]:
				t += s[i]
			elif s[i] == '1':
				t += '0'
				t += s[i]
			else:
				t += '1'
				t += s[i]
		print(t)


from collections import deque
from collections import OrderedDict
import math
import sys
import os
from io import BytesIO
for t in range(int(input())):
	s = str(input())
	leng = len(s)
	z = 0
	o = 0
	for i in range(len(s)):
		if s[i] == '0':
			z += 1
		else:
			o += 1
	if z == leng or o == leng:
		print(s)
	else:
		for i in range(leng * 2):
			if i % 2 == 0:
				print('0', end='')
			else:
				print('1', end='')
		print('\n', end='')


T = int(input())
for _ in range(T):
	t = input()
	if len(t) == 2:
		print(t)
	else:
		ones = t.count('1')
		zeros = t.count('0')
		if zeros == 0 or ones == 0:
			print(t)
		else:
			print('10' * len(t))


for x in range(int(input())):
	s = input()
	if s == '1' * len(s) or s == '0' * len(s):
		print(s)
		continue
	ans = s[0]
	d = {'1': '0', '0': '1'}
	for i in range(1, len(s)):
		if s[i] == s[i - 1]:
			ans += d[s[i]] + s[i]
		else:
			ans += s[i]
	print(ans)


for i in range(int(input())):
	s = input()
	if s == '0' * len(s) or s == '1' * len(s):
		print(s)
	else:
		print('01' * len(s))


t = int(input())
for i in range(t):
	s = input()
	mp = dict()
	mp['1'] = 0
	mp['0'] = 0
	for it in s:
		mp[it] += 1
	if mp['1'] == 0 or mp['0'] == 0:
		print(s)
	else:
		for it in range(len(s)):
			print('10', end='')
		print()


t = int(input())
for w in range(t):
	s = input()
	j = len(s)
	k1 = s.count('0')
	k2 = s.count('1')
	if k1 == 0 or k2 == 0:
		print(s)
	elif s[0] == '0':
		print(j * '01')
	else:
		print(j * '10')


t = int(input())
for i in range(0, t):
	s1 = input()
	s = ''
	p = 0
	if len(set(s1)) == 1:
		p = 1
		print(s1)
	else:
		p = 2
		s += s1[0]
		if s1[0] == '0':
			for j in range(1, 2 * len(s1)):
				if j % 2 == 0:
					s += '0'
				else:
					s += '1'
		else:
			for j in range(1, 2 * len(s1)):
				if j % 2 == 0:
					s += '1'
				else:
					s += '0'
		print(s)


try:
	t = int(input())
	for _ in range(t):
		s = list(input())
		num0 = s.count('0')
		num1 = s.count('1')
		if num0 == len(s) or num1 == len(s):
			print(''.join(s))
		elif s[0] == '0':
			for i in range(len(s)):
				print('01', end='')
			print()
		else:
			for i in range(len(s)):
				print('10', end='')
			print()
except:
	pass


test = int(input())
respostas = []
for x in range(test):
	t = input()
	if t.count('0') == 0 or t.count('1') == 0:
		print(t)
	else:
		print('01' * len(t))


test_cases = int(input())

def fix_string(t):
	new_string = t[0]
	prev_char = t[0]
	for i in range(1, len(t)):
		if prev_char == t[i]:
			if prev_char == '0':
				new_string += '1'
			else:
				new_string += '0'
		new_string += t[i]
		prev_char = t[i]
	return new_string
while test_cases:
	test_cases -= 1
	t = input()
	if '0' in t and '1' in t:
		print(fix_string(t))
	else:
		print(t)


t = int(input())
for i in range(t):
	s = input()
	if len(set(s)) == 1:
		print(s)
	else:
		l = [s[0]]
		k = s[0]
		for i in range(1, len(s)):
			if s[i] != k:
				l.append(s[i])
			elif s[i] == '0':
				l.append('1')
				l.append(s[i])
			else:
				l.append('0')
				l.append(s[i])
			k = s[i]
		s1 = ''
		s1 = s1.join(l)
		print(s1)


import math
t = int(input())
for ii in range(t):
	s = input()
	n = len(s)
	ans = '01'
	if not '0' in s or not '1' in s:
		print(s + s)
	else:
		ii = 0
		while ii < n:
			print(ans, end='')
			ii += 1
		print()


for _ in range(int(input())):
	s = list(input())
	n = len(s)
	if len(set(s)) != 1:
		stack = []
		d = {'1': '0', '0': '1'}
		for i in range(1, n):
			if s[i] == s[i - 1]:
				stack.append(i)
		stack.reverse()
		for i in stack:
			s.insert(i, d[s[i]])
	print(''.join(s))


t = int(input())
insertt = lambda s, index, x: s[:index] + x + s[index:]

def solve(s, ln, i):
	if i < ln:
		if s[i] == s[i + 1]:
			s = insertt(s, i + 1, ['0', '1'][s[i] == '0'])
			solve(s, ln + 1, i + 1)
		else:
			solve(s, ln, i + 1)
	else:
		print(s)
for i in range(t):
	s = input()
	if len(set(s)) == 1:
		print(s)
	else:
		solve(s, len(s) - 1, 0)


def solve(t):
	count_0 = t.count('0')
	count_1 = t.count('1')
	if count_0 == 0 or count_1 == 0:
		return t
	result = ''
	use_0 = t[0] == '0'
	for i in range(len(t) * 2):
		result += '0' if use_0 else '1'
		use_0 = not use_0
	return result
for i in range(int(input())):
	print(solve(input()))


t = int(input())
for _ in range(t):
	s = input()
	ones = s.count('1')
	if not ones or ones == len(s):
		print(s)
	else:
		print('10' * len(s))


t = int(input())
while t:
	t -= 1
	s = input()
	c1 = 0
	c0 = 0
	for i in range(len(s)):
		if s[i] == '1':
			c1 += 1
		else:
			c0 += 1
	if c1 == 0 or c0 == 0:
		print(s)
	else:
		x = ''
		for i in range(0, 2 * len(s), 2):
			x += '10'
		print(x)


t = int(input())
for i in range(t):
	s = list(input())
	st = s[0]
	s2 = ''
	if s == ['0'] * len(s) or s == ['1'] * len(s):
		s1 = ''.join([str(ele) for ele in s])
		print(s1)
	else:
		for i in range(len(s)):
			s2 = s2 + '10'
		print(s2)


t = int(input())
for _ in range(t):
	st = input()
	if '0' not in st:
		print('1' * len(st))
	elif '1' not in st:
		print('0' * len(st))
	else:
		print('10' * len(st))


t = int(input())
for _ in range(t):
	s = input().rstrip()
	if len(s) <= 2 or s.find('0') == -1 or s.find('1') == -1:
		print(s)
	else:
		s = list(s)
		i = 1
		while i < len(s):
			if s[i - 1] == s[i]:
				s.insert(i, str(1 - int(s[i])))
			i += 1
		print(*s, sep='')


t = int(input())
for _ in range(t):
	s = input()
	l = len(s)
	if s == '0' * l or s == '1' * l:
		print(s)
	else:
		print('01' * l)


from sys import stdin, stdout
from collections import defaultdict, Counter
from functools import lru_cache
from math import gcd, floor, ceil

def ilist():
	return [int(x) for x in stdin.readline().strip().split(' ')]

def iint():
	return int(stdin.readline().strip())

def istr():
	return stdin.readline().strip()

def solve(t):
	n = len(t)
	if t.count('1') == n or t.count('0') == n:
		return t
	return '10' * n
T = iint()
for _ in range(T):
	t = istr()
	print(solve(t))


t = int(input())
while t > 0:
	s = input()
	if len(set(s)) == 1:
		print(s)
	else:
		print('01' * len(s))
	t = t - 1


from sys import stdin
for _ in range(int(stdin.readline())):
	string = list(stdin.readline().strip())
	ans = ['10' * len(string)]
	flag = False
	for i in range(len(string) - 1):
		if string[i] != string[i + 1]:
			flag = True
	print(''.join(string if flag == False else ans))


from itertools import groupby

def read_int():
	return int(input().strip())

def read_ints():
	return list(map(int, input().strip().split(' ')))

def solve():
	t = input().strip()
	(has_zero, has_one) = (False, False)
	for c in t:
		if c == '0':
			has_zero = True
		else:
			has_one = True
	if not has_zero or not has_one:
		return t
	return ''.join(('01' for _ in range(len(t))))
T = read_int()
for _ in range(T):
	print(solve())


import sys
input = sys.stdin.readline

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

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

def insr():
	s = input()
	return s

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

def from_file(f):
	return f.readline

def solve(s):
	first = s[0]
	for i in range(1, len(s)):
		if s[i] != first:
			break
	else:
		return s
	if first == '1':
		return '10' * len(s)
	else:
		return '01' * len(s)
t = inp()
for _ in range(t):
	s = insr().strip()
	res = solve(s)
	print(res)


t = int(input())

def alsame(s):
	a = list(s)
	if len(list(set(a))) == 1:
		return True
	return False
for _ in range(t):
	s = input()
	if alsame(s):
		print(s)
	else:
		print('10' * len(s))


for t in range(int(input())):
	s = input()
	t = ''
	o = s.count('0')
	l = len(s) - o
	if l != 0 and o != 0:
		for i in range(len(s)):
			print('01', end='')
		print()
	elif l == 0:
		print('0' * len(s))
	else:
		print('1' * len(s))


for i in range(int(input())):
	s = input()
	tmp1 = s.count('1')
	tmp2 = s.count('0')
	if tmp1 == 0 or tmp2 == 0:
		print(s)
	elif len(s) == 2:
		print(s)
	else:
		s1 = '10' * len(s)
		print(s1)


t = int(input())
for i in range(t):
	t = [int(i) for i in input()]
	ans = []
	suma = sum(t)
	if suma == len(t) or suma == 0:
		print(''.join(map(str, t)))
	else:
		if t[0] == 1:
			ans.append(1)
			for i in range(2 * len(t) - 1):
				if i % 2 == 0:
					ans.append(0)
				else:
					ans.append(1)
			if t[-1] == 1:
				ans = ans[:len(ans) - 1]
		else:
			ans.append(0)
			for i in range(2 * len(t) - 1):
				if i % 2 == 0:
					ans.append(1)
				else:
					ans.append(0)
			if t[-1] == 0:
				ans = ans[:len(ans) - 1]
		print(''.join(map(str, ans)))


for _ in range(int(input())):
	t = input()
	print(t if len(set(t)) < 2 else '01' * len(t))


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

def lisdiv():
	return list(map(int, list(input())))
t = int(input())
for _ in range(t):
	lis = lisdiv()
	n = len(lis)
	if lis.count(0) == n or lis.count(1) == n:
		print(*lis, sep='')
	else:
		flag = lis[0]
		if flag == 0:
			print('01' * n)
		else:
			print('10' * n)


import os
import sys
from io import BytesIO, IOBase

def main():
	T = int(input())
	for _ in range(T):
		t = input()
		isEqual = True
		for i in range(len(t) - 1):
			if t[i] != t[i + 1]:
				isEqual = False
				break
		if isEqual:
			print(t)
		else:
			output = ''
			for i in range(len(t) - 1):
				if t[i] == t[i + 1]:
					output += t[i]
					if t[i] == '0':
						output += '1'
					else:
						output += '0'
				else:
					output += t[i]
			output += t[len(t) - 1]
			print(output)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = lambda s: self.buffer.write(s.encode()) if self.writable else None

	def read(self):
		if self.buffer.tell():
			return self.buffer.read().decode('ascii')
		return os.read(self._fd, os.fstat(self._fd).st_size).decode('ascii')

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline().decode('ascii')

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

def print(*args, sep=' ', end='\n', file=sys.stdout, flush=False):
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(end)
	if flush:
		file.flush()
(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
sys.setrecursionlimit(10000)
main()


from collections import Counter
t1 = int(input())
for _ in range(t1):
	t = input()
	x = Counter(t)
	if x['0'] and x['1']:
		ans = ['10'] * len(t)
		s = ''.join(ans)
		print(s)
	else:
		print(t)


t = int(input())
while t:
	t -= 1
	a = input()
	if a.count('1') == 0 or a.count('0') == 0:
		print(a)
	else:
		b = 2 * len(a)
		c = ''
		i = 1
		while i <= b:
			if i % 2 == 0:
				c = c + '0'
			else:
				c = c + '1'
			i += 1
		print(c)


for i in range(int(input())):
	t = input()
	if len(set(t)) == 1:
		print(t)
	else:
		print('01' * len(t))


t = int(input())

def periodical_string(s):
	if len(set(s)) == 1:
		return s
	num_zero = 0
	num_one = 0
	for letter in s:
		if letter == '0':
			num_zero += 1
		else:
			num_one += 1
	if s[0] == '0':
		period = '01'
	else:
		period = '10'
	return period * len(s)
for i in range(t):
	s = input()
	print(periodical_string(s))


t = int(input())
for i in range(t):
	newstring = ''
	x = set()
	k = input()
	b = len(k)
	for j in k:
		x.add(j)
	for i in x:
		newstring = newstring + i
	print(newstring * b)


t = int(input())
for tt in range(t):
	t = input()
	ans = ''
	if len(set(list(t))) == 1:
		ans = t
	else:
		n = len(t)
		ansl = []
		for i in range(n):
			ansl.append(t[i])
			if i < n - 1 and t[i + 1] == t[i]:
				ansl.append(str(int(t[i]) ^ 1))
		ans = ''.join(ansl)
	print(ans)


import math
import sys, collections
from sys import stdin, stdout

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_string():
	return sys.stdin.readline().strip()

def input():
	return sys.stdin.readline().strip()

def file():
	sys.stdin = open('input.py', 'r')
	sys.stdout = open('output.py', 'w')

def is_subsequence(x, y):
	x = list(x)
	for letter in y:
		if x and x[0] == letter:
			x.pop(0)
	return not x

def sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, mt.ceil(mt.sqrt(MAXN))):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def getFactorization(x):
	ret = list()
	while x != 1:
		ret.append(spf[x])
		x = x // spf[x]
	return ret

def getFloor(A, x):
	(left, right) = (0, len(A) - 1)
	(ind, floor) = (-1, -1)
	while left <= right:
		mid = (left + right) // 2
		if x < A[mid]:
			right = mid - 1
		else:
			floor = A[mid]
			ind = mid
			left = mid + 1
	return ind

def check(st):
	n = len(st)
	digitSum = 0
	for i in range(0, n):
		digitSum = digitSum + int(st[i])
	return digitSum % 9 == 0

def isPowerOfTwo(n):
	if n == 0:
		return False
	while n != 1:
		if n % 2 != 0:
			return False
		n = n // 2
	return True

def kitte(n):
	c = 0
	while n != 0:
		n = n // 2
		c += 1
	return c

def aa(b, c):
	m = min(b, c)
	b -= m
	c -= m
	if c > 0 and b > 0:
		return m + (b + c) // 3
	else:
		return m

def bb(a, c):
	m = min(a, c)
	a -= m
	c -= m
	if c > 0 and a > 0:
		return m + (a + c) // 3
	else:
		return m

def cc(b, a):
	m = min(b, a)
	b -= m
	a -= m
	if a > 0 and b > 0:
		return m + (b + a) // 3
	else:
		return m
mod = 10 ** 9 + 7

def main():
	for tt in range(int(input())):
		s = list(input())
		n = len(s)
		if len(set(s)) == 1:
			print(''.join(s))
		else:
			print('10' * n)
main()


t = int(input())
for tt in range(t):
	s = input()
	if s == '0' * len(s):
		print(s)
	elif s == '1' * len(s):
		print(s)
	else:
		print('10' * len(s))


import os
import sys
from io import BytesIO, IOBase

def iin():
	return int(input())

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

def main():
	T = iin()
	for _ in range(T):
		t = input()
		st = set(t)
		if len(st) == 1:
			print(t)
		else:
			n = len(t)
			print('01' * n)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


for i in range(int(input())):
	x = input()
	if len(set(x)) == 1:
		print(x)
	else:
		l = [x[0]]
		la = x[0]
		for i in range(1, len(x)):
			if x[i] != la:
				l.append(x[i])
			elif x[i] == '0':
				l.append('1')
				l.append(x[i])
			else:
				l.append('0')
				l.append(x[i])
			la = x[i]
		print(''.join(l))


import sys
from collections import *
from bisect import *
input = sys.stdin.readline
t = int(input())
while t:
	t -= 1
	a = input().rstrip()
	if a.count('1') == len(a):
		print(a)
		continue
	elif a.count('0') == len(a):
		print(a)
		continue
	z = max(a.count('1'), a.count('0'))
	for i in range(len(a)):
		print('10', end='')
	print()


tc = int(input())
ans = []
for _ in range(tc):
	t = input()
	if '1' not in t:
		ans.append('0' * len(t))
	elif '0' not in t:
		ans.append('1' * len(t))
	else:
		ans.append('01' * len(t))
for i in ans:
	print(i)


test = int(input())
for i in range(test):
	t = input()
	ans = ''
	if len(t) <= 2:
		ans = t
	else:
		if '0' not in t or '1' not in t:
			ans = t
		else:
			for i in range(len(t) - 1):
				if t[i] == t[i + 1]:
					ans += t[i] + ('0' if t[i] == '1' else '1')
				else:
					ans += t[i]
		ans += t[len(t) - 1]
	print(ans)


def ans(s):
	o = 0
	z = 0
	s2 = ''
	for i in range(0, len(s), 1):
		s2 += '01'
		if s[i] == '1':
			o += 1
		if s[i] == '0':
			z += 1
	if o == len(s) or z == len(s):
		print(s)
	else:
		print(s2[1:len(s2)])
t = int(input())
while t > 0:
	s = str(input())
	if len(s) > 2:
		ans(s)
	else:
		print(s)
	t -= 1


n = int(input())
for i in range(n):
	t = input()
	if '0' not in t or '1' not in t:
		print(t)
	else:
		res = ''
		for i in range(len(t) - 1):
			if t[i] == t[i + 1]:
				if t[i] == '0':
					res += '01'
				else:
					res += '10'
			else:
				res += t[i]
		res += t[-1]
		print(res)


a = int(input())

def oppo(s):
	if s == '0':
		return '1'
	else:
		return '0'
for i in range(0, a):
	s = input()
	ans = ''
	booll = False
	for i in range(0, len(s) - 1):
		if not s[i] == s[i + 1]:
			booll = True
			break
	for i in range(0, len(s)):
		ans = ans + s[i]
		if i < len(s) - 1 and s[i] == s[i + 1]:
			ans = ans + oppo(s[i])
	if booll == False:
		print(s)
	else:
		print(ans)


T = int(input())
while T > 0:
	T -= 1
	t = input()
	if len(t) == 1 or len(t) == 2:
		print(t)
	elif t.count(t[0]) == len(t):
		print(t)
	else:
		s = '10' * len(t)
		print(s)


for i in range(int(input())):
	t = input()
	n = len(t)
	if len(set(t)) == 1:
		print(t)
	else:
		s = '10' * n
		print(s)


t = int(input())
for _ in range(t):
	s = input()
	n = len(s)
	(zero, one) = (False, False)
	if '0' in s:
		zero = True
	if '1' in s:
		one = True
	if one and zero:
		for i in range(n):
			print('10', end='')
		print()
	else:
		for i in range(n):
			print(s[0], end='')
		print()


from math import inf, sqrt, floor, ceil
from collections import Counter, defaultdict, deque
from heapq import heappush as hpush, heappop as hpop, heapify as h
from operator import itemgetter
from itertools import product
from bisect import bisect_left, bisect_right

def period2(s):
	p = 2
	for i in range(len(s) - 2):
		if s[i] != s[i + p]:
			return 0
	return 1
for _ in range(int(input())):
	s = input()
	if s.count('1') == len(s) or s.count('0') == len(s):
		print(s)
	elif period2(s):
		print(s)
	else:
		print('10' * len(s))


from sys import stdin
input = stdin.readline

def main():
	test = int(input())
	for t in range(test):
		s = input()
		zero = s.count('0')
		one = s.count('1')
		if zero == 0 or one == 0:
			print(s)
		else:
			ans = ''
			i = 0
			flag = True
			while i < len(s) - 1:
				if flag:
					ans += s[i]
				if s[i] == s[i + 1]:
					if s[i] == '1':
						ans += '0'
					else:
						ans += '1'
					flag = True
				else:
					ans += s[i + 1]
					flag = False
				i += 1
			if flag:
				ans += s[-1]
			print(ans)
main()


for _ in range(int(input())):
	s = input()
	x = set(s)
	count = 0
	for i in x:
		count += 1
	if count == 1:
		print(s)
	elif s[0] == '0':
		print('01' * len(s))
	else:
		print('10' * len(s))


rw = int(input())
for ewqr in range(rw):
	t = input()
	if t.count('1') == 0 or t.count('0') == 0:
		print(t)
		continue
	s = '01' * len(t)
	print(s)


for t in range(int(input())):
	s = input()
	s1 = set(s)
	if s1 == {'0'} or s1 == {'1'}:
		print(s)
	else:
		a = []
		for i in range(len(s)):
			a.append('0')
			a.append('1')
		print(''.join(a))


q = int(input())
for _ in range(q):
	t = input()
	if t.count('1') == 0:
		print(len(t) * '0')
		continue
	if t.count('0') == 0:
		print(len(t) * '1')
		continue
	print(len(t) * '01')


n = int(input())
for i in range(n):
	c = input()
	if '0' in c and '1' in c:
		print('01' * len(c))
	else:
		print(c)


t = int(input())
for _ in range(t):
	nn = input()
	if len(nn) <= 2:
		print(nn)
	elif int(nn) == 0 or int(nn) == int('1' * len(nn)):
		print(nn)
	elif nn[0] == '0':
		print('01' * len(nn))
	else:
		print('10' * len(nn))


t = int(input())
l = []
for i in range(t):
	s = input()
	l.append(s)
for j in l:
	if len(set(j)) == 1:
		print(''.join(j))
	else:
		print('01' * len(j))


for t in range(int(input())):
	s = input()
	n = len(s)
	if n == 1:
		print(s * 2)
	elif n == 2:
		print(s)
	elif s == '0' * n or s == '1' * n:
		print(s)
	else:
		i = 0
		while i < n - 1:
			if s[i] == s[i + 1]:
				if s[i] == '0':
					s = s[:i + 1] + '1' + s[i + 1:]
				else:
					s = s[:i + 1] + '0' + s[i + 1:]
				n = len(s)
				i += 2
			else:
				i += 1
		print(s)


import sys

def main():
	s = list(input())
	if len(set(s)) == 1:
		return ''.join(s)
	else:
		ln = len(s)
		if s[0] == '0':
			k = '01' * ln
		else:
			k = '10' * ln
		return k
t = int(input())
while t:
	t -= 1
	print(main())


n = int(input())
for i in range(n):
	l = input()
	if l.count('0') == 0 or l.count('1') == 0:
		print(l)
	else:
		s = '10'
		for i in range(len(l)):
			print(s, end='')
		print()


for i in range(int(input())):
	t = str(input())
	l = len(t)
	a1 = []
	a2 = []
	s = [-1] * (2 * l)
	if t.count('1') == l:
		print(t)
	elif t.count('0') == l:
		print(t)
	else:
		print('10' * l)


t = int(input())
for tt in range(t):
	s = input()
	if s.count('0') == len(s) or s.count('1') == len(s):
		print(s)
	else:
		if s[0] == '0':
			sol = '01' * len(s)
		else:
			sol = '10' * len(s)
		print(sol)


t = int(input())
for i in range(t):
	s = input()
	z = s.count('0')
	o = s.count('1')
	if len(s) == z or len(s) == o:
		print(s)
	else:
		l = len(s)
		li = list(s)
		for j in range(1, 2 * l):
			if j < len(li) and li[j] == li[j - 1] and (li[j] == '0'):
				li.insert(j, '1')
				j = j + 1
			if j < len(li) and li[j] == li[j - 1] and (li[j] == '1'):
				li.insert(j, '0')
				j = j + 1
		s1 = ''
		s1 = s1.join(li)
		print(s1)


from sys import stdin, stdout
t = int(stdin.readline().strip())
for caso in range(t):
	s = stdin.readline().strip()
	zer = s.count('0')
	if zer == 0 or zer == len(s):
		print(s)
		continue
	print('10' * len(s))


t = int(input())
for _ in range(t):
	s = input()
	n = len(s)
	if '0' not in s:
		print('1' * n)
	elif '1' not in s:
		print('0' * n)
	else:
		print('10' * n)


import math
import collections
from sys import *
T = int(stdin.readline())
for _ in range(T):
	t = stdin.readline().strip('\n')
	n = len(t)
	a0 = t[0]
	res = True
	for i in range(n):
		if t[i] != a0:
			res = False
			break
	if res:
		print(t)
		continue
	if n == 2:
		print(t)
		continue
	s = ''
	for i in range(2 * n):
		if i % 2 == 0:
			s = s + '1'
		else:
			s = s + '0'
	print(s)


for _ in range(int(input())):
	x = input()
	t = 0
	for i in range(1, len(x)):
		if x[i] != x[i - 1]:
			t = 1
			break
	if t == 1:
		n = len(x)
		print('01' * n)
	else:
		print(x)


cases = int(input())
for i in range(cases):
	t = list(input())
	if len(set(t)) == 1:
		print(''.join(t))
	else:
		t = [int(q) for q in t]
		n = []
		for j in range(len(t) - 1):
			if t[j] == t[j + 1]:
				n.append(t[j])
				n.append(1 - t[j])
			else:
				n.append(t[j])
		n.append(t[len(t) - 1])
		st = ''
		for j in n:
			st += str(j)
		print(st)


import sys
input = sys.stdin.readline
Q = int(input())
Query = []
for _ in range(Q):
	S = input().rstrip()
	Query.append(S)
for S in Query:
	is1 = '1' in S
	is0 = '0' in S
	if not is1 or not is0:
		print(S)
	else:
		T = ''
		for s in S:
			if T and T[-1] == s:
				T += str(int(s) ^ 1)
			T += s
		print(T)


z = int(input())
while z:
	f = input()
	if len(f) < 3:
		print(f)
	elif len(set(list(f))) == 1:
		print(f)
	else:
		for i in range(len(f) - 1):
			print(f[i], end='')
			if f[i] == f[i + 1] and f[i] == '1':
				print('0', end='')
			elif f[i] == f[i + 1] and f[i] == '0':
				print('1', end='')
		print(f[-1])
	z -= 1


for _ in range(int(input())):
	t = input()
	if len(t) == 1 or len(t) == 2:
		print(t)
	elif len(set(t)) == 1:
		print(t)
	else:
		s = [t[0]]
		for i in range(1, len(t)):
			if t[i] != s[-1]:
				s.append(t[i])
			elif s[-1] == '0':
				s.extend(['1', '0'])
			else:
				s.extend(['0', '1'])
		string = ''.join(s)
		print(string)


for _ in range(int(input())):
	s = input()
	f1 = 0
	f0 = 0
	for i in s:
		if i == '0':
			f0 = 1
		else:
			f1 = 1
	if f1 == 1 and f0 == 1:
		for i in range(1, 2 * len(s) + 1):
			if i % 2 == 0:
				print('0', end='')
			else:
				print('1', end='')
		print('')
	elif f1 == 1 and f0 == 0:
		print('1' * 2 * len(s))
	else:
		print('0' * 2 * len(s))


for _ in range(int(input())):
	S = input()
	Len = len(S)
	One = S.count('1')
	Zero = S.count('0')
	if One == Len or Zero == Len:
		print(S)
	else:
		Ans = ''
		a = S[0]
		b = str(1 - int(S[0]))
		Ans += a
		Ans += b
		for i in range(1, Len):
			Ans += a
			Ans += b
		print(Ans)


T = int(input())
for _ in range(T):
	X = input()
	if '0' in X and '1' not in X:
		print(X)
		continue
	elif '1' in X and '0' not in X:
		print(X)
		continue
	N = len(X)
	S = X[0]
	for i in range(1, N):
		if S[-1] != X[i]:
			S += X[i]
		else:
			S += str(1 - int(S[-1])) + X[i]
	print(S)


for testcase in range(int(input())):
	s = input()
	one = '1' in s
	zero = '0' in s
	if one and (not zero) or (zero and (not one)):
		print(s * 2)
	else:
		print('01' * len(s))


t = int(input())
for i in range(t):
	ch = input()
	if ch.count('0') == 0 or ch.count('1') == 0:
		print(ch)
	else:
		s = '10' * len(ch)
		print(s)


import sys
input = sys.stdin.readline
from collections import Counter

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 print_list_int(l):
	print(''.join(map(str, map(int, l))))
t = inp()
for test in range(t):
	s = insr()
	counts = Counter(s)
	if counts['0'] < 1 or counts['1'] < 1:
		print(''.join(s))
	else:
		ans = []
		ans.append(s[0])
		for l in s[1:]:
			if l == ans[-1]:
				ans.append(str(1 - int(l)))
				ans.append(l)
			else:
				ans.append(l)
		print(''.join(ans))


for _ in range(int(input())):
	s = input()
	n = len(s)
	if len(set(s)) == 1:
		print(s)
		continue
	if s[0] == '1':
		ns = '10' * n
	else:
		ns = '01' * n
	print(ns)


t = int(input())
for tc in range(t):
	s = input()
	length = len(s)
	zero = False
	one = False
	for i in range(length):
		if s[i] == '0':
			zero = True
		else:
			one = True
	if one and zero:
		for i in range(length):
			print('01', end='')
		print()
	else:
		print(s)


for _ in range(int(input())):
	s = input()
	sl = len(set(s))
	if sl == 1:
		print(s)
	else:
		ans = ''
		for i in range(len(s)):
			if s[i] == '0':
				ans += s[i] + '1'
			else:
				ans += '0' + s[i]
		print(ans)


for _ in range(int(input())):
	s = input()
	a = s.count('0')
	b = s.count('1')
	ans = ''
	f = 1
	if a == 0:
		print('1' * b)
		f = 0
	if b == 0:
		print('0' * a)
		f = 0
	if f:
		print('10' * len(s))


I = input
t = int(I())
for _ in range(t):
	t = list(I())
	if t.count(t[0]) == len(t):
		print(*t, sep='')
		continue
	if t[0] == '1':
		t.insert(0, '0')
	i = 0
	while i < len(t) - 1:
		if t[i] == '1' and t[i - 1] == '1':
			t.insert(i, '0')
			i += 1
		elif t[i] == '0' and t[i + 1] == '0':
			t.insert(i + 1, '1')
			i += 1
		i += 1
	if t[-1] == '1' and t[-2] == '1':
		t.insert(-1, '0')
	print(*t, sep='')


def main():
	t = int(input())
	for i in range(t):
		sub = input()
		if all([x == '0' for x in sub]):
			print(sub)
			continue
		if all([x == '1' for x in sub]):
			print(sub)
			continue
		result = ''
		for i in range(len(sub) - 1):
			if sub[i] == sub[i + 1]:
				result += sub[i] + inverse(sub[i])
			else:
				result += sub[i]
		result += inverse(result[-1])
		print(result)

def inverse(t):
	if t == '0':
		return '1'
	else:
		return '0'
main()


def generate(s, l):
	i = 0
	while len(s) < 2 * l:
		s.append(s[i])
		i += 1
	return s

def subsequence(s1, s):
	j = 0
	flag = 1
	for i in range(0, len(s)):
		while j < len(s1) and s1[j] != s[i]:
			j += 1
		if j >= len(s1) and s1[j - 1] != s[i]:
			flag = 0
	return flag
t = int(input())
for _ in range(0, t):
	s = list(input())
	flag = 1
	for i in range(len(s) - 1):
		if s[i] != s[i + 1]:
			flag = 0
			break
	if flag:
		print(''.join(s))
	else:
		for k in range(2, len(s) + 1):
			s1 = ['1', '0']
			s2 = ['0', '1']
			s1 = generate(s1, len(s))
			s2 = generate(s2, len(s))
			if subsequence(s1, s):
				print(''.join(s1))
				break
			elif subsequence(s2, s):
				print(''.join(s1))
				break


t = int(input())
lista = []
for i in range(t):
	myBool = True
	string = str(input())
	for i in range(0, len(string) - 1):
		if string[i] != string[i + 1]:
			myBool = False
			break
	if myBool == True:
		lista.append(string)
		continue
	elif len(string) == 2:
		lista.append(string)
		continue
	else:
		out = ''
		for i in range(len(string) - 1):
			if string[i] == string[i + 1]:
				if string[i] == '0':
					out += string[i] + str(1)
				else:
					out += string[i] + str(0)
			else:
				out += string[i]
		out += string[-1]
		lista.append(out)
for i in lista:
	print(i)


n = int(input())
for i in range(n):
	s = str(input())
	c = set(s)
	if len(c) == 1:
		print(s)
	else:
		d = s.count('1')
		e = s.count('0')
		f = s[0]
		for i in range(0, len(s) - 1):
			if s[i] == s[i + 1] and s[i] == '0':
				f = f + '1' + s[i + 1]
			elif s[i] == s[i + 1] and s[i] == '1':
				f = f + '0' + s[i + 1]
			else:
				f = f + s[i + 1]
		print(f)


q = int(input())
for i in range(q):
	s = input()
	cnt0 = 0
	cnt1 = 0
	for i in s:
		if i == '1':
			cnt1 += 1
		elif i == '0':
			cnt0 += 1
	if cnt0 == 0 or cnt1 == 0:
		print(s)
	elif s[0] == '1':
		e = '10'
		d = e * (cnt1 + cnt0)
		print(d)
	else:
		e = '01'
		d = e * (cnt1 + cnt0)
		print(d)


for i in range(int(input())):
	t = input()
	z = t.count('0')
	o = t.count('1')
	if z == 0 or o == 0:
		print(t)
		continue
	s = t[0]
	for i in range(1, len(t)):
		if t[i] == t[i - 1] == '1':
			s += '0'
		elif t[i] == t[i - 1] == '0':
			s += '1'
		s += t[i]
	print(s)


a = int(input())
for _ in range(a):
	t = input()
	c0 = 0
	c1 = 0
	for ch in t:
		if ch == '0':
			c0 += 1
		else:
			c1 += 1
	if c0 == 0:
		output = '1' * c1
	elif c1 == 0:
		output = '0' * c0
	else:
		output = '1' if t[0] == '1' else '0'
		for i in range(1, len(t)):
			if t[i] == '1':
				output += '1' if t[i - 1] == '0' else '01'
			else:
				output += '0' if t[i - 1] == '1' else '10'
	print(output)


t = int(input())
for _ in range(t):
	a = input()
	n = len(a)
	zero = a.count('0')
	one = a.count('1')
	if zero == n or one == n:
		print(a)
	elif a[0] == '0':
		print('01' * n)
	else:
		print('10' * n)


t = int(input())
for _ in range(t):
	t = input()
	arr = list(t)
	n = len(arr)
	ones = 0
	zeros = 0
	for i in arr:
		if i == '1':
			ones += 1
		else:
			zeros += 1
	ans = []
	if ones != n or zeros != n:
		for i in range(n):
			ans.append(1)
			ans.append(0)
	if ones == n or zeros == n:
		print(t)
	else:
		for i in ans:
			print(i, end='')
		print()


from __future__ import division, print_function
import os, sys
import collections
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().strip().split(' '))

def msi():
	return map(str, input().strip().split(' '))

def li():
	return list(mi())

def dmain():
	sys.setrecursionlimit(100000000)
	threading.stack_size(40960000)
	thread = threading.Thread(target=main)
	thread.start()
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def getKey(item):
	return item[1]

def sort2(l):
	return sorted(l, key=getKey, reverse=True)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def ntl(n):
	return [int(i) for i in str(n)]

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(n - r))

def ceil(x, y):
	if x % y == 0:
		return x // y
	else:
		return x // y + 1

def powerMod(x, y, p):
	res = 1
	x %= p
	while y > 0:
		if y & 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def read():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def padded_bin_with_complement(x):
	if x < 0:
		return bin(2 ** 16 - abs(x))[2:].zfill(16)
	else:
		return bin(x)[2:].zfill(16)

def binaryToDecimal(binary):
	binary1 = binary
	(decimal, i, n) = (0, 0, 0)
	while binary != 0:
		dec = binary % 10
		decimal = decimal + dec * pow(2, i)
		binary = binary // 10
		i += 1
	print(decimal)

def CountFrequency(arr):
	return collections.Counter(arr)

def main():
	for _ in range(ii()):
		a = si()
		a = list(a)
		n = len(a)
		z = 0
		o = 0
		for i in range(n):
			a[i] = int(a[i])
		for i in range(n):
			if a[i] == 1:
				o += 1
			else:
				z += 1
		if o > 0 and z > 0:
			if a[0] == 1:
				print('10' * n)
			else:
				print('01' * n)
		elif z > 0:
			print('0' * (2 * n))
		else:
			print('1' * (2 * n))
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


import sys
input = sys.stdin.readline
from collections import *
T = int(input())
for _ in range(T):
	t = input()[:-1]
	if t in ['0' * len(t), '1' * len(t)]:
		print(t)
	else:
		print('01' * len(t))


for _ in range(int(input())):
	t = input()
	if len(t) <= 2:
		print(t)
	else:
		flag = 0
		for i in range(1, len(t)):
			if t[i] != t[i - 1]:
				flag = 1
				break
		if flag == 0:
			print(t)
		else:
			ans = []
			ans.append(t[0])
			t = list(t)
			for i in range(1, len(t)):
				if t[i] == t[i - 1]:
					if t[i] == '0':
						ans.append('1')
					else:
						ans.append('0')
				ans.append(t[i])
			s = ''.join((a for a in ans))
			print(s)


ii = lambda : int(input())
si = lambda : input()
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
for _ in range(ii()):
	a = si()
	b = list(a)
	c = b.count('1')
	d = b.count('0')
	k = []
	if len(a) <= 2:
		print(a)
	elif b.count('1') == 0 or b.count('0') == 0:
		print(a * 2)
	elif a[0] == '1':
		for i in range(0, 2 * len(a)):
			if i % 2 == 0:
				k.append('1')
			else:
				k.append('0')
		print(''.join(k))
	elif a[0] == '0':
		for i in range(0, 2 * len(a)):
			if i % 2 == 0:
				k.append('0')
			else:
				k.append('1')
		print(''.join(k))


for _ in range(int(input())):
	s = input()
	n = len(s)
	if s.count('0') == n or s.count('1') == n:
		print(s)
	else:
		ns = ''
		for i in range(n):
			ns += '10'
		print(ns)


for t in range(int(input())):
	s = input()
	a = s.count('0')
	b = s.count('1')
	if a == 0 or b == 0:
		print(s)
	else:
		r = ''
		i = 0
		n = len(s)
		while i < n:
			if i == 0:
				r = r + s[i]
			elif s[i] == s[i - 1]:
				if s[i] == '1':
					r = r + '01'
				else:
					r = r + '10'
			else:
				r = r + s[i]
			i += 1
		print(r)


t = int(input())
for _ in range(t):
	s = [int(i) for i in input()]
	dist = [0] * 2
	n = len(s)
	for i in s:
		dist[i] = 1
	if sum(dist) == 1:
		if dist[0] == 1:
			ans = ['0'] * n
		else:
			ans = ['1'] * n
	elif s[0] == 0:
		ans = ['01'] * n
	else:
		ans = ['10'] * n
	print(''.join(ans))


T = int(input())
while T != 0:
	num = input()
	if num == len(num) * num[0] or len(num) == 2:
		same = True
	else:
		same = False
	if same:
		print(num)
	else:
		ans = ''
		for i in num:
			ans += '10'
		print(ans)
	T -= 1


import sys
t = int(input())
for test in range(t):
	ls = list(map(int, input()))
	ans = []
	if 1 not in ls:
		ans = ls[:]
	elif 0 not in ls:
		ans = ls[:]
	else:
		for i in range(len(ls)):
			ans.append(0)
			ans.append(1)
	strans = ''
	for i in ans:
		strans += str(i)
	print(strans.lstrip())


from sys import stdin

def inp():
	return stdin.buffer.readline().rstrip().decode('utf8')

def itg():
	return int(stdin.buffer.readline())

def mpint():
	return map(int, stdin.buffer.readline().split())

def solve():
	t = inp()
	if len(t) <= 2 or len(set(t)) == 1:
		return t
	ans = [t[0]]
	i = 1
	while i < len(t):
		if ans[-1] == '0':
			ans.append('1')
		else:
			ans.append('0')
		if ans[-1] == t[i]:
			i += 1
	return ''.join(ans)
for case in range(itg()):
	print(solve())


t = int(input())
for _ in range(t):
	s = input()
	if not s.count('0') or not s.count('1'):
		print(s)
		continue
	if s[0] == '0':
		print('01' * len(s))
	else:
		print('10' * len(s))


for _ in range(int(input())):
	s = input()
	tem = s.count('1')
	l = len(s)
	if tem == 0 or tem == l or l == 2:
		print(s)
	else:
		ans = ''
		s += 'p'
		curr = 0
		for i in range(l):
			if s[i] == s[i + 1]:
				ans += s[i] + str(1 - int(s[i]))
			else:
				ans += s[i]
		print(ans)


t = int(input())
for g in range(t):
	s = input()
	l = len(s)
	if len(set(s)) == 1:
		print(s)
		continue
	if len(s) == 2:
		print(s)
		continue
	for i in range(l):
		s = '10' * l
	print(s)


for _ in range(int(input())):
	t = input()
	if '0' not in list(t) or '1' not in list(t):
		print(t)
		continue
	s = [t[0]]
	j = 0
	for i in range(1, len(t)):
		if t[i] == s[j]:
			s.append('0' if t[i] == '1' else '1')
			j += 1
		s.append(t[i])
		j += 1
	print(''.join(s))


t = int(input())
for u in range(t):
	s = list(input())
	deff = 0
	for i in range(1, len(s)):
		if s[i] != s[i - 1]:
			deff = 1
	if deff == 0:
		print(''.join(s))
	else:
		print('10' * len(s))


n = int(input())
for _ in range(n):
	s = input()
	p = len(s)
	if all((c == s[0] for c in s)):
		print(s)
	else:
		print('01' * p)


for __ in range(int(input())):
	t = input()
	if len(set(list(t))) == 1:
		print(t)
	else:
		print('01' * len(t))


from sys import stdin
from itertools import groupby

def inp():
	return stdin.readline().strip()
t = int(inp())
for _ in range(t):
	s = inp()
	ar = [int(x) for x in s]
	cur = ar[0]
	same = True
	cons = 0
	for i in range(len(ar)):
		if ar[i] != cur:
			same = False
		if ar[i] == ar[i - 1] and i > 0:
			cons += 1
	if same:
		print(s)
	elif cons == 0:
		print(s)
	else:
		for i in range(len(ar) + cons):
			if i % 2 == 0:
				print(ar[0], end='')
			else:
				print(1 - ar[0], end='')
		print('')


from sys import stdin, stdout
for _ in range(int(stdin.readline())):
	s = input()
	n = len(s)
	if '1' not in s or '0' not in s:
		print(s)
		continue
	s1 = '10' if s[0] == '1' else '01'
	for i in range(n):
		stdout.write(s1)
	print()


t = int(input())
i = 0
while i < t:
	s = input()
	s = [x for x in s]
	if '0' in s and '1' in s and (s[0] == '1'):
		print(*[1, 0] * len(s), sep='')
	elif '0' in s and '1' in s and (s[0] == '0'):
		print(*[0, 1] * len(s), sep='')
	elif '0' in s:
		print(*[0] * len(s), sep='')
	else:
		print(*[1] * len(s), sep='')
	i += 1


t = int(input())
arr = []
for i in range(t):
	arr.append(input())
res = []
for i in range(t):
	p = len(arr[i])
	if p < 3 or arr[i].count('1') == p or arr[i].count('0') == p:
		res.append(arr[i])
	else:
		p -= 1
		if arr[i][0] == '0':
			res.append('01' * p)
		else:
			res.append('10' * p)
for i in res:
	print(i)


import sys
T = int(input())
for _ in range(T):
	t = input()
	p = [t[0]]
	z = 0
	o = 0
	for i in range(1, len(t)):
		if t[i] != p[-1]:
			p.append(t[i])
			break
	period = ''.join(p)
	for i in range(len(t)):
		if t[i] == '0':
			z += 1
		elif t[i] == '1':
			o += 1
	res = period * (2 * len(t) // len(period))
	print(res)


T = int(input())
for _ in range(T):
	ar = []
	i = 0
	j = 0
	t = input('')
	n = len(t)
	if t.count('0') == 0 or t.count('1') == 0:
		print(t)
	else:
		print('10' * n)


from sys import *
input = stdin.readline
for _ in range(int(input())):
	t = input()
	st = set()
	ch = 0
	for i in t:
		st.add(i)
	if len(st) > 2:
		ch = 1
	s = ''
	if ch == 1:
		s = '01' * (len(t) - 1)
		stdout.write(s + '\n')
	else:
		stdout.write(t)


for _ in range(int(input())):
	s = input()
	if len(s) <= 2 or len(list(set(s))) == 1:
		print(s)
	else:
		s = list(s)
		i = 1
		while i != len(s):
			if s[i] == s[i - 1]:
				if s[i] == '1':
					s.insert(i, '0')
				else:
					s.insert(i, '1')
				i += 2
			else:
				i += 1
		print(''.join(s))


class inp:

	@staticmethod
	def int():
		return int(input())

def main():
	t = inp.int()
	for _ in range(t):
		s = input()
		n = len(s)
		ans = []
		if s == '0' * n or s == '1' * n:
			print(s)
			continue
		for i in range(len(s)):
			if i < n - 1 and s[i + 1] != s[i]:
				ans.append(s[i])
			elif i == n - 1:
				ans.append(s[i])
				if len(ans) % 2 == 1:
					ans.append('0' if ans[-1] == '1' else '1')
			else:
				ans.append(s[i])
				ans.append('0' if s[i] == '1' else '1')
		print(''.join(ans))
main()


t = int(input())
for asdasd in range(t):
	string = str(input())
	temp = string[0]
	period = 1
	for i in range(len(string)):
		if string[i] != temp:
			period = 2
			break
	if period == 1:
		print(string)
		continue
	ans = ''
	for i in range(len(string) - 1):
		if string[i] == string[i + 1]:
			if string[i] == '0':
				ans += string[i]
				ans += '1'
			else:
				ans += string[i]
				ans += '0'
		else:
			ans += string[i]
	ans += string[-1]
	print(ans)


t = int(input())
for _ in range(t):
	s = input()
	one = False
	zero = False
	for i in s:
		if i == '1':
			one = True
		else:
			zero = True
	if one and zero:
		curr = s[0]
		ans = curr
		for i in range(1, len(s)):
			if s[i] == curr:
				if s[i] == '1':
					ans += '0'
				else:
					ans += '1'
				ans += s[i]
			else:
				ans += s[i]
			curr = s[i]
		print(ans)
	else:
		print(s)


t = int(input())
for j in range(t):
	n = input()
	l = len(n)
	if l == 1:
		print(n)
		continue
	one = 0
	zero = 0
	for i in n:
		if i == '0':
			zero += 1
		else:
			one += 1
		if zero != 0 and one != 0:
			break
	if zero == 0:
		print(n)
		continue
	if one == 0:
		print(n)
		continue
	ans = n[0]
	prev = n[0]
	for i in range(1, l):
		if prev == n[i]:
			if prev == '0':
				ans += '1'
			else:
				ans += '0'
		ans += n[i]
		prev = n[i]
	print(ans)


from collections import Counter
import itertools
from functools import lru_cache
import sys
import math

def helper():
	pass

def solve():
	s = input()
	count = Counter(list(s))
	if count['1'] == 0 or count['0'] == 0:
		print(s)
		return
	else:
		ans = ''
		for i in range(len(s)):
			if i == 0:
				ans += s[i]
			elif s[i] == '0' and ans[-1] == '1':
				ans += s[i]
			elif s[i] == '0' and ans[-1] == '0':
				ans += '1' + s[i]
			elif s[i] == '1' and ans[-1] == '0':
				ans += s[i]
			else:
				ans += '0' + s[i]
		if len(ans) % 2 != 0:
			if ans[-1] == '0':
				ans += '1'
			else:
				ans += '0'
		print(ans)
		return
t = int(input())
for _ in range(t):
	solve()


test = int(input())
for _ in range(test):
	s = input()
	count = s.count('1') and s.count('0')
	if count:
		print(len(s) * '10')
	else:
		print(s)


t = int(input())
while t > 0:
	t = t - 1
	a = str(input())
	n0 = a.count('0')
	n1 = a.count('1')
	if n0 == 0 or n1 == 0:
		print(a)
	elif n0 > n1:
		print('01' * (len(a) - 1) + '0')
	else:
		print('10' * (len(a) - 1) + '1')


n = int(input())
for i in range(n):
	s = input()
	if len(set(list(s))) == 1:
		print(s)
	else:
		print('01' * len(s))


T = int(input())
for _ in range(T):
	t = str(input())
	n = len(t)
	a = 0
	b = 0
	for i in range(n):
		if t[i] == '0':
			a += 1
		else:
			b += 1
	if a == 0:
		print('1' * b)
		continue
	elif b == 0:
		print('0' * a)
	else:
		if t[0] == '0':
			ans = '01' * n
		else:
			ans = '10' * n
		print(ans)


t = int(input())
for i in range(0, t):
	s = input()
	p = 0
	if len(s) == 1:
		print(s)
	else:
		for i in range(1, len(s)):
			if s[0] == s[i]:
				continue
			else:
				p = 1
				break
		if p == 0:
			print(s)
		else:
			ans = []
			i = 0
			for i in range(0, len(s) - 1):
				if s[i] != s[i + 1]:
					ans.append(s[i])
				elif s[i] == s[i + 1] == '0':
					ans.append(s[i])
					ans.append('1')
				elif s[i] == s[i + 1] == '1':
					ans.append(s[i])
					ans.append('0')
			ans.append(s[len(s) - 1])
			for i in range(0, len(ans)):
				print(ans[i], end='')
			print('')


T = int(input())
for _ in range(T):
	line = input()
	first = line[0]
	all_equal = True
	for char in line:
		if char != first:
			all_equal = False
			break
	if all_equal:
		print(line)
	else:
		l = len(line)
		s = [0, 1] * l
		print(''.join([str(c) for c in s]))


t = input()
t = int(t)
for i in range(t):
	s = input()
	s = str(s)
	z = int(s.count('0'))
	o = int(s.count('1'))
	ans = ''
	if z == 0 or o == 0:
		ans = ans + s
	else:
		ans1 = '01'
		for k in range(len(s)):
			ans = ans + ans1
	print(ans)


from sys import stdin, setrecursionlimit, stdout
from collections import deque
from math import sqrt, floor, ceil, log, log2, log10, pi, gcd, sin, cos, asin

def ii():
	return int(stdin.readline())

def fi():
	return float(stdin.readline())

def mi():
	return map(int, stdin.readline().split())

def fmi():
	return map(float, stdin.readline().split())

def li():
	return list(mi())

def lsi():
	x = list(stdin.readline())
	x.pop()
	return x

def si():
	return stdin.readline().rstrip()
res = ['YES', 'NO']
test_case = ii()
while test_case:
	test_case -= 1
	a = lsi()
	n = len(a)
	z = '0' in a
	o = '1' in a
	if not z or not o:
		print(*a, sep='')
	else:
		ans = []
		for i in range(n - 1):
			ans.append(a[i])
			if a[i] == a[i + 1]:
				if a[i] == '1':
					ans.append('0')
				else:
					ans.append('1')
		ans.append(a[-1])
		print(*ans, sep='')


def checker(s):
	z = 0
	for i in range(0, len(s) - 1):
		if s[i] == s[i + 1]:
			continue
		else:
			z = 1
			break
	return z
t = int(input())
for i in range(0, t):
	s = input()
	z = checker(s)
	if z == 0:
		print(s)
	else:
		if s[0] == '0':
			for j in range(0, len(s)):
				print('01', end='')
		else:
			for j in range(0, len(s)):
				print('10', end='')
		print()


porn_collection = int(input())
for _ in range(porn_collection):
	a = input()
	t = ''
	if '0' not in a:
		print(a)
		continue
	if '1' not in a:
		print(a)
		continue
	t += a[0]
	for i in range(1, len(a)):
		if a[i - 1] == '0' and a[i] != '1':
			t += '1'
			t += a[i]
		elif a[i - 1] == '1' and a[i] != '0':
			t += '0'
			t += a[i]
		else:
			t += a[i]
	print(t)


def ulta(x):
	if x == '1':
		return '0'
	return '1'
for _ in range(int(input())):
	ss = input().strip()
	zer = ss.count('0')
	one = ss.count('1')
	if zer == 0 or one == 0:
		print(ss)
		continue
	arr = list(ss)
	ans = ''
	for i in range(len(arr) - 1):
		if arr[i] == arr[i + 1]:
			ans += arr[i] + ulta(arr[i])
		else:
			ans += arr[i]
	ans += arr[-1]
	print(ans)


t = int(input())
for l in range(t):
	s = input()
	if s.find('0') < 0 or s.find('1') < 0:
		print(s)
	else:
		print(s[0], end='')
		for i in range(1, len(s)):
			if s[i] == s[i - 1]:
				if s[i] == '0':
					print('10', end='')
				else:
					print('01', end='')
			else:
				print(s[i], end='')
		print()


import sys
from collections import Counter
INF = 2 ** 62 - 1

def read_int():
	return int(input())

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

def read_float():
	return float(input())

def read_float_n():
	return list(map(float, input().split()))

def read_str():
	return input().strip()

def read_str_n():
	return list(map(str, input().split()))

def error_print(*args):
	print(*args, file=sys.stderr)

def mt(f):
	import time

	def wrap(*args, **kwargs):
		s = time.time()
		ret = f(*args, **kwargs)
		e = time.time()
		error_print(e - s, 'sec')
		return ret
	return wrap

def slv(T):
	C = Counter(T)
	if C['0'] == 0 or C['1'] == 0:
		return T
	ans = ['-']
	for c in T:
		if ans[-1] == c:
			if c == '1':
				ans.append('0')
			else:
				ans.append('1')
		ans.append(c)
	ans.pop(0)
	return ''.join(ans)

def main():
	T = read_int()
	for _ in range(T):
		t = read_str()
		print(slv(t))
main()


T = int(input().strip())
for t in range(T):
	s = input().strip()
	ds = set(s)
	if len(ds) == 1:
		print(s)
	elif s[0] == '0':
		print('01' * len(s))
	else:
		print('10' * len(s))


t = int(input())
for _ in range(t):
	s = input()
	n = len(s)
	c = s.count('1')
	if c == n or c == 0:
		print(s)
	elif s[0] == '1':
		print('10' * n)
	else:
		print('01' * n)


t = int(input())
while t:
	t -= 1
	s = input()
	n = len(s)
	if n <= 2:
		print(s)
	elif len(set(s)) == 1:
		print(s)
	else:
		for i in range(n):
			print('10', end='')
		print()


for _ in range(int(input())):
	string = input()
	(noofones, noofzeroes) = (0, 0)
	for i in string:
		if i == '1':
			noofones += 1
		else:
			noofzeroes += 1
	for i in string:
		if noofones == 0:
			print('0', end='')
		elif noofzeroes == 0:
			print('1', end='')
		else:
			print('01', end='')
	print()


def main():
	t = input()
	n = len(t)
	if n <= 2 or '1' not in t or '0' not in t:
		return t
	else:
		s = ''
		for i in range(n - 1):
			s += t[i]
			if t[i] == t[i + 1]:
				s += str(1 - int(t[i]))
		s += t[-1]
		return s
for _ in range(int(input())):
	print(main())


import math
for w in range(int(input())):
	ent = list(input())
	if len(ent) <= 2:
		print(''.join(ent))
	elif '0' not in ent or '1' not in ent:
		if len(ent) % 2 == 0:
			print(''.join(ent))
		else:
			ent.append(ent[0])
			print(''.join(ent))
	elif ent[0] == '0':
		print('01' * len(ent))
	else:
		print('10' * len(ent))


for _ in [0] * int(input()):
	a = input()
	print(['01' * len(a), a][len({*a}) < 2])


T = int(input())
for t in range(T):
	t_list = list(input())
	ans = ''.join(set(t_list)) * len(t_list)
	print(ans)


def main():
	line = input()
	num = line[0]
	same = True
	for i in line:
		if i != num:
			same = False
	if same:
		print(line)
	else:
		ln = '01' * len(line)
		print(ln)
t = int(input())
for i in range(t):
	main()


t = int(input())
while t != 0:
	t -= 1
	s = input()
	k = len(s)
	if '0' in s:
		if '1' in s:
			print('01' * k)
		else:
			print('0' * k)
	else:
		print('1' * k)


T = int(input())
S = [input() for _ in range(T)]
for s in S:
	st = set(s)
	if len(st) == 1:
		print(s)
	else:
		print('10' * len(s))


import math
import collections
t = int(input())

def solve(t):
	cnts = collections.Counter(list(t))
	n = len(t)
	ans = ''
	if cnts['0'] == 0:
		return '1' * n
	elif cnts['1'] == 0:
		return '0' * n
	for i in range(n):
		(c, nxt) = (t[i], t[i + 1] if i + 1 < n else '-')
		if c == nxt:
			if c == '1':
				ans += '10'
			else:
				ans += '01'
		else:
			ans += c
	return ans
for _ in range(t):
	print(solve(input()))


T = int(input())
for i in range(T):
	t = input()
	t = list(t)
	uguali = 0
	for j in range(len(t) - 1):
		if t[j] != t[j + 1]:
			uguali = 1
			break
	if uguali == 0:
		print(''.join((str(k) for k in t)))
	else:
		s = t.copy()
		ind = 0
		for j in range(len(t) - 1):
			if t[j] == t[j + 1]:
				s.insert(j + 1 + ind, 1 - int(t[j]))
				ind += 1
		print(''.join((str(k) for k in s)))


t = int(input())
for xx in range(t):
	s = input()
	zc = 0
	oc = 0
	for i in s:
		if i == '0':
			zc += 1
		if i == '1':
			oc += 1
	if zc == 0 or oc == 0:
		print(s)
	else:
		ans = ''
		for i in range(len(s) - 1):
			ans += s[i]
			if s[i] == s[i + 1]:
				ans += str(1 - int(s[i]))
		ans += s[-1]
		print(ans)


t = int(input())
for i1 in range(t):
	s = input()
	all_one = True
	all_zero = True
	for i2 in s:
		if i2 != '1':
			all_one = False
			break
	for i2 in s:
		if i2 != '0':
			all_zero = False
			break
	if all_one:
		print('1' * len(s))
	elif all_zero:
		print('0' * len(s))
	else:
		print('10' * len(s))


m = int(input())
for j in range(m):
	s = input()
	if '0' in s and '1' in s:
		print('10' * len(s))
	else:
		print(s)


from collections import Counter
n_cases = int(input())
for case_num in range(n_cases):
	t = input()
	ctr = Counter(t)
	if ctr.most_common(n=1)[0][1] == len(t):
		print(t)
		continue
	print('01' * len(t))


def solve():
	s = input()
	n = len(s)
	if s == '0' * n or s == '1' * n:
		print(s)
	else:
		print('01' * n)
t = int(input())
while t > 0:
	t -= 1
	solve()


t = int(input())
for _ in range(t):
	t = input()
	l = len(t)
	if t.count('1') == l or t.count('1') == 0 or l == 2:
		print(t)
	else:
		k = '10'
		print(k * l)


T = int(input())
for _ in range(T):
	t = input()
	if t == '0' * len(t) or t == '1' * len(t):
		print(t)
	else:
		numZ = 0
		numO = 0
		for c in t:
			if c == '0':
				numZ += 1
			if c == '1':
				numO += 1
		if numZ > numO:
			ans = '01' * (len(t) - 1) + '0'
		else:
			ans = '10' * (len(t) - 1) + '1'
		print(ans)


for _ in range(int(input())):
	a = list(input())
	if len(set(a)) == 1:
		print(''.join(a))
	else:
		print('10' * len(a))


import math, sys
import heapq
from fractions import Fraction
from collections import Counter, defaultdict

def li():
	return list(map(int, sys.stdin.readline().split()))

def ls():
	return list(map(int, list(input())))

def la():
	return list(input())

def ii():
	return int(input())

def dic(x):
	return defaultdict(lambda : x)

def isPrime(n):
	i = 2
	if n == 1:
		return False
	while i <= int(math.sqrt(n)):
		if n % i == 0:
			return False
		i = i + 1
	return True

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def binarySearch(arr, x):
	(l, r) = (0, len(arr) - 1)
	while l <= r:
		mid = l + (r - l) // 2
		if arr[mid] == x:
			return True
		elif arr[mid] < x:
			l = mid + 1
		else:
			r = mid - 1
	return False
t = ii()
for _ in range(t):
	a = input()
	count_1 = a.count('1')
	count_0 = len(a) - count_1
	if '0' * len(a) == a or '1' * len(a) == a:
		print(2 * a)
	elif a[0] == '0':
		print('01' * len(a))
	else:
		print('10' * len(a))


t = int(input())
for _ in range(t):
	a = input()
	(o, e) = (0, 0)
	if len(a) == 2:
		print(a)
	else:
		for i in range(len(a)):
			if a[i] == '1':
				o = o + 1
			else:
				e = e + 1
		if o == 0 or e == 0:
			print(a)
		else:
			print('10' * len(a))


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().strip().split(' '))

def msi():
	return map(str, input().strip().split(' '))

def li():
	return list(mi())

def dmain():
	sys.setrecursionlimit(1000000)
	threading.stack_size(1024000)
	thread = threading.Thread(target=main)
	thread.start()
import sys
input = sys.stdin.readline
scanner = lambda : int(input())
string = lambda : input().rstrip()
get_list = lambda : list(read())
read = lambda : map(int, input().split())
get_float = lambda : map(float, input().split())

def ceil(x):
	if x != int(x):
		x = int(x) + 1
	return x

def factorial(x, m):
	val = 1
	while x > 0:
		val = val * x % m
		x -= 1
	return val

def fact(x):
	val = 1
	while x > 0:
		val *= x
		x -= 1
	return val

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def lcm(a, b):
	return a * b // math.gcd(a, b)

def is_integer(n):
	return math.ceil(n) == math.floor(n)

def nCr(n, k):
	if k > n:
		return 0
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res)

def primefs(n):
	primes = {}
	while n % 2 == 0 and n > 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0 and n > 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	(prime[0], prime[1]) = (False, False)
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime

def phi(n):
	result = n
	p = 2
	while p * p <= n:
		if n % p == 0:
			while n % p == 0:
				n = n // p
			result = result * (1.0 - 1.0 / float(p))
		p = p + 1
	if n > 1:
		result = result * (1.0 - 1.0 / float(n))
	return int(result)

def is_prime(n):
	if n == 0:
		return False
	if n == 1:
		return True
	for i in range(2, int(n ** (1 / 2)) + 1):
		if not n % i:
			return False
	return True

def next_prime(n, primes):
	while primes[n] != True:
		n += 1
	return n
MAXN = int(100000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i
spf = [0 for i in range(MAXN)]

def factoriazation(x):
	res = []
	for i in range(2, int(x ** 0.5) + 1):
		while x % i == 0:
			res.append(i)
			x //= i
	if x != 1:
		res.append(x)
	return res

def factors(n):
	res = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			res.append(i)
			res.append(n // i)
	return list(set(res))

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

def float_array():
	return list(map(float, input().strip().split()))

def str_array():
	return input().strip().split()

def binary_search(low, high, w, h, n):
	while low < high:
		mid = low + (high - low) // 2
		if check(mid, w, h, n):
			low = mid + 1
		else:
			high = mid
	return low

def check(moves, n):
	val = (moves + 1) // 2
	rem = moves - val
	sol = (val + 1) * (rem + 1)
	return sol < n

def sortSecond(val):
	return val[1]
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
alphs = 'abcdefghijklmnopqrstuvwxyz'
from itertools import permutations
import math
import bisect as bis
import random
import sys
import collections as collect
import functools as fnt

def solve():
	t = string()
	if t.count('1') == len(t):
		print(t)
		return
	if t.count('0') == len(t):
		print(t)
		return
	ans = ''
	f = int(t[0])
	ans = ans + t[0]
	for x in t[1:]:
		if f == 1 and int(x) == 0:
			ans = ans + x
			f = int(x)
		elif f == 0 and int(x) == 1:
			ans = ans + x
			f = int(x)
		else:
			ans = ans + str(1 - int(x))
			ans = ans + x
			f = int(x)
	print(ans)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
t = scanner()
for i in range(t):
	solve()


from collections import defaultdict

def main():
	cc = int(input())
	for ccc in range(cc):
		d = input()
		if all((c == '1' for c in d)):
			print(d)
			continue
		if all((c == '0' for c in d)):
			print(d)
			continue
		if d.startswith('1'):
			print('10' * len(d))
			continue
		if d.startswith('0'):
			print('01' * len(d))
			continue
main()


n = int(input())
for i in range(n):
	t = input()
	q = [-1] * 2
	w = [-1] * len(t)
	for jj in range(len(t)):
		w[jj] = int(t[jj]) + 1
	w.sort()
	if w[0] == w[len(w) - 1]:
		print(2 * t)
	else:
		for ii in range(len(t)):
			print(t[0], end='')
			q[int(t[0])] = t[0]
			for j in range(1, len(t)):
				if q[int(t[j])] == -1:
					print(t[j], end='')
				q[int(t[j])] = t[j]
			q = [-1] * 2
		print()


def solve():
	t = input()
	l = len(t)
	final = ''
	final = final + t[0]
	count = 0
	for i in range(1, l):
		if t[i] != t[i - 1]:
			count += 1
			break
	else:
		print(t)
		return
	if count != 0:
		for i in range(l - 1):
			if final[-1] == t[i + 1]:
				if t[i + 1] == '1':
					final = final + '0' + '1'
				else:
					final = final + '1' + '0'
			else:
				final = final + t[i + 1]
	print(final)
t = int(input())
for i in range(t):
	solve()


import sys

def func():
	st = input()
	length = len(st)
	k = 0
	for i in range(length):
		if st[i] == st[0]:
			continue
		else:
			k = 1
			break
	if k == 0:
		return st
	else:
		return '01' * length
t = int(sys.stdin.readline())
while t:
	print(func())
	t -= 1


t = int(input())
for case in range(1, t + 1):
	s = input()
	both = '0' in s and '1' in s
	if both:
		res = ['0'] * (2 * len(s))
		res[1::2] = ['1'] * len(s)
		print(''.join(res))
	else:
		print(s)


t = int(input())
line = str()
for i in range(t):
	k = str(input())
	line = k[0]
	if len(set(k)) == 1:
		print(k)
	else:
		for j in range(1, len(k)):
			if k[j] == k[j - 1]:
				if k[j] == '0':
					line += '10'
				else:
					line += '01'
			else:
				line += k[j]
		print(line)


n = int(input())

def solve(s):
	c_1 = s.count('1')
	c_0 = s.count('0')
	if len(s) <= 2:
		return s
	if c_1 == len(s):
		return s + '1'
	if c_0 == len(s):
		return s + '0'
	return '01' * len(s)
for x in range(n):
	print(solve(input()))


t = int(input())
for i in range(t):
	data = input()
	data2 = set(data)
	if len(data2) == 1:
		print(''.join(data))
	elif len(data2) == 2:
		for k in range(len(data)):
			print(10, end='')
		print('')


def rd(n):
	if n == 0:
		return input('')
	if n == 1:
		return int(input())
	if n == 2:
		return map(int, input().split())
	if n == 3:
		return list(map(int, input().split()))

def solve():
	t = rd(1)
	for _ in range(t):
		s = rd(0)
		sl = list(set(list(s)))
		if len(sl) == 1:
			print(s)
		else:
			ans = s[0]
			i = 1
			while i < 2 * len(s):
				if i % 2 == 1:
					if ans[0] == '1':
						ans += '0'
					else:
						ans += '1'
				else:
					ans += s[0]
				i += 1
			print(ans)
solve()


t = int(input())
for _ in range(t):
	a = input()
	if len(set(a)) == 1:
		print(a)
	else:
		b = a.count('1')
		c = a.count('0')
		e = '10' * len(a)
		print(e)


from sys import stdin, stdout
import heapq as hq
from collections import defaultdict

def rever(c):
	if c == '1':
		return '0'
	else:
		return '1'
t = int(input())
for tc in range(t):
	string = stdin.readline().strip()
	if '1' not in string or '0' not in string:
		res = string
	else:
		ans = []
		last = rever(string[0])
		for cha in string:
			if cha == last:
				ans.append(rever(cha))
				ans.append(cha)
			else:
				ans.append(cha)
				last = cha
		res = ''.join(ans)
	stdout.write(str(res) + '\n')


for _ in range(int(input())):
	t = input()
	if len(t) == 2:
		print(t)
		continue
	if '0' not in t or '1' not in t:
		print(t)
		continue
	c = 0
	if t[0] == '0':
		c = 0
		for i in range(0, len(t) - 1, 2):
			if t[i:i + 2] == '01':
				c += 1
			else:
				c += 2
		print('01' * c) if len(t) % 2 == 0 else print('01' * (c + 1))
	elif t[0] == '1':
		c = 0
		for i in range(0, len(t) - 1, 2):
			if t[i:i + 2] == '10':
				c += 1
			else:
				c += 2
		print('10' * c) if len(t) % 2 == 0 else print('10' * (c + 1))


t = int(input())
for _ in range(t):
	ret = []
	s = input()
	last = ''
	first = s[0]
	allsame = True
	for c in s:
		if c != first:
			allsame = False
		if c == last:
			ret.append('1' if c == '0' else '0')
		ret.append(c)
		last = c
	if allsame or len(s) <= 2:
		print(s)
	else:
		print(''.join(ret))


for i in range(int(input())):
	a = input()
	if a.count('0') == len(a) or a.count('1') == len(a):
		print(a)
		continue
	if a[0] == '1':
		s = '10' * len(a)
	else:
		s = '01' * len(a)
	print(s[:len(s) - 1])


for _ in range(int(input())):
	t = input()
	if len(set(list(t))) == 1:
		print(t)
	else:
		print(len(t) * '10')


T = int(input())
for t in range(T):
	s = input()
	l = len(s)
	if s.count('0') == l or s.count('1') == l:
		print(s)
	else:
		print('10' * l)


t = int(input())
for _ in range(t):
	st = list(input())
	set_ = list(set(st))
	set_ *= len(st) * 2 // len(set_) + 1
	print(*set_[:len(st) * 2], sep='')


a = int(input())
for _ in range(a):
	b = input()
	c = b.count('0')
	d = b.count('1')
	if c == 0 or d == 0:
		print(b)
	elif b[0] == '1':
		print('10' * len(b))
	else:
		print('01' * len(b))


t = int(input())
for _ in range(0, t):
	ans = 0
	inp = input()
	n = len(inp)
	c0 = 0
	c1 = 0
	ans = ''
	for i in range(0, n):
		if inp[i] == '1':
			c1 += 1
		else:
			c0 += 1
	if c0 == n:
		print(inp)
	elif c1 == n:
		print(inp)
	else:
		for i in range(0, n):
			ans += '0'
			ans += '1'
		print(ans)


t = int(input())
for p in range(0, t):
	s = input()
	f = 0
	for i in range(1, len(s)):
		if s[i] == s[0]:
			continue
		else:
			f = 1
	if f == 0:
		print(s)
	elif s[0] == '1':
		print('10' * len(s))
	else:
		print('01' * len(s))


def s(string, l):
	if string == string[0] * l:
		return string
	return '01' * l
t = int(input())
for _ in range(t):
	st = input()
	l = len(st)
	print(s(st, l))


test = int(input())
for i in range(test):
	t = input()
	if '0' in t and '1' not in t or ('1' in t and '0' not in t):
		print(t)
	else:
		n = len(t)
		if t[0] == '1':
			t1 = '10' * n
		else:
			t1 = '01' * n
		print(t1)


for _ in range(int(input())):
	s = list(input())
	if len(s) == 2:
		print(*s, sep='')
	else:
		(f1, f2) = (0, 0)
		for i in range(len(s)):
			if s[i] == '1':
				f1 = 1
			if s[i] == '0':
				f2 = 1
		if f1 == 1 and f2 == 1:
			print('10' * len(s))
		elif f1 == 1 and f2 == 0:
			print('1' * len(s))
		elif f1 == 0 and f2 == 1:
			print('0' * len(s))


t = int(input())
for _ in range(t):
	s = input()
	c = 0
	d = 0
	for i in s:
		if i == '0':
			c = c + 1
		else:
			d = d + 1
	if c == 0 or d == 0:
		print(s)
	else:
		t = (c + d) * '01'
		print(t)


casos = int(input())
for i in range(casos):
	t = input()
	hayCero = False
	hayUno = False
	resultado = ''
	for e in t:
		if e == '0':
			hayCero = True
		elif e == '1':
			hayUno = True
	if not hayCero:
		for c in range(len(t)):
			resultado += '1'
	elif not hayUno:
		for c in range(len(t)):
			resultado += '0'
	else:
		for c in range(len(t)):
			resultado += '10'
	print(resultado)


n = int(input())
for i in range(n):
	s = str(input())
	ans = ''
	uno = 0
	zero = 0
	for i in s:
		if i == '0':
			zero += 1
		else:
			uno += 1
	if zero == len(s):
		print(s + '0')
	elif uno == len(s):
		print(s + '1')
	elif s[0] == '0':
		for i in range(len(s)):
			ans += '01'
	else:
		for i in range(len(s)):
			ans += '10'
	print(ans)


q = int(input())
for _ in range(q):
	s = input()
	n = len(s)
	if n <= 2:
		print(s)
		continue
	(o, t) = (0, 0)
	for i in s:
		if i == '1':
			o += 1
		else:
			t += 1
	if t * o == 0:
		print(s)
		continue
	a = ''
	i = 0
	while i < n - 1:
		if s[i] == s[i + 1]:
			a += s[i]
			if s[i] == '1':
				a += '0'
			else:
				a += '1'
			i += 1
		else:
			a += s[i]
			i += 1
	a += s[-1]
	print(a)


for _ in range(int(input())):
	s = input()
	l = len(s)
	if len(set(s)) == 1:
		print(s)
		continue
	if len(s) == 2:
		print(s)
		continue
	for i in range(l):
		s = '10' * l
	print(s)


from math import *
t = int(input())
while t != 0:
	cnt = 0
	s = input()
	for i in range(len(s)):
		if s[i] == '1':
			cnt += 1
	if cnt == 0 or cnt == len(s):
		print(s)
	else:
		for i in range(len(s)):
			print('01', end='')
		print()
	t -= 1


t = int(input())
for _ in range(t):
	s = input()
	if int(s, 2) == 0:
		print(s)
	elif int(s, 2) == (1 << len(s)) - 1:
		print(s)
	else:
		print('10' * len(s))


def fail(s):
	t = ''
	if s.count('0') == 0 or s.count('1') == 0:
		return s
	for i in range(len(s) - 1):
		if s[i] == s[i + 1]:
			t += s[i]
			t += str(1 - int(s[i]))
		else:
			t += s[i]
	t += s[-1]
	return t
for i in range(int(input())):
	s = input()
	print(fail(s))


for _ in range(int(input())):
	s = input()
	if len(s) <= 2:
		print(s)
		continue
	elif len(set(s)) == 1:
		print(s)
		continue
	else:
		ans = '0'
		for i in s:
			if i == ans[-1]:
				ans += '1' if i == '0' else '0'
				ans += i
			else:
				ans += i
		print(ans[1:])


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	s = input().rstrip()
	if '0' not in s:
		print('1' * len(s))
		continue
	if '1' not in s:
		print('0' * len(s))
		continue
	print('01' * len(s))


n = int(input())
for i in range(0, n):
	t = input()
	(x, y) = (t.count('0'), t.count('1'))
	if x == 0 or y == 0:
		print(t)
	else:
		f = {'1': '0', '0': '1'}
		s = ''
		for y in t:
			if not s or s[-1] != y:
				s += y
			else:
				s += f[y] + y
		print(s)


def f(T):
	for i in range(T):
		t = input()
		lenth = len(t)
		t0 = t
		if lenth <= 2 or len(set(t0)) == 1:
			print(t)
			continue
		if t[0] == '1':
			print('10' * lenth + '\n')
		else:
			print('01' * lenth + '\n')
	return
T = int(input())
f(T)


import sys
input = sys.stdin.readline

def solve():
	s = list(input())
	s.pop()
	n = len(s)
	o = z = 0
	for i in range(n):
		if s[i] == '1':
			o = 1
		else:
			z = 1
	if o == 0 or z == 0:
		print(''.join((str(x) for x in s)))
		return
	ok = True
	ans = ''
	for i in range(2 * n):
		ans += '1' if ok else '0'
		ok = not ok
	print(ans)

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


t = int(input())
for _ in range(t):
	t = input()
	if len(t) == t.count('1') or len(t) == t.count('0'):
		print(t)
		continue
	s = ''
	for i in range(len(t) - 1):
		if t[i] != t[i + 1]:
			s += t[i]
		elif t[i] == '0':
			s += t[i] + '1'
		else:
			s += t[i] + '0'
	s += t[-1]
	print(s)


def solve(s, ans):
	found = True
	for i in range(len(s) - 1):
		if s[i] != s[i + 1]:
			found = False
			break
	if found:
		ans.append(s)
	else:
		t = [0] * 2 * len(s)
		if s[0] == '0':
			for i in range(0, len(t), 2):
				t[i] = '0'
			for i in range(1, len(t), 2):
				t[i] = '1'
		else:
			for i in range(0, len(t), 2):
				t[i] = '1'
			for i in range(1, len(t), 2):
				t[i] = '0'
		t1 = ''
		for i in t:
			t1 += i
		ans.append(t1)

def main():
	t = int(input())
	ans = []
	for i in range(t):
		s = input()
		solve(s, ans)
	for i in ans:
		print(i)
main()


import math
t = int(input())
for ii in range(t):
	s = input()
	n = len(s)
	ans = '01'
	if not '0' in s or not '1' in s:
		print(s + s)
	else:
		dur0 = 1
		for i in range(n):
			if s[i] == '0':
				for j in range(i + 1, n):
					if s[j] == '0':
						dur0 = j - i
						break
			if dur0 > 1:
				break
		dur1 = 1
		for i in range(n):
			if s[i] == '1':
				for j in range(i + 1, n):
					if s[j] == '1':
						du1 = j - i
						break
			if dur1 > 1:
				break
		if dur1 == 1 or (dur0 == 1 and dur1 != dur0):
			ii = 0
			while ii < n:
				print(ans, end='')
				ii += 1
			print()
		else:
			print(s + s)


for xyz in range(0, int(input())):
	s = input()
	p1 = 0
	p0 = 0
	for i in s:
		if i == '0':
			p0 = 1
		else:
			p1 = 1
	if p1 and p0:
		if s[0] == '0':
			print('01' * len(s))
		else:
			print('10' * len(s))
	elif p1 == 1:
		print('1' * len(s))
	else:
		print('0' * len(s))


ipnl = lambda n: [int(input()) for _ in range(n)]
inp = lambda : int(input())
ip = lambda : [int(w) for w in input().split()]
mp = lambda : map(int, input().split())
for _ in range(int(input())):
	s = input()
	n = len(s)
	(a, b) = (s.count('0'), s.count('1'))
	if a == n or b == n:
		print(s)
		continue
	st = s[0]
	if st == '0':
		a = '01'
	else:
		a = '10'
	ans = ''
	for i in range(n - 1):
		ans += a
	print(ans)


for _ in range(int(input())):
	a = input()
	if '0' not in a or '1' not in a:
		print(a)
	else:
		i = 0
		while i < len(a) - 1:
			if a[i] == '1' and a[i + 1] != '0':
				a = a[:i + 1] + '0' + a[i + 1:]
			elif a[i] == '0' and a[i + 1] != '1':
				a = a[:i + 1] + '1' + a[i + 1:]
			i += 1
		print(a)


def main():
	t = int(input())
	for _ in range(t):
		s = input()
		n = len(s)
		if s.count('1') == n or s.count('0') == n:
			print(s)
			continue
		ret = ''
		for i in range(2 * n):
			if i & 1:
				ret += '1'
			else:
				ret += '0'
		print(ret)
main()


T = int(input())
for _ in range(T):
	t = input()
	if len(set(t)) == 1:
		print(t)
	else:
		out = [t[0]]
		for c in t[1:]:
			if c == out[-1]:
				out.append('1' if c == '0' else '0')
			out.append(c)
		print(''.join(out))


from sys import stdin, stdout
import math, sys
from itertools import permutations, combinations
from collections import defaultdict, deque, OrderedDict
import bisect as bi
import heapq

def I():
	return int(input())

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

def main():
	try:
		l = list(input())
		z = l.copy()
		z = list(set(l))
		if len(z) == 1:
			print(''.join(l))
		else:
			ans = []
			if l[0] == '0':
				for i in range(len(l)):
					ans.append('0')
					ans.append('1')
				print(''.join(ans))
			else:
				for i in range(len(l)):
					ans.append('1')
					ans.append('0')
				print(''.join(ans))
	except:
		pass
M = 998244353
P = 1000000007
for _ in range(I()):
	main()


def read_int():
	return int(input())

def read_ints():
	return list(map(int, input().split(' ')))
t = read_int()
for case_num in range(t):
	a = input()
	n = len(a)
	one = 0
	for c in a:
		if c == '1':
			one += 1
	if one == 0 or one == n:
		print(a)
	else:
		print(''.join(['01' for i in range(n)]))


tc = int(input())
for i in range(tc):
	string = str(input())
	if '0' in string and '1' in string:
		print('01' * len(string))
	else:
		print(string)


def solve(s):
	zero = 0
	one = 0
	n = len(s)
	for i in range(n):
		if s[i] == '1':
			one += 1
		else:
			zero += 1
	if zero == n or one == n:
		print(s)
		return
	if n <= 2:
		print(s)
		return
	elif s[0] == '0':
		print('01' * n)
	else:
		print('10' * n)
t = int(input())
for _ in range(t):
	s = input()
	solve(s)


for i in range(int(input())):
	x = input()
	if x.count('1') == 0 or x.count('0') == 0:
		print(x)
	else:
		print(''.join([str(i % 2) for i in range(len(x) * 2)]))


for _ in range(int(input())):
	s = input()
	n = len(s)
	f1 = 0
	f0 = 0
	for ch in s:
		if ch == '1':
			f1 = 1
		if ch == '0':
			f0 = 1
	if f1 == 0 or f0 == 0:
		print(s)
	else:
		print('10' * n)


import os

def p(t):
	if t.count('0') == 0 or t.count('1') == 0:
		return t
	return '01' * len(t)

def pp(input):
	n_test = int(input())
	for i in range(n_test):
		print(p(input()))
if 'paalto' in os.getcwd():
	from string_source import string_source
	pp(string_source('4\n00\n01\n111\n110'))
else:
	pp(input)


for _ in range(int(input())):
	t = input()
	if '1' not in t:
		print(t)
	elif '0' not in t:
		print(t)
	else:
		res = ''
		for i in range(len(t)):
			if t[-1] == '0':
				res += '10'
			else:
				res += '01'
		print(res)


for _ in range(int(input())):
	t = input()
	n = len(t)
	s = [t[0]]
	if n <= 2 or t == '0' * n or t == '1' * n:
		print(t)
		continue
	s = []
	for i in range(n):
		s.append('0')
		s.append('1')
	print(''.join(s))


for t in range(int(input())):
	a = list(input())
	if len(set(a)) == 1:
		print(a[0] * len(a))
	else:
		print('01' * len(a))


t = int(input())
for i in range(t):
	s = input().strip()
	if len(set(s)) == 1:
		print(s)
	else:
		a = ''
		for j in range(len(s)):
			a = a + '10'
		print(a)


t = int(input())
for _ in range(t):
	k = input()
	l = set(k)
	if len(l) == 1:
		print(k)
	else:
		print('10' * len(k))


from collections import defaultdict
t = int(input())
for i in range(t):
	s = input()
	flag1 = True
	for i in range(len(s) - 1):
		if s[i] != s[i + 1]:
			flag1 = False
			break
	if flag1:
		print(s)
		continue
	flag2 = True
	for i in range(len(s) - 2):
		if s[i] != s[i + 2]:
			flag2 = False
			break
	if flag2:
		print(s)
		continue
	n = len(s)
	ans = '10' * n
	print(ans)


t = int(input())
for rep in range(t):
	s = input()
	d = {}
	op = ''
	for i in s:
		if i not in d:
			d[i] = 1
	if len(d) == 1:
		op = s
	else:
		for i in s:
			if i == '0':
				op = op + '1' + i
			else:
				op = op + i + '0'
	print(op)


t = int(input())
for _ in range(t):
	s = input()
	if len(s) == 2:
		print(s)
	elif len(set(list(s))) == 1:
		print(s)
	else:
		if s[0] == '0':
			ans = '0'
			last = '0'
			for j in range(1, len(s)):
				if s[j] != last:
					ans += s[j]
					last = s[j]
				elif len(ans) % 2 == 0:
					ans += '0'
					ans += s[j]
					last = s[j]
				else:
					ans += '1'
					ans += s[j]
					last = s[j]
		else:
			ans = '1'
			last = '1'
			for j in range(1, len(s)):
				if s[j] != last:
					ans += s[j]
					last = s[j]
				elif len(ans) % 2 == 0:
					ans += '1'
					ans += s[j]
					last = s[j]
				else:
					ans += '0'
					ans += s[j]
					last = s[j]
		print(ans)


t = int(input())
while t:
	t = t - 1
	s = input()
	flag = 0
	res = ''
	for i in range(1, len(s)):
		if s[i] != s[i - 1]:
			res = '10' * len(s)
			flag = 1
			break
	if flag == 0:
		res = s
	print(res)


def solve(t):
	if len(t) == 2:
		return t
	if len(set(t)) == 1:
		return t
	s = [t[0]]
	for cur in t[1:]:
		if cur == s[-1]:
			s.append((cur + 1) % 2)
		s.append(cur)
	return s
cases = int(input())
for _ in range(cases):
	t = list(map(int, list(input())))
	print(''.join((str(k) for k in solve(t))))


for T in range(int(input())):
	t = input()
	(z, o) = (0, 0)
	for ch in t:
		z = z + 1 if ch == '0' else z
		o = o + 1 if ch == '1' else o
	if z > 0 and o > 0:
		print('01' * len(t))
	elif o > 0 and (not z):
		print('1' * len(t))
	else:
		print('0' * len(t))


t = int(input())
for i in range(t):
	STR = list(input())
	if STR.count('1') == len(STR):
		pass
	elif STR.count('0') == len(STR):
		pass
	elif len(STR) <= 2:
		pass
	else:
		L = len(STR)
		now = 0
		while now < L - 1:
			if STR[now] == STR[now + 1] and STR[now] == '1':
				STR.insert(now + 1, '0')
				L += 1
			elif STR[now] == STR[now + 1] and STR[now] == '0':
				STR.insert(now + 1, '1')
				L += 1
			now += 1
	print(''.join(map(str, STR)))


t = int(input())
for hh in range(0, t):
	s = input()
	n = len(s)
	count0 = 0
	count1 = 0
	for i in range(0, n):
		if s[i] == '0':
			count0 += 1
		else:
			count1 += 1
	if count0 == n:
		print(s)
	elif count1 == n:
		print(s)
	else:
		ss = ''
		for i in range(0, n):
			ss += '0'
			ss += '1'
		print(ss)


T = int(input())
for _ in range(T):
	t = list(input())
	cmatrix = [0] * 2
	for each in t:
		if each == '0':
			cmatrix[0] += 1
		else:
			cmatrix[1] += 1
	if cmatrix[0] == 0:
		print('1' * (len(t) + 1))
	elif cmatrix[1] == 0:
		print('0' * (len(t) + 1))
	elif t[0] == '0':
		print('01' * (len(t) - 1) + '0')
	else:
		print('10' * (len(t) - 1) + '1')


t = int(input())
for _ in range(t):
	t = str(input())
	T = list(t)
	zer = t.count('0')
	un = t.count('1')
	if not (zer and un):
		print(t)
	else:
		k = len(t) * 2 - 1
		s = [t[0], '0' if T[0] == '1' else '1'] * (k // 2)
		print(''.join(s))


t = int(input())
for x in range(t):
	a1 = input()
	c = 0
	for i in range(1, len(a1)):
		if a1[i - 1] != a1[i]:
			c = 1
			break
	if c == 0:
		print(a1)
	else:
		ar = []
		ar.append(a1[0])
		for i in range(1, len(a1)):
			if a1[i] != a1[i - 1]:
				ar.append(a1[i])
			else:
				if ar[-1] == '0':
					ar.append('1')
				else:
					ar.append('0')
				ar.append(a1[i])
		print(''.join(ar))


def ri():
	return int(input())

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

def solve():
	S = input().strip()
	if len(set(list(S))) == 1:
		answer = S
	else:
		answer = '01' * len(S)
	print(answer)
	return
t = ri()
for i in range(t):
	solve()


T = int(input())
for j in range(T):
	t = input()
	s = t[0]
	f = True
	for i in range(1, len(t)):
		if t[i] == t[i - 1]:
			s += str((int(t[i]) + 1) % 2)
		else:
			f = False
		s += t[i]
	if f:
		print(t)
	else:
		print(s)


import sys

def main():
	t = int(input())
	for _ in range(t):
		word = sys.stdin.readline().strip()
		cnt = 0
		for i in word:
			if i == '0':
				cnt -= 1
			else:
				cnt += 1
		if abs(cnt) == len(word):
			print(word)
		else:
			ans = word[0]
			i = 0
			while i < len(word):
				if word[i] == '1':
					if ans[-1] == '0':
						ans += '1'
						i += 1
					else:
						ans += '01'
						i += 1
				elif ans[-1] == '1':
					ans += '0'
					i += 1
				else:
					ans += '10'
					i += 1
			print(ans)
	return
main()


for _ in range(int(input())):
	s = input()
	has1 = False
	has0 = False
	for i in s:
		if i == '0':
			has0 = True
		if i == '1':
			has1 = True
	if has1 == False or has0 == False:
		print(s)
	else:
		print('10' * len(s))


from pprint import pprint
q = int(input().strip())
for _ in range(q):
	s = input()
	if s.count('0') == 0 or s.count('1') == 0:
		print(s)
	else:
		ll = len(s)
		print('10' * ll)


t = int(input())
for z in range(t):
	s = input()
	n = len(s)
	z = 0
	for i in range(n):
		if s[i] == '0':
			z += 1
	st = ''
	if s[0] == '0':
		if n - z != 0:
			st = '01'
		else:
			st = '0'
	elif z != 0:
		st = '10'
	else:
		st = '1'
	print(st * n)


from collections import defaultdict
for _ in range(int(input())):
	s = input()
	ll = defaultdict(int)
	for i in s:
		ll[i] += 1
	if ll['0'] == len(s) or ll['1'] == len(s):
		print(s)
	else:
		print('10' * len(s))


test = int(input())
for i in range(test):
	arr = list(input())
	n = len(arr)
	count_of_zero = 0
	count_of_one = 0
	for i in range(n):
		if arr[i] == '0':
			count_of_zero += 1
		if arr[i] == '1':
			count_of_one += 1
	if count_of_one == n or count_of_zero == n:
		print(''.join(arr))
	else:
		for i in range(2 * n):
			if i % 2 == 0:
				print('1', end='')
			else:
				print('0', end='')
		print()


a = int(input())
for i in range(a):
	s = input()
	le = 1
	for i in range(1, len(s)):
		if s[i] != s[i - 1]:
			le += 1
		else:
			le += 2
	ans = ''
	if s.count('0') == len(s) or s.count('1') == len(s):
		if s.count('0') == len(s):
			print(s)
		else:
			print(s)
		continue
	if s[0] == '0':
		for i in range(le):
			if i % 2 == 0:
				ans += '0'
			else:
				ans += '1'
	else:
		for i in range(le):
			if i % 2 == 0:
				ans += '1'
			else:
				ans += '0'
	print(ans)


from sys import stdin, stdout
for _ in range(int(stdin.readline())):
	t = stdin.readline().strip()
	(n, c1) = (len(t), 0)
	for x in t:
		if x == '1':
			c1 += 1
	if c1 == 0 or c1 == n:
		stdout.write(t + '\n')
	else:
		for x in range(n - 1):
			stdout.write(t[x])
			if t[x] == t[x + 1]:
				stdout.write('1' if t[x] == '0' else '0')
		stdout.write(t[-1] + '\n')


t = int(input())

def allzero(s):
	flag = True
	for i in s:
		if i == '1':
			flag = False
	return flag

def allone(s):
	flag = True
	for i in s:
		if i == '0':
			flag = False
	return flag
for i in range(t):
	s = input()
	if allzero(s) or allone(s):
		print(s)
	else:
		a1 = len(s)
		print('10' * a1)


T = int(input())
for i in range(T):
	s = input()
	slist = list(s)
	s_count1 = slist.count('1')
	s_count0 = slist.count('0')
	if s_count1 == 0 or s_count0 == 0:
		print(s)
		continue
	use1 = [s[0]]
	for i in range(len(slist) - 1):
		if s[i] != s[i + 1]:
			use1.append(s[i + 1])
			continue
		else:
			use1.append(str(1 - int(s[i])))
			use1.append(s[i + 1])
	print(''.join(use1))


n = int(input())
for j in range(n):
	s = input()
	zeros = s.count('0')
	ones = s.count('1')
	if zeros == 0 or ones == 0:
		print(s)
		continue
	prev = s[0]
	print(prev, end='')
	for i in range(1, len(s)):
		if prev == s[i]:
			print('0' if prev == '1' else '1', end='')
		print(s[i], end='')
		prev = s[i]
	print('')


T = int(input())
for _ in range(T):
	t = input()
	s = '01'
	char = t[0]
	all_same = 1
	for i in range(1, len(t)):
		s = s + '01'
		if t[i] != t[i - 1]:
			all_same = 0
	if all_same:
		print(t)
	else:
		print(s)


MOD = 10 ** 9 + 7
INT_MAX = 10 ** 20 + 7

def INPUT():
	return list((int(i) for i in input().split()))

def LIST_1D_ARRAY(n):
	return [0 for _ in range(n)]

def LIST_2D_ARRAY(m, n):
	return [[0 for _ in range(n)] for _ in range(m)]

def power(a, x):
	res = 1
	while x > 0:
		if x & 1:
			res = res * a % MOD
		a = a * a % MOD
		x //= 2
	return res % MOD

def NCR_MOD(n, r):
	num = 1
	for i in range(n, n - r, -1):
		num = num * i % MOD
	for j in range(1, r + 1):
		num = num * power(j, MOD - 2) % MOD
	return num

def period(s):
	for p in range(1, len(s) + 1):
		bool = True
		if len(s) % p == 0:
			for i in range(len(s) - p):
				if s[i] != s[i + p]:
					bool = False
			if bool:
				return p

def calc(s):
	ans = ''
	p = period(s)
	if p == 1 or p == 2:
		return s
	ans = '01' * len(s)
	return ans
for _ in range(int(input())):
	s = input()
	print(calc(s))


for _ in range(int(input())):
	s = input()
	if s.count('0') == len(s) or s.count('0') == 0 or len(s) <= 2:
		print(s)
	else:
		for i in range(1, 2 * len(s) - 1):
			if i >= len(s):
				break
			elif s[i] == s[i - 1] and s[i] == '0':
				s = s[:i] + '1' + s[i:]
			elif s[i] == s[i - 1] and s[i] == '1':
				s = s[:i] + '0' + s[i:]
		print(s)


def generate(s):
	t = list(s)
	if t.count('0') == len(s) or t.count('1') == len(s):
		print(s)
		return
	size = len(s) * 2
	temp = '10' * (size // 2)
	w = list(temp)
	if t.count('1') <= w.count('1') and t.count('0') <= w.count('0'):
		print(temp)

def main():
	t = int(input())
	for i in range(t):
		generate(input())
main()


import os
import sys
from io import BytesIO, IOBase

def solution(t):
	if '1' not in t or '0' not in t:
		write(t)
		return
	write('01' * len(t))

def main():
	for _ in range(r_int()):
		t = input()
		solution(t)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')

def write(*args, sep=' ', end='\n'):
	for x in args[:-1]:
		sys.stdout.write(str(x) + sep)
	sys.stdout.write(str(args[-1]) + end)

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

def r_int():
	return int(input())
main()


t = int(input())
while t:
	t -= 1
	s = str(input())
	ss = ''
	flag = 1
	if len(s) > 1:
		for i in range(1, len(s)):
			if s[i] == s[i - 1]:
				continue
			else:
				flag = 0
				break
	if flag:
		print(s)
	elif len(s) > 2:
		for i in range(0, len(s)):
			if s[0] == '0':
				ss += '01'
			else:
				ss += '10'
		print(ss)
	else:
		print(s)


for i in range(int(input())):
	s = input()
	if s.count('1') == len(s) or s.count('0') == len(s):
		print(s)
	else:
		p = 0
		l = ''
		if s[0] == '0':
			p = 0
			l = '0'
		else:
			p = 1
			l = '1'
		for i in range(1, len(s)):
			if p == 0:
				if s[i] == '0' and l[len(l) - 1] == '0':
					l = l + '1' + s[i]
				elif s[i] == '1' and l[len(l) - 1] == '1':
					l = l + '0' + s[i]
				else:
					l = l + s[i]
			elif s[i] == '1' and l[len(l) - 1] == '1':
				l = l + '0' + s[i]
			elif s[i] == '0' and l[len(l) - 1] == '0':
				l = l + '1' + s[i]
			else:
				l = l + s[i]
		print(l)


import math
import atexit
import io
import sys
_OUTPUT_BUFFER = io.StringIO()
sys.stdout = _OUTPUT_BUFFER

@atexit.register
def write():
	sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())

def array_to_string(a):
	s = ''
	for i in a:
		s += str(i)
	return s
t = int(input())
while t > 0:
	t = t - 1
	line = input()
	n = len(line)
	if line.count('0') == n:
		print(line)
	elif line.count('1') == n:
		print(line)
	else:
		for i in range(2 * n):
			if i % 2 == 0:
				print('0', end='')
			else:
				print('1', end='')
		print()


def solve(t):
	period = 1
	same = True
	for i in range(1, len(t)):
		if t[i] != t[i - 1]:
			same = False
			break
	if same:
		return t
	sc = [t[0]]
	for i in range(1, len(t)):
		if t[i] == sc[-1]:
			sc.append(str(int(not int(sc[-1]))))
		sc.append(t[i])
	return ''.join(sc)
T = int(input())
for i in range(T):
	t = input()
	print(solve(t))


t = int(input())
for _ in range(t):
	s = input()
	if s.count('0') == len(s):
		print(s)
	elif s.count('1') == len(s):
		print(s)
	else:
		print('01' * len(s))


import sys
I = sys.stdin.readline
ans = ''
for _ in range(int(I())):
	s = I().strip()
	if '0' in s and '1' in s:
		ans += str('01' * len(s)) + '\n'
	else:
		ans += s + '\n'
print(ans)


mod = 998244353
t = int(input())
for _ in range(t):
	s = input()
	l = list(s)
	a = l.count('0')
	b = l.count('1')
	n = len(s)
	if a == 0 or b == 0:
		print(s)
	else:
		z = ''
		i = 0
		while i < n - 1:
			if s[i] == s[i + 1]:
				if s[i] == '1':
					z += s[i] + '0'
				else:
					z += s[i] + '1'
			else:
				z += s[i]
			i += 1
		if i == n - 1:
			z += s[n - 1]
		print(z)


c = int(input())
while c:
	t = str(input())
	if len(t) <= 2:
		print(t)
	elif '0' not in t or '1' not in t:
		print(t)
	else:
		if t[0] == '0':
			print('01' * (len(t) - 1))
		if t[0] == '1':
			print('10' * (len(t) - 1))
	c = c - 1


def factorise(m):
	ans = []
	p = 2
	while m != 1:
		if m % p != 0:
			p += 1
			continue
		e = 0
		while m % p == 0:
			m //= p
			e += 1
		ans.append([p, e])
		p += 1
	return ans

def mulmod(a, b, c):
	res = a * b
	if res >= c:
		res %= c
	return res

def mod_inverse(a, n):
	N = n
	xx = 0
	yy = 1
	y = 0
	x = 1
	while n > 0:
		q = a // n
		t = n
		n = a % n
		a = t
		t = xx
		xx = x - q * xx
		x = t
		t = yy
		yy = y - q * yy
		y = t
	x %= N
	x += N
	x %= N
	return x

def expo(a, b):
	x = 1
	y = a
	while b > 0:
		if b & 1:
			x = x * y
		y = y * y
		b >>= 1
	return x

def power(a, b, c):
	x = 1
	y = a
	while b > 0:
		if b & 1:
			x = mulmod(x, y, c)
		y = mulmod(y, y, c)
		b >>= 1
	return x

def init(p, pk):
	fact = []
	fact.append(1)
	for i in range(1, pk):
		red = i
		if red % p == 0:
			red = 1
		fact.append(mulmod(fact[i - 1], red, pk))
	return fact

def fact_mod(n, p, pk, fact):
	res = 1
	while n > 0:
		times = n // pk
		res = mulmod(res, power(fact[pk - 1], times, pk), pk)
		res = mulmod(res, fact[n % pk], pk)
		n //= p
	return res

def count_fact(n, p):
	ans = 0
	while n > 0:
		ans += n // p
		n //= p
	return ans

def ncr_pk(n, r, p, e):
	if r > n or r < 0:
		return 0
	if r == 0 or n == r:
		return 1
	_e = count_fact(n, p) - count_fact(r, p) - count_fact(n - r, p)
	assert _e >= 0
	if _e >= e:
		return 0
	pk = expo(p, e)
	fact = init(p, pk)
	ans = fact_mod(n, p, pk, fact)
	ans = mulmod(ans, mod_inverse(fact_mod(r, p, pk, fact), pk), pk)
	ans = mulmod(ans, mod_inverse(fact_mod(n - r, p, pk, fact), pk), pk)
	ans = mulmod(ans, expo(p, _e), pk)
	return ans

def pre_process(rem, mods):
	crt = []
	a = 1
	b = 1
	m = mods[0]
	crt.append([mods[0], a, b])
	L = len(mods)
	for i in range(1, L):
		a = mod_inverse(m, mods[i])
		b = mod_inverse(mods[i], m)
		crt.append([m, a, b])
		m *= mods[i]
	assert len(crt) == len(mods)
	return crt

def find_crt(rem, mods, crt):
	assert len(crt) == len(mods)
	ans = rem[0]
	m = crt[0][0]
	L = len(mods)
	for i in range(1, L):
		a = crt[i][1]
		b = crt[i][2]
		m = crt[i][0]
		_m = m * mods[i]
		ans = mulmod(ans, b * mods[i], _m)
		ans = (ans + mulmod(rem[i], a * m, _m)) % _m
	return ans

def ncr(n, r, m):
	pf = factorise(m)
	rem = []
	mods = []
	L = len(pf)
	for i in range(L):
		get = ncr_pk(n, r, pf[i][0], pf[i][1])
		rem.append(get)
		mods.append(expo(pf[i][0], pf[i][1]))
	crt = pre_process(rem, mods)
	ans = find_crt(rem, mods, crt)
	return ans

def add(a, b, c):
	res = a + b
	if res >= c:
		return res - c
	else:
		return res

def mod(a, b, c):
	res = a * b
	if res >= c:
		return res % c
	else:
		return res

def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a

def lcm(a, b):
	w = a // gcd(a, b)
	return w * b

def expo(a, b):
	(x, y) = (1, a)
	while b > 0:
		if b & 1:
			x = x * y
		y = y * y
		b >>= 1
	return x

def power(a, b, m):
	(x, y) = (1,)
	while b > 0:
		if b & 1:
			x = mod(x, y, m)
		y = mod(y, y, m)
		b >>= 1
	return x

def inv(a, m):
	return power(a, m - 2, m)

def mod_inverse(a, n):
	N = n
	xx = 0
	yy = 1
	y = 0
	x = 1
	while n > 0:
		q = a // n
		t = n
		n = a % n
		a = t
		t = xx
		xx = x - q * xx
		x = t
		t = yy
		yy = y - q * yy
		y = t
	x %= N
	x += N
	x %= N
	return x
import random
from queue import Queue

def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a

def expo(a, b):
	(x, y) = (1, a)
	while b > 0:
		if b & 1:
			x = x * y
		y = y * y
		b >>= 1
	return x
primes = [0] * 100000

def sieve():
	primes[1] = 1
	primes[2] = 2
	j = 4
	while j < 100000:
		primes[j] = 2
		j += 2
	j = 3
	while j < 100000:
		if primes[j] == 0:
			primes[j] = j
			i = j * j
			k = j << 1
			while i < 100000:
				primes[i] = j
				i += k
		j += 2

def rabin_miller(p):
	if p < 100000:
		return primes[p] == p
	if p % 2 == 0:
		return False
	s = p - 1
	while s % 2 == 0:
		s >>= 1
	for i in range(5):
		a = random.randrange(p - 1) + 1
		temp = s
		mod = pow(a, temp, p)
		while temp != p - 1 and mod != 1 and (mod != p - 1):
			mod = mod * mod % p
			temp = temp * 2
		if mod != p - 1 and temp % 2 == 0:
			return False
	return True

def brent(N):
	if N % 2 == 0:
		return 2
	if N < 100000:
		return primes[N]
	(y, c, m) = (random.randint(1, N - 1), random.randint(1, N - 1), random.randint(1, N - 1))
	(g, r, q) = (1, 1, 1)
	while g == 1:
		x = y
		for i in range(r):
			y = (y * y % N + c) % N
		k = 0
		while k < r and g == 1:
			ys = y
			for i in range(min(m, r - k)):
				y = (y * y % N + c) % N
				q = q * abs(x - y) % N
			g = gcd(q, N)
			k = k + m
		r = r * 2
	if g == N:
		while True:
			ys = (ys * ys % N + c) % N
			g = gcd(abs(x - ys), N)
			if g > 1:
				break
	return g

def factorise(n):
	Q_1 = Queue()
	Q_2 = []
	Q_1.put(n)
	while not Q_1.empty():
		l = Q_1.get()
		if rabin_miller(l):
			Q_2.append(l)
			continue
		d = brent(l)
		if d == l:
			Q_1.put(l)
		else:
			Q_1.put(d)
			Q_1.put(l // d)
	return Q_2

def sieve():
	t = int(input())
	for _ in range(t):
		n = int(input())
		L = factorise(n)
		L.sort()
		i = 0
		while i < len(L):
			cnt = L.count(L[i])
			(print('%s^%s' % (L[i], cnt)),)
			i += cnt
		print

def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a

def mod_inverse(a, n):
	N = n
	xx = 0
	yy = 1
	y = 0
	x = 1
	while n > 0:
		q = a // n
		t = n
		n = a % n
		a = t
		t = xx
		xx = x - q * xx
		x = t
		t = yy
		yy = y - q * yy
		y = t
	x %= N
	x += N
	x %= N
	return x
primes = [0] * 1000000

def sieve():
	primes[1] = 1
	primes[2] = 2
	j = 4
	while j < 1000000:
		primes[j] = 2
		j += 2
	j = 3
	while j < 1000000:
		if primes[j] == 0:
			primes[j] = j
			i = j * j
			k = j << 1
			while i < 1000000:
				primes[i] = j
				i += k
		j += 2
from random import *
import time

def ilog2(n):
	return 0 if n <= 0 else n.bit_length() - 1

def pack(pack, shamt):
	size = len(pack)
	while size > 1:
		npack = []
		for i in range(0, size - 1, 2):
			npack += [pack[i] | pack[i + 1] << shamt]
		if size & 1:
			npack += [pack[-1]]
		(pack, size, shamt) = (npack, size + 1 >> 1, shamt << 1)
	return pack[0]

def unpack(M, size, shamt):
	(s, sizes) = (size, [])
	while s > 1:
		sizes += [s]
		s = s + 1 >> 1
	ret = [M]
	for size in sizes[::-1]:
		(mask, nret) = ((1 << shamt) - 1, [])
		for c in ret:
			nret += [c & mask, c >> shamt]
		(ret, shamt) = (nret[:size], shamt >> 1)
	return ret

def poly_mul(f, g, mod=1000000007):
	size = min(len(f), len(g))
	shift = ((mod - 1) ** 2 * size).bit_length()
	rsize = len(f) + len(g) - 1
	h = unpack(pack(f, shift) * pack(g, shift), rsize, shift * (1 << ilog2(rsize - 1)))
	return [int(x % mod) for x in h]
for _ in range(int(input())):
	s = input()
	if len(set(s)) == 1:
		print(s)
		continue
	a = ''
	for i in range(len(s) - 1):
		if s[i] == s[i + 1]:
			if s[i] == '1':
				a += '1' + '0'
			else:
				a += '0' + '1'
		else:
			a += s[i]
	a += s[len(s) - 1]
	print(a)


import sys
import math
from collections import defaultdict

def solve(t):
	t = input()
	n = len(t)
	(ones, zeros) = (0, 0)
	for c in t:
		if c == '1':
			ones += 1
		else:
			zeros += 1
	if ones == n or zeros == n:
		print(t)
	else:
		s = ''
		for i in range(n):
			if t[i] == '1':
				s += t[i] + '0'
			else:
				s += '1' + '0'
		print(s)
test_cases = int(input())
for t in range(1, test_cases + 1):
	solve(t)


for _ in range(int(input())):
	t = input()
	if '1' not in t or '0' not in t:
		print(t)
	else:
		x = ''.join(['10' for i in range(len(t))])
		print(x)


for _ in range(int(input())):
	s = input()
	if len(set(s)) == 1:
		print(s)
		continue
	a = ''
	for i in range(len(s) - 1):
		if s[i] == s[i + 1]:
			if s[i] == '1':
				a += '1' + '0'
			else:
				a += '0' + '1'
		else:
			a += s[i]
	a += s[len(s) - 1]
	print(a)


def generateBinaryString(string):
	s = list(string)
	if s.count('0') == len(string) or s.count('1') == len(string):
		print(string)
		return
	length = len(string) * 2
	tmp = '10' * (length // 2)
	w = list(tmp)
	if s.count('1') <= w.count('1') and s.count('0') <= w.count('0'):
		print(tmp)
t = int(input())
for x in range(t):
	generateBinaryString(input())


I = input
pr = print

def main():
	for _ in range(int(I())):
		s = I()
		if {*s} > {'0'}:
			pr('01' * len(s))
		else:
			pr(s)
main()


def main():
	s = input()
	n = len(s)
	first = s[0] * n
	if first == s:
		print(s)
		return
	o = ''
	if s[0] == '1':
		print('10' * n)
	else:
		print('01' * n)
for _ in range(int(input())):
	main()


for _ in range(int(input())):
	t = input()
	print(''.join(set(t)) * len(t))


def read_int():
	n = int(input())
	return n

def read_ints():
	ints = [int(x) for x in input().split(' ')]
	return ints

def solve(t):
	lmax = len(t) * 2
	sol = ''
	if t.find('0') == -1:
		period = '1'
	elif t.find('1') == -1:
		period = '0'
	elif t.find('01') == -1:
		period = '10'
	else:
		period = '01'
	lp = len(period)
	if lp == 1:
		return len(t) * period
	i = 0
	for j in range(len(t)):
		idx = i % 2
		val = period[idx]
		if val != t[j]:
			sol += val
			i += 1
		sol += t[j]
		i += 1
	return sol
T = read_int()
for case in range(T):
	t = input()
	sol = solve(t)
	print(sol)


t = input()
for _ in range(int(t)):
	s = input()
	n = len(s)
	if s.count('0') == 0:
		print('1' * n)
	elif s.count('1') == 0:
		print('0' * n)
	else:
		s1 = '10' * n
		n = len(s1)
		m = len(s)
		i = 0
		j = 0
		while j < m and i < n:
			if s[j] == s1[i]:
				j += 1
			i += 1
		if j >= m:
			print(s1)
		else:
			print('01' * len(s))


def main():
	from bisect import bisect_left as bl, bisect_right as br, insort
	import sys
	import heapq
	from collections import defaultdict as dd, deque

	def data():
		return sys.stdin.readline().strip()

	def mdata():
		return map(int, data().split())
	out = sys.stdout.write
	for i in range(int(data())):
		s = data()
		cnt1 = cnt2 = 0
		for i in range(len(s)):
			if s[i] == '1':
				cnt1 += 1
			else:
				cnt2 += 1
		if cnt1 == 0 or cnt2 == 0:
			print(s)
		else:
			s1 = s[0]
			for i in range(1, len(s)):
				if s[i] == s[i - 1]:
					s1 += str(1 - int(s[i])) + s[i]
				else:
					s1 += s[i]
			print(s1)
main()


t = int(input())
for i in range(t):
	s = input()
	a = s.find('1')
	b = s.find('0')
	if a < 0 or b < 0:
		print(s)
	else:
		print('01' * len(s))


def neg(ch):
	if ch == '0':
		return '1'
	return '0'
nt = int(input())
for _ in range(nt):
	t = input()
	s0 = 0
	s1 = 0
	for i in range(len(t)):
		if t[i] == '0':
			s0 += 1
		if t[i] == '1':
			s1 += 1
	if s0 == 0 or s1 == 0:
		print(t)
		continue
	print(t[0], end='')
	for i in range(1, len(t)):
		if t[i] == t[i - 1]:
			print(neg(t[i]), end='')
		print(t[i], end='')
	print()


t = int(input())
for _ in range(t):
	s = input()
	l = list(s)
	c = 1
	for i in range(1, len(l)):
		if l[i] == l[i - 1]:
			c = c + 1
	if c == len(l):
		print(s)
	else:
		ans = []
		ans.append(l[0])
		for i in range(1, len(l)):
			if l[i - 1] == '0' and l[i] == '0':
				ans.append('1')
			elif l[i - 1] == '1' and l[i] == '1':
				ans.append('0')
			ans.append(l[i])
		if len(ans) % 2 == 1:
			num = 1 - int(ans[-1])
			ans.append(str(num))
		print(''.join(ans))


for _ in range(int(input())):
	a = input()
	x = 0
	y = 0
	for i in a:
		if i == '0':
			x += 1
		else:
			y += 1
	if x == 0 or y == 0:
		print(a)
	else:
		print('10' * len(a))


t = int(input())
for test in range(t):
	t = input()
	s = list(set(t))
	s = ''.join((a for a in s))
	s = s * len(t)
	print(s)


t = int(input())
for case in range(t):
	t = input()
	if all((x == t[0] for x in t)):
		print(t)
	else:
		print('01' * len(t))


test = int(input())

def solve():
	n = input()
	if '0' not in n:
		print(n)
	elif '1' not in n:
		print(n)
	else:
		if n[0] == '0':
			n = '01' * (len(n) - 1)
		else:
			n = '10' * (len(n) - 1)
		print(n)
for x in range(test):
	solve()


def all_equal(a):
	for i in range(1, len(a)):
		if a[i] != a[i - 1]:
			return False
	return True
for _ in range(int(input())):
	a = input()
	a = list(a)
	if all_equal(a):
		print(''.join(a))
	else:
		i = 0
		while i < len(a):
			print('10', end='')
			i += 1
		print('')


from sys import stdin
input = stdin.readline
import bisect
import math
for xoxo in range(1):
	ans = ''
	for i in range(100):
		ans += '10'
	for _ in range(int(input())):
		s = input()
		l = len(s)
		l -= 1
		p = s.count('0')
		if p == l or p == 0:
			print(s, end='')
		else:
			print(ans[:2 * l])


for _ in range(int(input())):
	s = input()
	s1 = list(map(int, list(s)))
	if sum(s1) == 0 or sum(s1) == len(s):
		print(s)
	else:
		ans = []
		for i in range(1, len(s)):
			if s[i] == s[i - 1]:
				ans.append([i + len(ans), 1 - s1[i]])
		for i in ans:
			s1.insert(i[0], i[1])
		print(*s1, sep='')


def period(string):
	n = len(string)
	for i in range(1, n + 1):
		count = string.count(string[0:i])
		if count * i == n:
			return string[0:i]
for i in range(int(input())):
	string = input()
	n = len(string)
	period_str = period(string)
	len_per = len(period_str)
	if len_per == 1 or len_per == 2:
		print(string)
	else:
		final_string = ''
		final_string += string[0]
		for i in range(1, n):
			if string[i] == final_string[-1]:
				if string[i] == '0':
					final_string += '1'
					final_string += '0'
				else:
					final_string += '0'
					final_string += '1'
			else:
				final_string += string[i]
		if final_string[-1] == final_string[0]:
			final_string += final_string[1]
		print(final_string)


for _ in range(int(input())):
	st = input()
	lst = []
	for i in st:
		lst.append(i)
	if len(set(lst)) == 1 or len(lst) == 2:
		print(st)
	else:
		a = len(st)
		lst2 = ['10'] * a
		print(''.join(lst2))


t = int(input())
for _ in range(t):
	s = input()
	if s.count(s[0]) == len(s):
		print(s[0] * len(s))
		continue
	ans = s[0]
	i = 1
	while i != len(s):
		if s[i] == ans[-1]:
			if s[i] == '0':
				ans += '1'
			else:
				ans += '0'
		else:
			ans += s[i]
			i += 1
	print(ans)


def createString(s):
	res = s[0]
	v = '0'
	if s[0] == '0':
		v = '1'
	i = 1
	while i < len(s):
		e = s[i]
		if v == e:
			i += 1
		res += v
		if v == '0':
			v = '1'
		else:
			v = '0'
	return res
t = int(input())
while t > 0:
	s = input()
	c1 = 0
	c0 = 0
	for i in s:
		if i == '0':
			c0 += 1
		else:
			c1 += 1
	if 0 in (c0, c1):
		print(s)
	else:
		print(createString(s))
	t -= 1


for _ in range(int(input())):
	t = input()
	if len(t) == 2 or len(t) == 1:
		print(t)
	elif len(set(list(t))) == 1:
		print(t)
	else:
		s = ''
		n = len(t) * 2
		for i in range(n):
			if i % 2 == 0:
				s += '1'
			else:
				s += '0'
		print(s)


t = int(input())
while t:
	t -= 1
	s = [int(i) for i in input()]
	if 0 not in s or 1 not in s:
		print(''.join(map(str, s)))
	else:
		print('10' * len(s))


import collections as cc
I = lambda : list(map(int, input().split()))
for tc in range(int(input())):
	s = input()
	if len(set(s)) == 1:
		print(s)
	else:
		print('10' * len(s))


def answer(s):
	if s == '0' * len(s) or s == '1' * len(s):
		return s
	w = ''
	for i in range(2 * len(s)):
		if i % 2 == 0:
			w += '1'
		else:
			w += '0'
	return w
t = int(input())
for i in range(t):
	s = input()
	print(answer(s))


from sys import stdin, stdout
_input = stdin.readlines()
tests = int(_input[0])
for test in range(1, tests + 1):
	t = _input[test].strip()
	if t.count('0') == len(t) or t.count('1') == len(t):
		stdout.write(t + '\n')
	else:
		s = ['1', '0'] * len(t)
		stdout.write(''.join(s) + '\n')


def solve(t):
	z = 0
	o = 0
	for c in t:
		if c == '0':
			z += 1
		else:
			o += 1
	if z == 0 or o == 0:
		return t
	f = t[0]
	if f == '0':
		return len(t) * '01'
	else:
		return len(t) * '10'
tc = int(input())
for kase in range(tc):
	t = input()
	s = solve(t)
	print(s)


for _ in range(int(input())):
	s = input()
	zr = 0
	one = 0
	for i in s:
		if i == '0':
			zr += 1
		else:
			one += 1
	ans = ''
	if one == 0:
		ans = '0' * (len(s) * 2)
	elif zr == 0:
		ans = '1' * (len(s) * 2)
	elif zr > one:
		ans = '10' * len(s)
	elif zr <= one:
		ans = '01' * len(s)
	print(ans)


T = int(input())
for _ in range(T):
	t = str(input())
	zero_count = 0
	one_count = 0
	if '0' not in t or '1' not in t:
		print(t)
	elif t[0] == '1':
		print('10' * len(t))
	elif t[0] == '0':
		print('01' * len(t))


import sys
import math
import itertools
import functools
import collections
import operator
import fileinput
import copy
ORDA = 97

def ii():
	return int(input())

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

def li():
	return [int(i) for i in input().split()]

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def revn(n):
	return str(n)[::-1]

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=1):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base):
	newnumber = 0
	while number > 0:
		newnumber += number % base
		number //= base
	return newnumber

def cdiv(n, k):
	return n // k + (n % k != 0)
for _ in range(ii()):
	t = input()
	if len(t) < 3 or len(set(t)) == 1:
		print(t)
	elif t[0] == '0':
		print('01' * len(t))
	else:
		print('10' * len(t))


from sys import stdin, stdout
for query in range(int(stdin.readline())):
	t = list(stdin.readline().strip())
	y = [True, t[0]]
	for x in t:
		if x != y[1]:
			y[0] = False
	if y[0]:
		for x in t:
			stdout.write(x)
		stdout.write('\n')
	else:
		answer = [t[0]]
		for x in range(2 * len(t) - 1):
			if answer[x] == '0':
				answer.append('1')
			else:
				answer.append('0')
		for x in answer:
			stdout.write(x)
		stdout.write('\n')


for _ in range(int(input())):
	x = input().strip()
	if x.count('1') == 0 or x.count('0') == 0:
		print(x)
		continue
	ans = '01' * len(x)
	print(ans)


for _ in range(int(input())):
	s = input()
	if '1' in s and '0' in s:
		if s[0] == '0':
			print('01' * len(s))
		else:
			print('10' * len(s))
	else:
		print(s)


import sys
tc = int(sys.stdin.readline())
for _ in range(tc):
	arr = list(map(int, sys.stdin.readline().rstrip()))
	only_one = True
	only_zero = True
	for i in arr:
		if not i:
			only_one = False
		else:
			only_zero = False
	if only_one and (not only_zero):
		print(''.join(map(str, arr)))
	elif not only_one and only_zero:
		print(''.join(map(str, arr)))
	elif arr[0] == 1:
		print('10' * len(arr))
	else:
		print('01' * len(arr))


for _ in range(int(input())):
	s = input()
	print(''.join(set(s)) * len(s))


import sys

def I():
	return sys.stdin.readline().rstrip()
for _ in range(int(I())):
	t = I()
	z = sum((1 for c in t if c == '0'))
	if z == len(t) or z == 0:
		print(t)
	else:
		s = [t[0]]
		for c in t[1:]:
			if s[-1] == c:
				s.append('1' if c == '0' else '0')
			s.append(c)
		print(''.join(s))


T = int(input())
S = [input() for _ in range(T)]
for s in S:
	st = set(s)
	if len(st) == 1:
		print(s)
	else:
		ans = ''
		for i in range(len(s) - 1):
			ans += s[i]
			if s[i] == s[i + 1]:
				if s[i] == '1':
					ans += '0'
				else:
					ans += '1'
		ans += s[-1]
		print(ans)


n = int(input())
for _ in range(n):
	t = input()
	a = 0
	b = 0
	for i in range(len(t)):
		if t[i] == '0':
			a += 1
		else:
			b += 1
	if a == 0 or b == 0:
		print(t)
	elif t[0] == '0':
		print('01' * len(t))
	else:
		print('10' * len(t))


from sys import stdin
input = stdin.readline
for _ in range(int(input())):
	t = input().strip()
	a = t.count('1')
	n = len(t)
	if a == 0 or a == n or n == 2:
		print(t)
	else:
		print('10' * n)


t = int(input())
for i in range(t):
	(a, b) = (0, 0)
	s = input()
	for c in s:
		if c == '0':
			a = a + 1
		else:
			b = b + 1
	if a == 0 or b == 0:
		print(s)
	else:
		print((a + b) * '10')


t = int(input())
for _ in range(t):
	s = input()
	f = True
	for i in range(1, len(s)):
		if s[i] != s[i - 1]:
			f = False
	if f:
		print(s)
	else:
		ans = ''
		for (k, c) in enumerate(s):
			if k > 0 and s[k - 1] == s[k]:
				ans += '1' if s[k] == '0' else '0'
			ans += c
		print(ans)


for _ in range(int(input())):
	s = input()
	of = '1' in s
	zf = '0' in s
	if of and zf:
		ans = '10' * len(s)
		print(ans)
	else:
		print(s)


for _ in range(int(input())):
	s = input()
	n = len(s)
	c1 = s.count('1')
	c0 = s.count('0')
	if c1 == 0 or c0 == 0:
		print(s)
		continue
	t = ''
	x = '01' if s[0] == '0' else '10'
	for i in range(n):
		t += x
	print(t)


test = int(input())
for t in range(test):
	t = input()
	ini = t[0]
	yes = True
	for i in range(len(t)):
		if t[i] != ini:
			yes = False
			break
	if yes:
		print(t)
		continue
	elif t == '01' or t == '10':
		print(t)
		continue
	elif ini == '0':
		print('01' * len(t))
	else:
		print('10' * len(t))


n = int(input())
for i in range(0, n):
	s = input().rstrip()
	x = list(s)
	A = x.count('0')
	B = x.count('1')
	if len(x) <= 2:
		print(''.join(x))
	elif A == len(x):
		x = x + x
		print(''.join(x))
	elif B == len(x):
		x = x + x
		print(''.join(x))
	else:
		for j in range(0, len(x) * 2):
			if j % 2 == 0:
				print('1', end='')
			else:
				print('0', end='')
		print()


for _ in range(int(input())):
	t = input()
	s = set(list(t))
	if len(s) == 1:
		print(t)
	else:
		ls = ''
		x = 0
		while x < 2 * len(t):
			if x % 2 == 0:
				ls += '0'
			else:
				ls += '1'
			x += 1
		print(ls)


import math
num_case = int(input())

def invert(char):
	return '1' if char == '0' else '0'
for i in range(num_case):
	se = input()
	if se == '00' or se == '01' or se == '10' or (se == '11'):
		print(se)
	else:
		new_str = ''
		temp = True
		for i in range(len(se) - 1):
			if se[i] != se[i + 1]:
				temp = False
		if temp == True:
			print(se + se)
		else:
			for i in range(len(se) - 1):
				new_str += se[i]
				if se[i] == se[i + 1]:
					new_str += invert(se[i])
			c = len(se) - 1
			new_str += se[c]
			if len(new_str) % 2 == 1:
				new_str += invert(se[c])
			print(new_str)


import sys
t = int(input())
for _ in range(t):
	str = input()
	result = ''
	index = 0
	if '0' in str and '1' in str:
		for c in str:
			result += '01'
	else:
		result = str
	print(result)


for T in range(int(input())):
	t = input()
	s = ''
	if len(t) <= 2:
		print(t)
		continue
	if len(t) == t.count('1'):
		print(t)
		continue
	if len(t) == t.count('0'):
		print(t)
		continue
	n = len(t)
	ans = '01' * n
	print(ans)


for _ in range(int(input())):
	t = input()
	if t.count('0') == 0 or t.count('1') == 0:
		print(t)
		continue
	s = t[0]
	for d in t[1:]:
		if d == s[-1]:
			s += str(1 - int(d))
		s += d
	print(s)


N = int(input())
for i in range(N):
	n = list(map(str, input()))
	l = []
	c1 = 0
	c = 0
	for i in range(1, len(n)):
		if n[i] != n[i - 1]:
			c1 = c1 + 1
	c = (c1 + 1) // 2
	if c == 0:
		print(''.join(n))
	else:
		if n[0] == 0:
			for i in range(len(n)):
				l.append('0')
				l.append('1')
		else:
			for i in range(len(n)):
				l.append('1')
				l.append('0')
		print(''.join(l))


test = int(input())
for tes in range(test):
	s = str(input())
	if len(set(s)) == 1:
		print(s[0] * len(s))
	else:
		print('01' * len(s))


t = int(input())
for i in range(t):
	s = input()
	ss = ''
	one = s.count('1')
	zero = s.count('0')
	if one == len(s) or zero == len(s):
		print(s)
	else:
		ch = s[0]
		if ch == '1':
			for j in range(2 * len(s) - 1):
				if j % 2 == 0:
					ss = ss + '1'
				else:
					ss = ss + '0'
		else:
			for j in range(2 * len(s) - 1):
				if j % 2 == 0:
					ss = ss + '0'
				else:
					ss = ss + '1'
		print(ss)


t = int(input())
for oo in range(t):
	s = input()
	n = len(s)
	g = s[0] * n
	if s == g:
		print(s)
	else:
		print('10' * n)


test_count = int(input())
for test in range(test_count):
	t = list(input())
	if max(t) == min(t):
		for each in t:
			print(each, end='')
	else:
		val = True
		for index in range(2 * len(t)):
			print(int(val), end='')
			val = not val
	print()


a = int(input())
for i in range(a):
	x = list(input())
	if '1' in x and '0' not in x:
		print('1' * x.count('1'))
	elif '0' in x and '1' not in x:
		print('0' * x.count('0'))
	elif x[0] == '0':
		w = len(x) - 1
		print(w * '01')
	elif x[0] == '1':
		w = len(x) - 1
		print(int(w * '10'))


import itertools
for r in itertools.permutations(range(3)):
	pass
for _ in range(int(input())):
	a = input()
	if '0' not in a or '1' not in a:
		print(a)
	else:
		print('01' * len(a))


for _ in range(int(input())):
	s = input()
	count0 = 0
	count1 = 0
	for i in range(len(s)):
		if s[i] == '0':
			count0 += 1
		else:
			count1 += 1
	if count1 == 0 or count0 == 0:
		print(s)
	else:
		p = ''
		if s[0] == '1':
			for i in range(len(s)):
				p += '10'
			print(p)
		else:
			for i in range(len(s)):
				p += '01'
			print(p)


for i in range(int(input())):
	S = input()
	print(''.join(set(S)) * len(S))


from sys import setrecursionlimit
from collections import deque
import heapq
import functools
import itertools

def IntInput():
	return int(input())

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

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

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

def modInverse(p, a, m):
	return p % m * pow(a % m, m - 2, m) % m
for _ in range(int(input())):
	s = input()
	if s == s[0] * len(s):
		print(s)
	else:
		ans = s[0]
		for i in s[1:]:
			if i != ans[-1]:
				ans += i
			else:
				ans += str((int(ans[-1]) + 1) % 2) + i
		print(ans)


from collections import Counter
from _collections import defaultdict
import math
rs = lambda : input().strip()
ri = lambda : int(input())
rl = lambda : list(map(int, input().split()))
rls = lambda : list(map(str, input().split()))
t = int(input())
for _ in range(0, t):
	s = input()
	a = []
	b = []
	f = 1
	n = len(s)
	d = dict()
	d[1] = 0
	d[0] = 0
	k = set(s)
	if len(set(s)) == 1:
		print(s)
	else:
		print(len(s) * '10')


from collections import deque, defaultdict, Counter
from itertools import product, groupby, permutations, combinations, accumulate, zip_longest, combinations_with_replacement
from math import gcd, floor, inf, log2, sqrt, log10, factorial
from bisect import bisect_right, bisect_left
from statistics import mode
from string import ascii_lowercase
cases = int(input())
for _ in range(cases):
	s = input()
	if len(set(s)) == 1:
		print(s)
	else:
		print('10' * len(s))


t = int(input())
for _ in range(t):
	a = input()
	if len(set([c for c in a])) > 1:
		s = a[0]
		for ai in a[1:]:
			if ai != s[-1]:
				s += ai
			elif ai == '0':
				s += '1' + ai
			else:
				s += '0' + ai
		print(s)
	else:
		print(a)


for _ in range(int(input())):
	s = input()
	if '0' not in s or '1' not in s:
		print(s)
	else:
		s1 = '0'
		for ele in s:
			if s1[-1] == ele:
				pass
			else:
				s1 += ele
			if ele == '0':
				s1 += '1'
			else:
				s1 += '0'
		print(s1)


for i in range(int(input())):
	t = str(input())
	l = list(t)
	if len(l) == 1 or len(l) == 2:
		print(t)
	elif '0' not in l:
		print(t)
	elif '1' not in l:
		print(t)
	elif l[0] == '1':
		print('10' * len(l))
	else:
		print('01' * len(l))


for _ in range(int(input())):
	l = input()
	s = ''
	i = 0
	curr = l[0]
	prev = '0'
	arr = ['1', '0']
	if len(set(l)) == 1:
		print(l)
		continue
	while i < len(l):
		curr = l[i]
		if curr == prev:
			s += arr[int(curr)]
		s += curr
		prev = curr
		i += 1
	print(s)


import sys
from collections import defaultdict as dd

def data():
	return sys.stdin.readline().strip()

def out(var):
	sys.stdout.write(str(var))

def l():
	return list(sp())

def strl():
	return list(strsp())

def sp():
	return map(int, data().split())

def strsp():
	return map(str, data().split())
for _ in range(int(data())):
	t = data()
	d = []
	if t.count('1') == 0:
		print(t)
	elif t.count('0') == 0:
		print(t)
	else:
		l = len(t)
		if t[0] == '0' and t[l - 1] == '1':
			print('01' * l)
		else:
			print('10' * l)


t = int(input())
while t > 0:
	s = input()
	temp = 10000
	for i in range(1, 101):
		f = True
		for j in range(len(s) - i):
			if s[j] != s[j + i]:
				f = False
				break
		if f:
			temp = min(i, temp)
			break
	if temp == 2 or temp == 1:
		print(s)
		t -= 1
		continue
	fin_ans = ''
	fin_ans += s[0]
	for i in range(1, 2 * len(s)):
		if fin_ans[i - 1] == '0':
			fin_ans += '1'
		else:
			fin_ans += '0'
	print(fin_ans)
	t -= 1


for i in range(int(input())):
	s = list(input())
	i = 0
	flag = 0
	if s.count('1') == 0 or s.count('0') == 0:
		s = ''.join(s)
		print(s)
		flag = 1
	if flag == 0:
		while i < len(s) - 1:
			if s[i] == '1' and s[i + 1] == '1':
				s.insert(i + 1, '0')
			elif s[i] == '0' and s[i + 1] == '0':
				s.insert(i + 1, '1')
			i += 1
		s = ''.join(s)
		print(s)


ntest = int(input())
for i in range(ntest):
	t = str(input())
	atest = t[0]
	b = True
	for i in range(len(t)):
		if t[i] != atest:
			b = False
	if b:
		print(t)
	else:
		s = [t[0]]
		for j in range(1, len(t)):
			if int(atest) == 0:
				if int(t[j]) != int(atest):
					s.append(str(t[j]))
					atest = t[j]
				else:
					s.append(str(1))
					s.append(str(0))
			elif int(t[j]) != int(atest):
				s.append(str(t[j]))
				atest = t[j]
			else:
				s.append(str(0))
				s.append(str(1))
		s_str = ''.join(s)
		print(s_str)


T = int(input())
for _ in range(T):
	t = input()
	ans = ''
	if len(set(t)) == 1:
		ans = t
	x = [0, 0]
	for i in t:
		if i == '0':
			x[0] += 1
		else:
			x[1] += 1
	if x[0] == 0 or x[1] == 0:
		print(t, end='')
	else:
		temp = sum(x)
		for i in range(2 * temp):
			if i % 2 == 0:
				print('1', end='')
			else:
				print('0', end='')
	print()


t = int(input())
for i in range(t):
	flag = False
	binstr = list(input())
	if binstr[0] == '1':
		flag = True
	zerocnt = 0
	onecnt = 0
	for walker in binstr:
		if walker == '1':
			onecnt += 1
		else:
			zerocnt += 1
	if zerocnt == 0 or onecnt == 0:
		print(''.join(binstr))
	elif zerocnt >= onecnt:
		if flag:
			print('10' * len(binstr))
		else:
			print('01' * len(binstr))
	elif onecnt > zerocnt:
		if flag:
			print('10' * len(binstr))
		else:
			print('01' * len(binstr))


for i in range(int(input())):
	s = input()
	if len(set(s)) == 1:
		print(s)
	else:
		l = len(s)
		x = ['01'] * l
		print(''.join(x))


t = int(input())
for i in range(t):
	arr = list(input())
	count0 = 0
	count1 = 0
	for j in range(len(arr)):
		if arr[j] == '0':
			count0 += 1
		else:
			count1 += 1
	if count0 == 0 or count1 == 0:
		print(''.join(arr))
	else:
		first = arr[0]
		if first == '1':
			for j in range(1, len(arr)):
				print('10', end='')
			print()
		else:
			for j in range(1, len(arr)):
				print('01', end='')
			print()


t = int(input())
while t > 0:
	s = input()
	if '0' in s and '1' not in s or ('0' not in s and '1' in s):
		print(s)
	else:
		ans = ''
		n = len(s)
		while len(ans) < 2 * len(s):
			ans += '01'
		print(ans)
	t -= 1


import sys
input = sys.stdin.readline

def solve(s):
	if len(set(s)) == 1:
		return ''.join(s)
	l = len(s)
	if s[0] == '0':
		return '0' + '10' * (l - 1)
	return '1' + '01' * (l - 1)

def main():
	t = int(input())
	for _ in range(t):
		s = tuple(input().strip())
		ans = solve(s)
		sys.stdout.write(str(ans) + '\n')
main()


T = int(input())
while T:
	arr = list(input())
	if len(arr) <= 2:
		print(''.join(map(str, arr)))
	elif arr.count('1') == len(arr) or arr.count('0') == len(arr):
		print(''.join(map(str, arr)))
	else:
		ans = []
		n = len(arr)
		i = 0
		while i < n - 1:
			if arr[i] == arr[i + 1]:
				if arr[i] == '1':
					arr.insert(i + 1, '0')
				else:
					arr.insert(i + 1, '1')
				n += 1
			i += 1
		print(''.join(map(str, arr)))
	T -= 1


from math import *

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

def main():
	s = input()
	n = len(s)
	if s == '1' * n or s == '0' * n:
		print(s)
		return 0
	prev = int(s[0]) ^ 1
	for i in s:
		x = int(i)
		if prev == x:
			print(x ^ 1, end='')
		print(x, end='')
		prev = x
	print()
tt = 1
tt = int(input())
for _ in range(tt):
	main()


t = int(input())

def homo(t):
	n = len(t)
	x = t[0]
	for i in range(n):
		if x != t[i]:
			return False
	return True
for _ in range(t):
	t = input()
	n = len(t)
	if homo(t):
		print(t)
	else:
		print('10' * n)


from collections import Counter
import math
mod = 10 ** 9 + 7
for i in range(int(input())):
	s = input()
	flag = 0
	for i in range(len(s) - 1):
		if s[i] != s[i + 1]:
			flag = 1
	if flag == 0:
		print(s)
	else:
		ans = ''
		for i in range(2 * len(s)):
			if i % 2 == 0:
				ans += '0'
			else:
				ans += '1'
		print(ans)


t = int(input())
for i in range(t):
	s = input()
	if s.count('0') == 0 or s.count('1') == 0:
		print(s)
		continue
	ans = s[0]
	for j in range(1, len(s)):
		if s[j] == '0' and s[j - 1] != '1':
			ans += '1'
		if s[j] == '1' and s[j - 1] != '0':
			ans += '0'
		ans += s[j]
	print(ans)


for _ in range(int(input())):
	s = list(input())
	if len(s) == s.count(s[0]):
		print(''.join(s))
	else:
		if s[0] == '1':
			a = '10' * (len(s) - 1)
		else:
			a = '01' * (len(s) - 1)
		print(a)


t = int(input())
for i in range(t):
	row = list(input())
	if '0' in row and '1' in row:
		output_str = [row[0]]
		for i in range(1, len(row)):
			if row[i] == output_str[-1]:
				output_str.append(str((int(row[i]) + 1) % 2))
			output_str.append(row[i])
		print(''.join(output_str))
	else:
		print(''.join(row))


t = int(input())
for _ in range(t):
	s = list(map(int, list(input())))
	n = len(s)
	summa = sum(s)
	if summa == 0:
		print('0' * n)
	elif summa == n:
		print('1' * n)
	else:
		print('01' * n)


for _ in range(int(input())):
	s = input()
	(a, b) = (s.count('0'), s.count('1'))
	if a == 0 or b == 0:
		print(s)
	else:
		print('01' * len(s))


T = int(input())
for i in range(T):
	t = input()
	s = t[0]
	flag = 0
	for j in range(len(t)):
		if t[j] != s:
			flag = 1
			break
	if flag:
		if t[0] == '0':
			for j in range(len(t) * 2):
				print(j % 2, end='')
			print()
		else:
			for j in range(len(t) * 2):
				print((j + 1) % 2, end='')
			print()
	else:
		print(t)


for _ in range(int(input())):
	X = input()
	Size = len(X)
	if len(set(X)) == 1 or Size == 2:
		print(X)
	elif X[0] == '1':
		print('10' * Size)
	else:
		print('01' * Size)


t = int(input())
for _ in range(t):
	s = input()
	if len(s) <= 2:
		print(s)
		continue
	prev = s[0]
	flag = 0
	for i in range(1, len(s)):
		if s[i] != prev:
			flag = 1
			break
	if flag == 0:
		print(s)
	else:
		ans = ''
		for i in range(len(s)):
			ans = ans + '10'
		print(ans)


t = int(input())
while t > 0:
	a = input()
	if a == a[0] * len(a):
		print(a)
	else:
		x = 0
		for i in range(1, len(a)):
			if a[i] == a[i - 1]:
				x += 1
		l = len(a) + x
		if l % 2 != 0:
			l += 1
		if a[0] == '0':
			print('01' * (l // 2))
		else:
			print('10' * (l // 2))
	t -= 1


for t in range(int(input())):
	s = input()
	x = 0
	for i in range(1, len(s)):
		if s[i] != s[i - 1]:
			x = 1
			break
	if x == 0:
		print(s)
	else:
		ans = []
		ans.append(s[0])
		for i in range(1, len(s)):
			if s[i] == ans[-1]:
				if s[i] == '1':
					ans.append(0)
				else:
					ans.append(1)
				ans.append(s[i])
			else:
				ans.append(s[i])
		print(''.join((str(x) for x in ans)))


T = int(input())
for test in range(T):
	string = input()
	strlen = len(string)
	compl = []
	zeros = 0
	for c in string:
		if c == '0':
			zeros += 1
	if zeros == 0 or zeros == strlen:
		output = string
	else:
		output = '10' * strlen
	print(output)


def solve(arr):
	n = len(arr)
	if n == 1:
		return ''.join(arr)
	else:
		if arr[0] == arr[1]:
			if len(set(arr)) == 1:
				return ''.join(arr)
			else:
				return '01' * n
		if arr[0] != arr[1]:
			for i in range(2, n, 2):
				if arr[0] == arr[i]:
					pass
				else:
					return '01' * n
			for i in range(3, n, 2):
				if arr[1] == arr[i]:
					pass
				else:
					return '01' * n
			return ''.join(arr)
for i in range(int(input())):
	n = list(input())
	print(solve(n))


import math as mt
import sys, string, bisect
input = sys.stdin.readline
import random
from collections import deque, defaultdict
L = lambda : list(map(int, input().split()))
Ls = lambda : list(input().split())
M = lambda : map(int, input().split())
I = lambda : int(input())
n = I()
for _ in range(n):
	t = input().strip()
	k = 0
	if len(t) == 1:
		print(t)
	else:
		k = 0
		for i in range(1, len(t)):
			if t[i] != t[i - 1]:
				x = t[i - 1] + t[i]
				for j in range(len(t) * 2):
					print(x[j % 2], end='')
				print()
				k = 1
				break
		if k == 0:
			print(t)


def func(n):
	if n % 2:
		return 0
	n /= 2
	if n % 2:
		return 1
	return 2
for _ in range(int(input())):
	str = input()
	ssaa = 0
	aaa = 1 + 2222
	if str == '1' * len(str) or str == '0' * len(str):
		print(str)
	else:
		p = 1
		sss = str[0]
		for i in range(1, len(str)):
			aaa += 222
			if str[i] == str[i - 1]:
				aaa += 222
				if str[i] == '0':
					sss += '10'
				else:
					sss += '01'
			else:
				sss += str[i]
		print(sss)


from sys import stdin, stdout, setrecursionlimit
from math import ceil
for _ in range(int(input())):
	s = input()
	if '1' in s and '0' in s:
		print('01' * len(s))
	else:
		print(s)


t = int(input())
for i in range(t):
	a = input()
	s = set(a)
	if len(s) == 1:
		print(a)
	else:
		t = len(a)
		if '10' in a:
			print('10' * t)
		elif '01' in a:
			print('01' * t)


for _ in range(int(input())):
	s = input()
	n = len(s)
	if len(s) == 1:
		print(s[0] + s[0])
	elif '01' in s:
		print('01' * len(s))
	elif '10' in s:
		print('10' * len(s))
	else:
		print(s + s[0])


ans = []
for _ in range(int(input())):
	t = input()
	n = len(t)
	if t == '1' * n or t == '0' * n:
		ans.append(t)
		continue
	s = t[0]
	for x in t[1:]:
		if x != s[-1]:
			s += x
		elif x == '1':
			s += '01'
		else:
			s += '10'
	ans.append(s)
print('\n'.join(ans))


import sys
from itertools import islice
stdin = sys.stdin
t = int(stdin.readline())
for line in stdin:
	if not line:
		break
	t = line.strip()
	if len(set(t)) == 1:
		print(t)
	else:
		addons = 0
		for (a, b) in zip(t, t[1:]):
			if a == b:
				addons += 1
		l = t[0]
		for i in range(addons + len(t)):
			print(l, end='')
			if l == '1':
				l = '0'
			elif l == '0':
				l = '1'
		print()


T = int(input())
for tc in range(T):
	t = input()
	if '1' in t and '0' in t:
		if t[0] == '0':
			i = 0
			c1 = 0
			uc1 = 0
			count0 = 0
			while i < len(t):
				if t[i] == 0:
					count0 += 1
					uc1 += max(0, c1 - 1)
					c1 = 0
					i += 1
				else:
					c1 += 1
					i += 1
			uc1 += max(0, c1 - 1)
			netcount = count0 + uc1
			s = '01' * netcount
		else:
			i = 0
			c0 = 0
			uc0 = 0
			count1 = 0
			while i < len(t):
				if t[i] == 1:
					count1 += 1
					uc0 += max(0, c0 - 1)
					c0 = 0
					i += 1
				else:
					c0 += 1
					i += 1
			uc0 += max(0, c0 - 1)
			netcount = count1 + uc0
			s = '10' * netcount
	else:
		s = t
	print(s)


t = int(input())
for _ in range(t):
	s = input()
	if all((s[0] == s[i] for i in range(len(s)))):
		print(s)
	elif s[0] == '0':
		print('01' * len(s))
	else:
		print('10' * len(s))


from math import fabs
n = int(input())
for i in range(n):
	t = input()
	if '0' in t and '1' not in t:
		print(t)
	elif '0' not in t and '1' in t:
		print(t)
	else:
		s = []
		s.append(t[0])
		for j in range(1, len(t)):
			if s[-1] == '0' and t[j] == '0':
				s.append('1')
				s.append('0')
			elif s[-1] == '1' and t[j] == '1':
				s.append('0')
				s.append('1')
			else:
				s.append(t[j])
		print(''.join(s))


from sys import stdin, stdout
import bisect
import math
import itertools
_INPUT = -1
input = []

def I():
	global _INPUT
	_INPUT += 1
	INPUT = list(map(int, input[_INPUT].split()))
	if len(INPUT) == 1:
		return INPUT[0]
	else:
		return INPUT

def IS():
	global _INPUT
	_INPUT += 1
	INPUT = list(map(str, input[_INPUT].split()))
	if len(INPUT) == 1:
		return INPUT[0]
	else:
		return INPUT

def IA():
	global _INPUT
	_INPUT += 1
	INPUT = list(map(int, input[_INPUT].split()))
	return INPUT

def IAS():
	global _INPUT
	_INPUT += 1
	INPUT = list(map(str, input[_INPUT].split()))
	return INPUT
ONLINE_JUDGE = not __debug__
if ONLINE_JUDGE:
	stdin = open('input.txt', 'r')
input = stdin.readlines()
t = I()
for _ in range(t):
	s = IS()
	st = set()
	ans = ''
	for i in range(len(s) - 1):
		st.add(s[i])
		ans += s[i]
		if s[i] == s[i + 1]:
			ans += str(ord('1') - ord(s[i]))
	st.add(s[len(s) - 1])
	ans += s[len(s) - 1]
	if len(st) == 1:
		ans = s
	print(ans)


for _ in range(int(input())):
	t = input()
	res = ''
	l = set(list(t))
	if len(l) == 1:
		print(t)
		continue
	for i in range(len(t)):
		res += '10'
	print(res)


for _ in range(int(input())):
	t = input()
	n = len(t)
	s = '10' * n
	cnt1 = 0
	for i in range(n):
		if t[i] == '1':
			cnt1 += 1
	if cnt1 == n or cnt1 == 0:
		print(t)
		continue
	print(s)


import sys
readline = sys.stdin.readline
T = int(readline())
Ans = [None] * T
for qu in range(T):
	T = list(map(int, readline().strip()))
	N = len(T)
	if len(set(T)) == 1:
		Ans[qu] = ''.join(map(str, T))
	else:
		Ans[qu] = ''.join(map(str, [1 if i & 1 else 0 for i in range(2 * N)]))
print('\n'.join(map(str, Ans)))


for _ in range(int(input())):
	s = list(input())
	if len(s) < 3:
		print(''.join(s))
	elif len(set(s)) == 1:
		print(''.join(s))
	elif s.count('0') > s.count('1'):
		print('01' * (len(s) - 1) + '0')
	elif s.count('0') < s.count('1'):
		print('10' * (len(s) - 1) + '1')
	else:
		print('10' * len(s))


def convert(t):
	final = ''
	for i in range(0, len(t) - 1):
		final += t[i]
		if abs(int(t[i]) - int(t[i + 1])) == 0:
			if t[i] == '0':
				final += '1'
			else:
				final += '0'
	return final + t[len(t) - 1]

def period(string):
	if string == len(string) * string[0]:
		return 1
	for i in range(0, len(string) - 1):
		if string[i] == string[i + 1]:
			return 3
	return 2
t = int(input())
for i in range(t):
	string = input()
	if period(string) == 1 or period(string) == 2:
		print(string)
	else:
		print(convert(string))


t = int(input())

def inv(ch):
	return '1' if ch == '0' else '0'
for i in range(t):
	s = input()
	if len(s) == 2:
		print(s)
	else:
		stri = ''
		temp = True
		for i in range(len(s) - 1):
			if s[i] != s[i + 1]:
				temp = False
		if temp == True:
			print(s + s)
		else:
			for i in range(len(s) - 1):
				stri += s[i]
				if s[i] == s[i + 1]:
					stri += inv(s[i])
			c = len(s) - 1
			stri += s[c]
			if len(stri) % 2 == 1:
				stri += inv(s[c])
			print(stri)


t = int(input())

def fn():
	t = input()
	n = len(t)
	b = sorted(t)
	c = ''.join(b)
	if c[n - 1] == c[0]:
		print(t)
		return
	ans = ['0' if i % 2 == 0 else '1' for i in range(2 * n)]
	x = ''.join(ans)
	print(x)
while t:
	t -= 1
	fn()


t = int(input())
for case in range(1, t + 1):
	a = list(map(int, list(input())))
	oops = False
	for n in a:
		if n != a[0]:
			oops = True
	if not oops:
		print(''.join(map(str, a)))
	else:
		print('01' * len(a))


n = int(input())
for i in range(int(n)):
	a = input()
	b = a.split()
	z = [int(x) for x in b]
	if len(a) < 3:
		print(a)
	elif '0' not in a or '1' not in a:
		print(a)
	else:
		new = ''
		for j in range(len(a)):
			new += a[j]
			if j < len(a) - 1 and a[j + 1] == a[j]:
				if a[j] == '1':
					new += '0'
				else:
					new += '1'
		print(new)


import bisect
import os
from collections import Counter
import bisect
from collections import defaultdict
import math
import random
import heapq as hq
from math import sqrt
import sys
from functools import reduce, cmp_to_key
from collections import deque
import threading
from itertools import combinations
from io import BytesIO, IOBase
from itertools import accumulate

def input():
	return sys.stdin.readline().strip()

def iinput():
	return int(input())

def tinput():
	return input().split()

def rinput():
	return map(int, tinput())

def rlinput():
	return list(rinput())

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))
for _ in range(iinput()):
	t = input()
	n = len(t)
	if t.count('0') == n or t.count('1') == n:
		print(t)
	else:
		print('01' * n)


def solve(s):
	cz = sum((1 for c in s if c == '0'))
	co = sum((1 for c in s if c == '1'))
	if cz == 0 or co == 0:
		return s
	return '01' * len(s)
t = int(input())
for _ in range(t):
	s = input()
	print(solve(s))


t = int(input())
for testcase in range(t):
	word = input()
	string = list(word)
	if '1' not in string or '0' not in string:
		print(word)
		continue
	for i in range(len(string)):
		print('10', end='')
	print()


from math import *

def solve():
	s = input()
	l = len(s)
	if set(s) in {frozenset({'0'}), frozenset({'1'})}:
		print(s)
	else:
		x1 = s
		while '11' in x1 or '00' in x1:
			x1 = x1.replace('11', '101').replace('00', '010')
		print(x1)
for _ in range(int(input())):
	solve()


for _ in range(int(input())):
	arr = [x for x in input()]
	cnt = arr.count('0')
	if cnt == 0 or cnt == len(arr):
		print(''.join(arr))
	else:
		print('10' * len(arr))


t = int(input())
for tt in range(t):
	n = input()
	if len(set(n)) == 1:
		print(n)
		continue
	else:
		print('10' * len(n))


import sys
strings = iter(sys.stdin.read().split())
ints = (int(x) for x in strings)
sys.setrecursionlimit(3000)
ntc = next(ints)
for tc in range(ntc):
	t = next(strings)
	if len(set(t)) == 1:
		ans = t
	else:
		n = len(t)
		ans = ['1']
		for i in range(n):
			if ans[-1] == t[i]:
				ans.append('1' if t[i] == '0' else '0')
			ans.append(t[i])
		ans = ''.join(ans)
	print(ans)


from collections import deque
tc = int(input())
for _ in range(tc):
	t = input()
	(length, period) = (len(t), 1)
	for i in range(length - 1):
		period += int(t[i] == t[i + 1])
	if period == length or length <= 2:
		print(t)
	else:
		stack = deque()
		for i in range(length - 1):
			stack.append(t[i])
			if t[i] == t[i + 1]:
				if t[i] == '0':
					stack.append('1')
				else:
					stack.append('0')
		stack.append(t[length - 1])
		ans = ''.join(stack)
		print(ans)


import sys
t = int(sys.stdin.readline())
for _ in range(t):
	a = input()
	a = a[:]
	a = list(map(int, a))
	i = 0
	if a.count(0) == 0 or a.count(1) == 0:
		for j in range(len(a)):
			print(a[j], end='')
		print()
	else:
		while True:
			if i == len(a) - 1:
				break
			if a[i] == 0 and a[i + 1] == 0:
				a.insert(i + 1, 1)
			elif a[i] == 1 and a[i + 1] == 1:
				a.insert(i + 1, 0)
			i += 1
		for k in range(len(a)):
			print(a[k], end='')
		print()


t = int(input())
for l in range(t):
	s = input()
	u = set(s)
	if len(u) == 1:
		print(s)
	else:
		print('01' * len(s))


t = int(input())
for _ in range(t):
	a = input()
	if '01' in a:
		print(len(a) * '01')
	elif '10' in a:
		print(len(a) * '10')
	else:
		print(a)


def a(t):
	for i in range(len(t)):
		print(t[i], end='')
t = int(input())
for i in range(t):
	z = input()
	if len(z) <= 2:
		print(z)
	else:
		x = z.count('0')
		y = z.count('1')
		if x == 0 or y == 0:
			print(z)
		else:
			print('01' * len(z))


tc = int(input())
for _ in range(tc):
	s = list(input())
	if s.count('1') in (len(s), 0):
		print(''.join(s))
	else:
		i = 1
		while i < len(s):
			if s[i] == s[i - 1]:
				s.insert(i, '0' if s[i] == '1' else '1')
			i += 1
		print(''.join(s))


for i in range(int(input())):
	t = input()
	if t.count('0') == 0:
		s = t
	elif t.count('1') == 0:
		s = t
	elif t[0] == '0':
		s = '01' * len(t)
	else:
		s = '10' * len(t)
	print(s)


for _ in range(int(input())):
	s = list(input())
	if len(set(s)) == 1:
		print(s[0] * len(s))
	else:
		print(s[0], end='')
		n = len(s)
		i = 1
		while i < n:
			if s[i] != s[i - 1]:
				print(s[i], end='')
			else:
				if s[i - 1] == '0':
					print('1', end='')
					s[i - 1] = '1'
				else:
					print('0', end='')
					s[i - 1] = '0'
				i -= 1
			i += 1
		print()


for i in range(0, int(input())):
	s = input()
	p = ''
	j = 0
	z = 0
	q = 0
	for j in s:
		if j == '0':
			z = z + 1
		else:
			q = q + 1
	j = 0
	while len(p) <= 2 * len(s):
		if s[j] == '0':
			p = p + '01'
		else:
			p = p + '10'
	if z == len(s) or q == len(s):
		print(s)
	else:
		print(p[:2 * len(s)])


t = int(input())
for iff in range(t):
	s = input()
	if s.count('0') == 0 or s.count('1') == 0:
		print(s)
		continue
	s = '01' * len(s)
	print(s)


for q in range(int(input())):
	s = input()
	si = len(s)
	print(s if len(set(s)) == 1 else '01' * si)


n = int(input())
while n > 0:
	n -= 1
	(fl1, fl0) = (False, False)
	s = input()
	for i in range(0, len(s)):
		if s[i] == '1':
			fl1 = True
		if s[i] == '0':
			fl0 = True
	if fl1 and fl0:
		for i in range(0, len(s) * 2):
			if i % 2 == 0:
				print('0', end='', sep='')
			else:
				print('1', end='', sep='')
	elif fl1 or fl0:
		print(s, end='')
	print('\n')


for _ in range(int(input())):
	s = input()
	one = 0
	zero = 0
	for x in s:
		if x == '1':
			one += 1
		else:
			zero += 1
	if one == 0 or zero == 0:
		print(s)
	else:
		print('10' * len(s))


for t in range(int(input())):
	s = input()
	res = []
	if s.count('0') > 0 and s.count('1') > 0:
		res.append(int(s[0]))
		for i in range(1, len(s)):
			if s[i] == s[i - 1]:
				res.append(1 ^ int(s[i]))
			res.append(int(s[i]))
	else:
		res = [*map(int, list(s))]
	print(*map(str, res), sep='')


def fun(s):
	if s.strip('0') == '' or s.strip('1') == '':
		return s
	ans = ''
	n = len(s)
	for i in range(0, n):
		if s[0] == '0':
			ans = ans + '01'
		else:
			ans = ans + '10'
	return ans
tc = int(input())
while tc > 0:
	s = str(input())
	print(fun(s))
	tc = tc - 1


for u in range(int(input())):
	s = input()
	n = len(s)
	x = s.count('1')
	y = s.count('0')
	m = max(x, y)
	if x == 0 or y == 0:
		print(s)
	else:
		print('10' * len(s))


for _ in range(int(input())):
	s = input()
	n = len(s)
	if s.count('0') == n or s.count('1') == n:
		ans = s
	else:
		ans = s[0]
		cnt = 0
		for i in range(1, n):
			if s[i - 1] == s[i]:
				if s[i] == '0':
					ans += '10'
				else:
					ans += '01'
			else:
				ans += s[i]
	print(ans)


T = int(input())
for _ in range(T):
	t = input()
	nul = 0
	jednotiek = 0
	for i in range(len(t)):
		if t[i] == '0':
			nul += 1
		else:
			jednotiek += 1
	if jednotiek == 0 or nul == 0:
		print(t)
	else:
		out = []
		for i in range(len(t)):
			out.append('1')
			out.append('0')
		print(''.join(out))


t = int(input())
while t:
	t += -1
	s = input()
	ch1 = 0
	ch2 = 0
	if '0' in s:
		ch1 = 1
	if '1' in s:
		ch2 = 1
	if ch1 and ch2:
		ans = []
		ans.append(s[0])
		x = 1
		for i in range(1, len(s)):
			if ans[x - 1] == s[i]:
				ans.append(int(not int(s[i])))
				x -= -1
			ans.append(s[i])
			x -= -1
		print(*ans, sep='')
	else:
		print(s)


for _ in range(int(input())):
	str1 = input()
	if '0' in str1 and '1' in str1:
		print('01' * len(str1))
	elif '1' in str1:
		print('1' * len(str1))
	else:
		print('0' * len(str1))


t = int(input())
while t > 0:
	s = input()
	cz = 0
	co = 0
	l = len(s)
	for i in range(0, l):
		if s[i] == '0':
			cz += 1
		else:
			co += 1
	if cz == l or co == l:
		print(s)
	else:
		for i in range(0, l):
			if s[i] == '0':
				print('1', end='')
				print(s[i], end='')
			else:
				print(s[i], end='')
				print('0', end='')
		print()
	t -= 1


import sys
read = sys.stdin.buffer.read
readlines = sys.stdin.buffer.readlines
t = int(input())
for case in range(t):
	s = input()
	if len(set(s)) == 1:
		print(s)
	else:
		out = s[0]
		for i in range(1, len(s)):
			if out[-1] == '0':
				if s[i] == '1':
					out += '1'
				else:
					out += '10'
			elif s[i] == '1':
				out += '01'
			else:
				out += '0'
		print(out)


m = int(input())
for test_no in range(m):
	x = input()
	if x == ''.join(len(x) * ['1']) or x == ''.join(len(x) * ['0']):
		print(x)
	else:
		for i in range(len(x)):
			print('01', end='')
	print('\n')


from math import factorial as fac
from collections import defaultdict
from copy import deepcopy
import sys, math
f = None
try:
	f = open('q1.input', 'r')
except IOError:
	f = sys.stdin
sys.setrecursionlimit(10 ** 6)

def print_case_iterable(case_num, iterable):
	print('Case #{}: {}'.format(case_num, ' '.join(map(str, iterable))))

def print_case_number(case_num, iterable):
	print('Case #{}: {}'.format(case_num, iterable))

def print_iterable(A):
	print(' '.join(A))

def read_int():
	return int(f.readline())

def read_int_array():
	return [int(x) for x in f.readline().strip().split(' ')]

def rns():
	a = [x for x in f.readline().split(' ')]
	return (int(a[0]), a[1].strip())

def read_string():
	return list(f.readline().strip())
NUMBER = 10 ** 9 + 7

def factorial(n):
	M = NUMBER
	f = 1
	for i in range(1, n + 1):
		f = f * i % M
	return f

def mult(a, b):
	return a * b % NUMBER

def minus(a, b):
	return (a - b) % NUMBER

def plus(a, b):
	return (a + b) % NUMBER

def egcd(a, b):
	if a == 0:
		return (b, 0, 1)
	else:
		(g, y, x) = egcd(b % a, a)
		return (g, x - b // a * y, y)

def modinv(a):
	m = NUMBER
	(g, x, y) = egcd(a, m)
	if g != 1:
		raise Exception('modular inverse does not exist')
	else:
		return x % m
from collections import deque, defaultdict
import heapq

def bfs(V, E):
	s = set()
	print('\n'.join(map(str, E.items())))
	cnt = 0
	for v in V:
		if v in s:
			continue
		q = deque([])
		s.add(v)
		q.append(v)
		while len(q) > 0:
			x = q.popleft()
			for e in E[x]:
				if e not in s:
					s.add(e)
					q.append(e)
			print(q)
		cnt += 1
	return cnt
from typing import List, Tuple

def regular_bs(L, x, l=None, r=None):
	l = 0 if l == None else l
	r = len(L) if r == None else r
	while r - l > 1:
		m = (r + l) // 2
		l = m if L[m] <= x else l
		r = m if L[m] > x else r
	cnt = 0
	return l

def binary_count_smaller(L, x):
	l = 0
	if x < L[0]:
		return 0
	r = len(L)
	while r - l > 1:
		mid = (l + r) // 2
		if L[mid] < x:
			l = mid
		else:
			r = mid
	return l + 1

def binary_count_larger(L, x):
	l = 0
	if x > L[-1]:
		return 0
	r = len(L)
	while r - l > 1:
		mid = (l + r) // 2
		if L[mid] <= x:
			l = mid
		else:
			r = mid
	return len(L) - (r - 1)
from itertools import product

def solution(A):
	if '1' not in A or '0' not in A:
		return A
	res = []
	for i in range(0, len(A) - 1):
		if A[i] == '1' and A[i + 1] == '1':
			res.append('1')
			res.append('0')
		elif A[i] == '0' and A[i + 1] == '0':
			res.append('0')
			res.append('1')
		else:
			res.append(A[i])
	res.append(A[-1])
	return ''.join(res)

def main():
	T = read_int()
	for i in range(T):
		A = f.readline().strip()
		print(solution(A))
main()


a = int(input())
for i in range(0, a):
	b = list(input())
	c = []
	d = []
	if len(b) != 1:
		count = 1
		for j in range(0, len(b) - 1):
			end = 0
			if b[j] != b[j + 1]:
				c.append([count, b[j]])
				count = 1
				end = 1
			else:
				count += 1
				end = 2
		if end == 1:
			c.append([1, b[len(b) - 1]])
		elif end == 2:
			c.append([count, b[len(b) - 1]])
		if len(c) > 1:
			for k in c:
				for ss in range(0, k[0] - 1):
					if k[1] == '1':
						d.append('1')
						d.append('0')
					else:
						d.append('0')
						d.append('1')
				d.append(k[1])
			e = ''.join(d)
			print(e)
		elif len(c) == 1:
			print(''.join(b))
	else:
		print(''.join(b))


n = int(input())

def solve(t):
	flag = False
	first = t[0]
	zeros = 0
	for c in t:
		if c != first:
			flag = True
		if c == '0':
			zeros += 1
	if not flag:
		return t
	n = len(t) // 2
	flag = zeros <= n
	ans = ''.join([str((i + flag) % 2) for i in range(2 * len(t))])
	return ans
for _ in range(n):
	t = input()
	print(solve(t))


t = int(input())
for case in range(t):
	num = input()
	zero = 0
	one = 0
	newnum = ''
	for i in range(len(num)):
		if int(num[i]) == 0:
			zero += 1
		else:
			one += 1
	if one == 0 or zero == 0:
		print(num)
	elif num[0] == '0':
		newnum = newnum + '0'
		for i in range(1, len(num)):
			if num[i] == num[i - 1]:
				if num[i] == '0':
					newnum = newnum + '1' + '0'
				else:
					newnum = newnum + '0' + '1'
			else:
				newnum = newnum + num[i]
	else:
		newnum = newnum + '1'
		for i in range(1, len(num)):
			if num[i] == num[i - 1]:
				if num[i] == '0':
					newnum = newnum + '1' + '0'
				else:
					newnum = newnum + '0' + '1'
			else:
				newnum = newnum + num[i]
	print(newnum)


def count():
	n = input()
	if n.count('0') != len(n) and n.count('0') > 0:
		print('10' * len(n))
	elif n.count('1') == len(n):
		print('1' * len(n))
	else:
		print('0' * len(n))
for _ in range(int(input())):
	count()


def f(t):
	s = ''
	t0 = t[0]
	if t == t0 * len(t):
		return t
	for i in t:
		if s == '':
			s += i
		elif s[-1] == '1' and i == '1':
			s += '01'
		elif s[-1] == '0' and i == '0':
			s += '10'
		else:
			s += i
	return s
for i in ' ' * int(input()):
	print(f(input()))


from collections import deque, defaultdict, Counter
from bisect import bisect_left, bisect
import math

def test_case():
	t = input()
	s = []
	if t == t[0] * len(t):
		return t
	for char in t:
		if char == '0':
			s.append('0')
			s.append('1')
		else:
			s.append('0')
			s.append('1')
	return ''.join(s)
for _ in range(int(input())):
	ret = test_case()
	if ret != None:
		print(ret)


import sys
from sys import stdin, stdout
import bisect
from bisect import bisect_left as bl
from bisect import bisect_right as br
import itertools
import collections
import math
import heapq

def modinv(n, p):
	return pow(n, p - 2, p)

def cin():
	return map(int, sin().split())

def ain():
	return list(map(int, sin().split()))

def sin():
	return input()

def inin():
	return int(input())

def Divisors(n):
	l = []
	for i in range(1, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n // i == i:
				l.append(i)
			else:
				l.append(i)
				l.append(n // i)
	return l

def most_frequent(list):
	return max(set(list), key=list.count)

def GCD(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def ncr(n, r, p):
	t = fact[n] * (ifact[r] * ifact[n - r] % p) % p
	return t

def Convert(string):
	li = list(string.split(''))
	return li

def SieveOfEratosthenes(n):
	global prime
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	f = []
	for p in range(2, n):
		if prime[p]:
			f.append(p)
	return f
prime = []
q = []

def dfs(n, d, v, c):
	global q
	v[n] = 1
	x = d[n]
	q.append(n)
	j = c
	for i in x:
		if i not in v:
			f = dfs(i, d, v, c + 1)
			j = max(j, f)
	return j

def main():
	for _ in range(int(input())):
		s = input()
		x = s.count('1')
		if x == 0 or len(s) == x:
			print(s)
		else:
			print('01' * len(s))
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
import os, sys
from io import IOBase, BytesIO
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.getvalue())
			(self.truncate(0), self.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			self.write = lambda s: self.buffer.write(s.encode('ascii'))
			self.read = lambda : self.buffer.read().decode('ascii')
			self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


for i in range(int(input())):
	t = input()
	if '0' not in t:
		print(t)
	elif '1' not in t:
		print(t)
	else:
		s = ''
		s += t[0]
		n = len(t)
		for i in t[1:]:
			k = s[-1]
			if k == i:
				if i == '1':
					s += '0'
					s += i
				else:
					s += '1'
					s += i
			else:
				s += i
		print(s)


from collections import defaultdict as dc
from heapq import *
import math
import bisect
import sys
from collections import deque as dq
from heapq import heapify, heappush, heappop
mod = 10 ** 9 + 7

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

def line():
	p = list(map(int, input().split()))
	return p

def read_mat():
	n = inp()
	a = []
	for i in range(n):
		a.append(line())
	return a

def digit(n):
	s = str(n)
	p = 0
	for i in s:
		p += int(i) ** 2
	return p

def solve(s):
	n = len(s)
	z = s.count('0')
	if z == n or z == 0:
		return s
	p = ''
	for i in range(n - 1):
		if s[i] == '0' and s[i + 1] == '0':
			p += '01'
		elif s[i] == '1' and s[i + 1] == '1':
			p += '10'
		else:
			p += s[i]
	p = p + s[n - 1]
	return p
for _ in range(inp()):
	s = str(input())
	print(solve(s))


T = int(input())
for x in range(T):
	t = input()
	ans = int(0)
	for i in range(len(t) - 1):
		if t[i] != t[i + 1]:
			ans = int(1)
			break
	if ans == 0:
		print(t)
	else:
		s = ''
		for i in range(len(t)):
			s += '10'
		print(s)


for nt in range(int(input())):
	s = input()
	if len(set(s)) == 1:
		print(s)
		continue
	print('10' * len(s))


for t in range(int(input())):
	s = list(input())
	x = list(set(s))
	a = []
	if len(x) == 1:
		a = s
	else:
		q = ['01'] * len(s)
		a.extend(q)
	print(''.join(a))


T = int(input())
while T:
	t = input()
	n = len(t)
	zero_present = '0' in t
	one_present = '1' in t
	if zero_present and one_present:
		for i in range(2 * n):
			print(i % 2, end='')
		print()
	else:
		print(t)
	T -= 1


t = int(input())
while t:
	t -= 1
	string = input()
	ans = ''
	zeros = False
	ones = False
	for i in string:
		if i == '0':
			zeros = True
		else:
			ones = True
	if zeros and ones:
		for i in range(len(string) - 1):
			if string[i] + string[i + 1] == '00':
				ans += string[i] + '1'
			elif string[i] + string[i + 1] == '11':
				ans += string[i] + '0'
			else:
				ans += string[i]
		ans += string[-1]
	else:
		ans = string
	print(ans)


for j in range(int(input())):
	s = input()
	if '01' in s:
		print('01' * len(s))
	elif '10' in s:
		print('10' * len(s))
	elif '1' in s:
		print('11' * len(s))
	else:
		print('00' * len(s))


t = int(input())
for _ in range(t):
	string = input()
	n = len(string)
	if n < 3:
		print(string)
		continue
	if '0' not in string or '1' not in string:
		print(string)
		continue
	my_dict = {'0': '1', '1': '0'}
	i = 0
	while i < n - 1:
		if string[i] == string[i + 1]:
			print(string[i] + my_dict[string[i]], end='')
		else:
			print(string[i], end='')
		i += 1
	print(string[n - 1])


for _ in range(int(input())):
	t = str(input())
	n = len(t)
	x = t.count('0')
	y = t.count('1')
	ans = ''
	if n != 2:
		if x == n or y == n:
			print(t)
		else:
			for i in range(n):
				ans += '10'
			print(ans)
	else:
		print(t)


for _ in range(int(input())):
	s = input()
	ans = ''
	if '1' in s and '0' in s:
		x = s[0]
		if x == '1':
			y = '0'
		else:
			y = '1'
		for i in range(2 * len(s)):
			if i % 2 == 0:
				ans += x
			else:
				ans += y
	else:
		ans = s
	print(ans)


t = int(input())
n = []
m = []
for i in range(t):
	n.append(input())
for i in range(t):
	if '1' not in n[i]:
		print(n[i])
	elif '0' not in n[i]:
		print(n[i])
	else:
		print('10' * len(n[i]))


for _ in range(int(input())):
	t = input()
	b = True
	for i in range(len(t) - 1):
		if t[i] != t[i + 1]:
			b = False
			break
	if b == False:
		print('01' * len(t))
	else:
		print(t)


def go():
	t = input()
	if len(set(t)) < 2:
		return t
	oposite = {'1': '0', '0': '1'}
	res = [t[0]]
	for tt in t[1:]:
		if tt == res[-1]:
			res.append(oposite[tt])
		res.append(tt)
	return ''.join(res)
t = int(input())
ans = []
for _ in range(t):
	ans.append(str(go()))
print('\n'.join(ans))


z = int(input())
for _ in range(z):
	t = input()
	l1 = len(t)
	flag = 0
	for i in range(1, l1):
		if t[i] != t[i - 1]:
			flag = 1
			break
	if flag == 1:
		if t[0] == '0':
			for i in range(2 * l1):
				if i % 2 != 0:
					print('1', end='')
				else:
					print('0', end='')
			print()
		elif t[0] == '1':
			for i in range(2 * l1):
				if i % 2 != 0:
					print('0', end='')
				else:
					print('1', end='')
			print()
	else:
		print(t)


import math

def main():
	for q in range(int(input())):
		st = input()
		zeros = 0
		ones = 0
		for i in range(len(st)):
			if st[i] == '0':
				zeros += 1
			else:
				ones += 1
		if zeros == 0 or ones == 0:
			print(st)
		else:
			if st[0] == '0':
				for i in range(len(st)):
					print('01', end='')
			else:
				for i in range(len(st)):
					print('10', end='')
			print('')
main()


t = int(input())
for _ in range(t):
	s = input()
	su = sum((int(c) for c in s))
	if su == len(s) or su == 0:
		print(s)
	else:
		print('01' * len(s))


t = int(input())
for _ in range(t):
	s = input()
	oc = 0
	zc = 0
	first = -1
	for i in range(len(s)):
		if s[i] == '0':
			zc += 1
			if first == -1:
				first = 0
		else:
			oc += 1
			if first == -1:
				first = 1
	n = len(s)
	if zc == n or oc == n:
		print(s)
	else:
		ma = max(zc, oc)
		if first == 0:
			st = '01'
		else:
			st = '10'
		str = ''
		for i in range(len(s)):
			str += st
		print(str)


def main():
	T = int(input())
	for _ in range(T):
		t = input()
		s = t[0]
		d = {'1': 0, '0': 0}
		d[t[0]] += 1
		for i in range(1, len(t)):
			c = t[i]
			d[c] += 1
			if c == s[-1]:
				if c == '0':
					s += '10'
				else:
					s += '01'
			else:
				s += c
		if d['0'] == 0 or d['1'] == 0:
			print(t)
			continue
		print(s)
main()


def run():
	import sys
	sys.stdin = open('/home/punit/Documents/Cpp Programs/input.txt', 'r')
	sys.stdout = open('/home/punit/Documents/Cpp Programs/output.txt', 'w')
	from math import ceil, sqrt, floor
n = int(input())
for _ in range(n):
	s = input()
	x = s.count('1')
	y = s.count('0')
	if x >= 1 and y >= 1:
		for i in range(len(s)):
			print('10', end='')
		print()
	elif x >= 1:
		print('1' * len(s))
	else:
		print('0' * len(s))


for i in range(int(input())):
	a = input()
	z = a.count('0')
	o = a.count('1')
	em = ''
	if z == 0 or o == 0:
		print(a)
	else:
		for j in a:
			if j not in em:
				em += j
		print(len(a) * em)


import math
from collections import Counter
L = lambda : list(map(int, input().split()))
M = lambda : map(int, input().split())
I = lambda : int(input())
IN = lambda : input()
mod = 10 ** 9 + 7

def s(a):
	print(' '.join(list(map(str, a))))
for i in range(I()):
	t = IN()
	if t.count('0') == len(t) or t.count('1') == len(t):
		print(t)
		continue
	if t[0] == '1':
		s = '10' * len(t)
	else:
		s = '01' * len(t)
	print(s[:len(s) - 1])


from math import *
for zz in range(int(input())):
	t = [int(i) for i in input()]
	n = len(t)
	if sum(t) == 0:
		print(*[0] * n, sep='')
	elif sum(t) == n:
		print(*[1] * n, sep='')
	else:
		print(*[0, 1] * n, sep='')


t = int(input())
while t != 0:
	s = str(input())
	ans = True
	for i in range(len(s)):
		if s[i] != s[i - 1]:
			ans = False
			break
	if ans:
		print(s)
	else:
		p = ''
		for i in range(len(s)):
			p += '10'
		print(p)
	t -= 1


TESTS = int(input())
answers = []
for _ in range(TESTS):
	s = input()
	res = ''
	if s.find('0') != -1 and s.find('1') != -1:
		res = '10' * len(s) if s[-1] == '0' else '01' * len(s)
	else:
		res = s
	answers.append(res)
for ans in answers:
	print(ans)


import sys
input = sys.stdin.readline
f = lambda : list(map(int, input().split()))
for i in range(int(input())):
	t = input()
	one = t.count('1')
	zero = t.count('0')
	if one == 0 or zero == 0:
		print(t)
	else:
		for i in range(0, (one + zero) * 2, 2):
			print('01', end='')
		print('\n')


for _ in range(int(input())):
	ins = input()
	ln = len(ins)
	if not '0' in ins or not '1' in ins:
		print(ins)
	else:
		print(['01' * ln, '10' * ln][ins[0] == '1'])


import sys
q = int(input())
inp = [line.strip() for line in reversed(sys.stdin.readlines())]
lans = []
while q:
	ans = ''
	t = inp.pop()
	if '0' in t and '1' in t:
		ans += t[0]
		for i in range(1, len(t)):
			if t[i] == t[i - 1]:
				if t[i] == '1':
					ans += '0'
				else:
					ans += '1'
			ans += t[i]
	else:
		ans = t
	lans.append(ans)
	q -= 1
print(*lans, sep='\n')


t = int(input())
while t:
	s = input()
	if '0' in s and '1' not in s:
		print(s)
	elif '0' not in s and '1' in s:
		print(s)
	elif '0' in s and '1' in s:
		k = 0
		j = len(s)
		i = 1
		while i < j + k:
			if s[i - 1] == '0' and s[i] == '0':
				s = s[:i] + '1' + s[i:]
				k += 1
			elif s[i - 1] == '1' and s[i] == '1':
				s = s[:i] + '0' + s[i:]
				k += 1
			i += 1
		print(s)
	t -= 1


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
for i in range(int(input())):
	s = input()
	if len(set(s)) == 1:
		print(s)
		continue
	print('01' * len(s))


t = int(input())
for _ in range(t):
	i = input()
	if all((x == '0' for x in i)) or all((x == '1' for x in i)):
		print(i)
		continue
	zero = i[0] == '0'
	s = []
	for c in i:
		if (c == '0') == zero:
			s.append(c)
			zero = not zero
		else:
			s.append(('0' if zero else '1') + c)
	print(''.join(s))


for T in range(int(input())):
	t = input()
	if len(set(t)) == 1:
		print(t)
	else:
		s = t[0]
		for i in range(1, len(t)):
			if t[i] == t[i - 1]:
				if t[i] == '0':
					s += '1' + t[i]
				else:
					s += '0' + t[i]
			else:
				s += t[i]
		print(s)


from sys import stdin

def func():
	return
for _ in range(int(stdin.readline())):
	s = stdin.readline().strip()
	if s.count('0') == 0 or s.count('1') == 0:
		print(s)
	else:
		arr = []
		for ele in s:
			arr.append(int(ele) % 2)
		ans = ['0', '1'] * len(s)
		print(''.join(ans))


def string_maker(string):
	zero = 0
	one = 0
	new_string = ''
	for i in string:
		if i == '0':
			zero += 1
		else:
			one += 1
	if one == 0 or zero == 0:
		print(string)
		return
	i = 0
	while i < len(string) - 1:
		new_string += string[i]
		if string[i] == string[i + 1]:
			if string[i] == '0':
				new_string += '1'
			else:
				new_string += '0'
		i += 1
	print(new_string + string[len(string) - 1])
n = int(input())
for i in range(n):
	string_maker(input())


for i in range(int(input())):
	s = input()
	if len(set(s)) == 1:
		print(s)
	else:
		lst = [s[0]]
		for i in range(1, len(s)):
			if s[i] == lst[-1]:
				lst.append(1 - int(s[i]))
				lst.append(s[i])
			else:
				lst.append(s[i])
		print(''.join(map(str, lst)))


for _ in range(int(input())):
	n = str(input())
	(p1, p2) = (0, 0)
	lp = 0
	if len(n) <= 2 or len(list(dict.fromkeys(n))) == 1:
		print(n)
	else:
		print('10' * len(n))


def f1():
	t = int(input())
	while t != 0:
		t = t - 1
		s = str(input())
		(c1, c0) = count(s)
		if c1 == 0 or c0 == 0:
			print(s)
			continue
		L = len(s)
		if s[0] == '0':
			ans = ['0' if i % 2 == 0 else '1' for i in range(0, 2 * len(s))]
		else:
			ans = ['1' if i % 2 == 0 else '0' for i in range(0, 2 * len(s))]
		ans = ''.join(ans)
		print(ans)

def NT(strn):
	if strn == '0':
		return '1'
	else:
		return '0'

def count(strn):
	(c1, c0) = (0, 0)
	for i in range(0, len(strn)):
		if str(strn[i]) == str('0'):
			c0 += 1
		else:
			c1 += 1
	return (c1, c0)
f1()


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
mod2 = 998244353
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))

def main():
	t = I()
	rr = []
	for _ in range(t):
		s = S()
		c = set((_ for _ in s))
		if len(c) == 1:
			rr.append(s)
		else:
			rr.append('01' * len(s))
	return JA(rr, '\n')
print(main())


import sys

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

def sieve(n):
	a = [1] * n
	for i in range(2, n):
		if a[i]:
			for j in range(i * i, n, i):
				a[j] = 0
	return a
for __ in range(int(input())):
	t = input()
	n = len(t)
	if t.count('0') == n or t.count('1') == n:
		print(t)
	else:
		print(len(t) * '01')


t = int(input())
for j in range(0, t):
	s = input()
	(count1, count0) = (0, 0)
	for i in range(0, len(s)):
		if s[i] == '0':
			count0 += 1
		else:
			count1 += 1
	if count1 == 0 or count0 == 0:
		print(s)
	else:
		for i in range(0, len(s)):
			print('10', end='')
		print('')


t = int(input())
for _ in range(t):
	t = input()
	if len(t) == t.count('1') or len(t) == t.count('0'):
		print(t)
		continue
	if len(t) % 2 == 0:
		if len(t) == t.count('10') * 2 or len(t) == t.count('01') * 2:
			print(t)
			continue
	elif len(t) - 1 == t[0:-1].count('10') * 2 and t[-1] == '1' or (len(t) - 1 == t[0:-1].count('01') * 2 and t[-1] == '0'):
		print(t)
		continue
	s = ''
	for i in range(len(t) - 1):
		if t[i] != t[i + 1]:
			s += t[i]
		elif t[i] == '0':
			s += t[i] + '1'
		else:
			s += t[i] + '0'
	s += t[-1]
	print(s)


for _ in range(int(input())):
	t = input()
	s = list(t)
	g = ''
	count1 = s.count('1')
	count0 = s.count('0')
	if count0 == 0 or count1 == 0:
		g = t + t
	elif len(t) == 2:
		g = t
	elif t[0] == '1':
		for _ in range(len(s)):
			g += '1' + '0'
	else:
		for _ in range(len(s)):
			g += '0' + '1'
	print(g)


t = int(input())
for i in range(0, t, 1):
	s = input()
	l = len(s)
	s1 = ''
	s1 = s1 + s[0]
	for i in range(1, l, 1):
		if s[i] != s[0]:
			s1 = s1 + s[i]
			break
	final = ''
	for i in range(0, l, 1):
		final = final + s1
	print(final)


for _ in range(int(input())):
	s = input()
	x = s.count('1')
	y = s.count('0')
	if x == 0 or y == 0:
		print(s)
	else:
		for i in range(0, len(s)):
			print('01', end='')
		print()


tim = int(input())
while tim:
	tim -= 1
	t = input()
	tag = True
	for i in t:
		if i != t[0]:
			tag = False
			break
	if tag:
		print(t)
	else:
		for i in range(len(t)):
			print(t[i], end='')
			if i == len(t) - 1:
				break
			if t[i] == t[i + 1]:
				print((int(t[i]) + 1) % 2, end='')
		print()


t = int(input())
while t > 0:
	s = input()
	(zero, one) = (s.count('0'), s.count('1'))
	if zero == 0 or one == 0:
		print(s)
	else:
		for i in range(len(s)):
			print('10', end='')
		print()
	t -= 1


t = int(input())
for case in range(t):
	s = input()
	if s.count('0') == 0 or s.count('1') == 0:
		print(s)
	else:
		ans = []
		i = 0
		not_dict = {'0': '1', '1': '0'}
		while i < len(s) - 1:
			ans.append(s[i])
			if s[i] == s[i + 1]:
				ans.append(not_dict[s[i]])
			i += 1
		ans.append(s[i])
		print(''.join(ans))


for test in range(int(input())):
	t = input()
	l = len(t)
	(z, n) = (0, 0)
	for i in range(l):
		if t[i] == '0':
			z = z + 1
		else:
			n = n + 1
	if n > 0 and z > 0:
		for i in range(l):
			print('10', end='')
		print()
	else:
		print(t)


t = int(input())
for _ in range(t):
	s = input()
	temp = set()
	for i in s:
		temp.add(i)
	if len(temp) == 1:
		print(s)
	else:
		new_string = ''
		for i in range(len(s)):
			new_string = new_string + '01'
		print(new_string)


t = int(input())
for _ in range(t):
	a = input()
	if len(a) < 3:
		print(a)
	else:
		flag = False
		for i in range(1, len(a)):
			if a[i] != a[0]:
				flag = True
		if flag:
			ans = ''
			for i in range(len(a) - 1):
				if a[i] == a[i + 1]:
					if a[i] == '0':
						ans += '01'
					else:
						ans += '10'
				else:
					ans += a[i]
			if len(ans) % 2 == 0:
				if a[-1] == '0':
					ans += '01'
				else:
					ans += '10'
			else:
				ans += a[-1]
			print(ans)
		else:
			print(a)


for _ in range(int(input())):
	s = list(input())
	if len(set(s)) == 1:
		print(*s, sep='')
		continue
	n = len(s)
	ans = []
	ans.append(s[0])
	for i in range(1, n):
		if s[i] == s[i - 1]:
			if s[i] == '0':
				ans.append('1')
				ans.append('0')
			else:
				ans.append('0')
				ans.append('1')
		else:
			ans.append(s[i])
	print(*ans, sep='')


for i in range(int(input())):
	s = input()
	n = len(s)
	o = s.count('1')
	z = s.count('0')
	if n <= 2 or o == n or z == n:
		print(s)
	else:
		t = ''
		for i in range(n):
			t += '10'
		print(t)


import sys
import collections
input = sys.stdin.readline

def main():
	t = int(input())
	for _ in range(t):
		S = input().strip()
		c = collections.Counter(S)
		if c['0'] == 0:
			print('1' * c['1'])
			continue
		elif c['1'] == 0:
			print('0' * c['0'])
			continue
		if S[0] == '1':
			print('10' * len(S))
		else:
			print('01' * len(S))
main()


t = int(input())
for i in range(t):
	s = input()
	num0 = s.count('0')
	if num0 == 0 or num0 == len(s):
		print(s)
	else:
		num = 0
		for i in range(len(s)):
			if int(s[i]) == (i + num) % 2:
				print(s[i], end='')
			else:
				print('01'[(i + num) % 2], end='')
				print(s[i], end='')
				num += 1
		print()


for _ in range(int(input())):
	s = input()
	lst = list(s.strip())
	(cnt_0, cnt_1) = (0, 0)
	for i in lst:
		if i == '0':
			cnt_0 += 1
		else:
			cnt_1 += 1
	if cnt_0 == 0 or cnt_1 == 0:
		print(s)
	else:
		cnt = 0
		i = 0
		while i < len(lst) - 1:
			if lst[i] == lst[i + 1]:
				if lst[i] == '1':
					lst.insert(i + 1, 0)
				else:
					lst.insert(i + 1, 1)
				i -= 1
			i += 1
		for i in lst:
			print(i, end='')
		print()


for i in range(int(input())):
	a = input()
	b = list(a)
	if b.count('0') == 0 or b.count('1') == 0:
		print(a)
	else:
		e = b.count('1')
		f = b.count('0')
		if e > f:
			max = e
		else:
			max = f
		if b[0] == '1':
			count = 0
			g = ''
			while count != 2 * len(a):
				if count % 2 == 0:
					g += '1'
				else:
					g += '0'
				count += 1
			print(g)
		else:
			count = 0
			g = ''
			while count != 2 * len(a):
				if count % 2 == 0:
					g += '0'
				else:
					g += '1'
				count += 1
			print(g)


for i in range(int(input())):
	string = input()
	if len(set(string)) == 1:
		print(string)
	else:
		s = ''
		for i in range(len(string)):
			s += '01'
		print(s)


for _ in range(int(input())):
	A = input()
	x = list(set(list(A)))
	if len(A) <= 2:
		print(A)
	elif len(x) == 1:
		print(A)
	else:
		for i in range(len(A)):
			if A[i] == '0':
				print('1' + A[i], end='')
			else:
				print(A[i] + '0', end='')
		print()


from sys import stdin, stdout
T = int(stdin.readline())
for i in range(T):
	t = stdin.readline().strip()
	res = ''
	if t == '0' * len(t) or t == '1' * len(t):
		res = t
	else:
		res = '10' * len(t)
	stdout.write(str(res) + '\n')


t = int(input())
for i in range(t):
	s = input()
	newS = ''
	if '0' not in s or '1' not in s:
		print(s)
	else:
		for j in range(len(s[0:-1])):
			newS += s[j]
			if s[j] == s[j + 1]:
				newS += str(abs(int(s[j]) - 1))
		print(newS + s[-1])


from math import ceil
for _ in range(int(input())):
	s = input()
	n = len(s)
	if len(set(s)) == 1:
		print(s)
	else:
		ans = '10' * n
		print(ans[:2 * n])


for i in range(int(input())):
	a = input()
	f = 1
	g = 1
	for i in range(len(a)):
		if a[i] == '0':
			f = 0
		if a[i] == '1':
			g = 0
	if g == 0 and f == 0:
		print('10' * len(a))
	elif f == 0:
		print('00' * len(a))
	else:
		print('11' * len(a))


for _ in range(int(input())):
	s = input()
	cz = s.count('0')
	co = s.count('1')
	if co > 0 and cz > 0:
		ans = '10' * len(s)
	else:
		ans = s
	print(ans)


import math

def rn():
	a = int(input())
	return a

def rl():
	a = list(map(int, input().split()))
	return a
for _ in range(int(input())):
	t = input()
	l = len(t)
	o = t.count('1')
	if o == l or o == 0:
		print(t)
	else:
		for i in range(l):
			print('01', end='')
		print('')


for ad in range(int(input())):
	t = input()
	if len(set(t)) == 1:
		print(t)
	else:
		x = 0
		t = list(map(int, list(t)))
		while x == 0:
			x = 1
			for i in range(len(t) - 1):
				if t[i] == t[i + 1]:
					t.insert(i + 1, 1 - t[i])
					x = 0
					break
		t = list(map(str, t))
		print(''.join(t))


t = int(input())
for i in range(t):
	S = input()
	if S == '0' * len(S) or S == '1' * len(S):
		print(S)
	else:
		j = 0
		while j < len(S) - 1:
			if S[j] == S[j + 1]:
				val = 1 - int(S[j])
				S = S[0:j + 1] + str(val) + S[j + 1:]
				j += 2
			else:
				j += 1
		if S[len(S) - 1] == S[0]:
			S += S[len(S) - 2]
		print(S)


for t in range(int(input())):
	t = list(input())
	if '0' not in t:
		print(''.join(t))
	elif '1' not in t:
		print(''.join(t))
	elif len(t) == 2:
		print(''.join(t))
	else:
		t.append('2')
		prev = t[0]
		i = 1
		while t[i] != '2':
			if t[i] == prev:
				if t[i] == '0':
					t.insert(i, '1')
					prev = t[i]
				else:
					t.insert(i, '0')
					prev = t[i]
			else:
				prev = t[i]
			i += 1
		del t[-1]
		print(''.join(t))


T = int(input())
for i in range(T):
	t = list(input())
	c1 = t.count('0')
	c2 = t.count('1')
	n = c1 + c2
	if c1 == 0 or c2 == 0:
		for j in range(n):
			if j != n - 1:
				print(t[j], end='')
			else:
				print(t[j])
	else:
		if t.index('0') < t.index('1'):
			z = 0
			y = 1
		else:
			z = 1
			y = 0
		for j in range(2 * n):
			if j % 2 == 0:
				print(z, end='')
			elif j != 2 * n - 1:
				print(y, end='')
			else:
				print(y)


import sys
sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep='\n')

def II():
	return int(sys.stdin.readline())

def MI():
	return map(int, sys.stdin.readline().split())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI(rows_number):
	return [LI() for _ in range(rows_number)]

def SI():
	return sys.stdin.readline()[:-1]

def main():
	for _ in range(II()):
		t = SI()
		if '0' in t and '1' in t:
			ans = '01' * len(t)
		else:
			ans = t
		print(ans)
main()


n = int(input())
for i in range(n):
	ls = input()
	t = len(ls)
	(a, b) = (False, False)
	for i in range(t):
		if ls[i] == '1':
			a = True
		if ls[i] == '0':
			b = True
	ans = ''
	if a == False or b == False:
		for i in range(t):
			ans = ans + ls[i]
	else:
		for i in range(t):
			ans = ans + '10'
	print(ans)


from collections import Counter

def junkan(t):
	if len(t) == 1:
		return t
	else:
		t_arr = list(map(int, t))
		start = t_arr[0]
		end = t_arr[-1]
		t_count = Counter(t_arr)
		if min(t_count[0], t_count[1]) == 0:
			return t
		if start == 0:
			return '01' * (len(t) - 1) + str(end) if end == start else '01' * (len(t) - 1)
		else:
			return '10' * (len(t) - 1) + str(end) if end == start else '10' * (len(t) - 1)
m = int(input())
for _ in range(m):
	t = input()
	result = junkan(t)
	print(result)


def solve(t):
	if t.count('0') == 0 or t.count('1') == 0:
		return t
	s = t[0]
	for i in range(1, len(t)):
		if t[i] != s[-1]:
			s += t[i]
		elif t[i] == '0':
			s += '10'
		else:
			s += '01'
	return s
T = int(input())
for i in range(T):
	t = input()
	s = solve(t)
	print(s)


from sys import stdin
from collections import deque
mod = 10 ** 9 + 7
import sys
import random
from queue import PriorityQueue
from bisect import bisect_right
from bisect import bisect_left
from collections import defaultdict
from math import sqrt, factorial, gcd, log2, inf, ceil
import heapq
input = lambda : sys.stdin.readline().rstrip()
from sys import stdin, stdout
from heapq import heapify, heappush, heappop
from itertools import permutations
from math import factorial as f

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p
t = int(input())
for _ in range(t):
	s = input()
	ans = []
	(a1, a2) = (s.count('1'), s.count('0'))
	z = max(a1, a2)
	if a1 == 0 or a2 == 0:
		print(s)
		continue
	for i in range(2 * len(s)):
		if i % 2 == 0:
			ans.append('1')
		else:
			ans.append('0')
	print(''.join(ans))


t = int(input())
for i in range(t):
	s = input()
	flag_1 = 1
	flag_0 = 1
	for j in s:
		if j == '0':
			flag_1 = 0
		if j == '1':
			flag_0 = 0
	if flag_1 == 1 or flag_0 == 1:
		print(s)
	else:
		print('10' * len(s))


for _ in range(int(input())):
	L = input()
	FLAG1 = 0
	FLAG2 = 0
	count1 = 0
	count2 = 0
	for i in range(len(L)):
		if L[i] == '1':
			count1 += 1
			FLAG1 = 1
		if L[i] == '0':
			count2 += 1
			FLAG2 = 1
	if FLAG1 == 1 and FLAG2 == 1:
		print('10' * len(L))
	elif FLAG1 == 1:
		print('1' * (len(L) + 1))
	else:
		print('0' * (len(L) + 1))


T = int(input())
for _ in range(T):
	t = input()
	flag = 0
	A = [0, 0]
	for i in t:
		if A[int(i)] == 0:
			flag = flag + 1
			A[int(i)] = A[int(i)] + 1
		if flag == 2:
			break
	if flag == 2:
		s = (t[0] + str((int(t[0]) + 1) % 2)) * len(t)
		print(s)
	else:
		print(t)


for _ in range(int(input())):
	t = str(input())
	n0 = 0
	n1 = 0
	for i in range(len(t)):
		if t[i] == '1':
			n1 += 1
		else:
			n0 += 1
	if n1 == 0 or n0 == 0:
		print(t)
	else:
		print('10' * (n1 + n0))


def smaller(x):
	if '0' in x and '1' in x:
		ans = list(x)
		for y in range(len(ans) - 1):
			if ans[y] == ans[y + 1]:
				if ans[y] == '0':
					ans[y] += '1'
				else:
					ans[y] += '0'
		return ''.join(ans)
	else:
		return x
t = int(input())
for x in range(t):
	print(smaller(input()))


inf = 10 ** 15
mod = 10 ** 9 + 7
t = int(input())
for test in range(t):
	t = input()
	if len(t) <= 2:
		print(t)
	elif not '0' in t or not '1' in t:
		print(t)
	else:
		s = []
		if t[0] == '0':
			for i in range(len(t)):
				s.append('0')
				s.append('1')
		else:
			for i in range(len(t)):
				s.append('1')
				s.append('0')
		ans = ''.join(s)
		print(ans)


T = int(input())
for ts in range(T):
	s = input()
	if len(set(s)) == 1:
		print(s)
	else:
		print('01' * len(s))


for _ in range(int(input())):
	st = input()
	if int(st) == 0:
		st = str(st)
		st = '0' * (2 * len(st) - 1)
	elif st == '1' * len(st):
		st = '1' * (2 * len(st) - 1)
	else:
		st = '10' * len(st)
	print(st)


test = int(input())
for _ in range(test):
	t = str(input())
	if '0' not in t or '1' not in t:
		print(t)
		continue
	s = ''
	for each in range(len(t)):
		if each == len(t) - 1:
			s += t[each]
			break
		s += t[each]
		if t[each + 1] != t[each]:
			continue
		else:
			s += '1' if t[each] == '0' else '0'
	print(s)


def get():
	tt = input()
	leng = len(tt)
	if leng <= 2 or '1' not in tt or '0' not in tt:
		print(tt)
	else:
		s = ''
		for i in range(leng - 1):
			s += tt[i]
			if tt[i] == tt[i + 1]:
				s += str(1 - int(tt[i]))
		s += tt[-1]
		print(s)
k = int(input())
for _ in range(k):
	get()


arr = [[], []]

def out1(x, n, m):
	if x <= 0:
		return True
	if n <= 0:
		if x - 10 * m > 0:
			return False
		else:
			return True
	if m <= 0:
		return False
	return out1(x // 2 + 10, n - 1, m) or out1(x - 10, n, m - 1)

def out():
	s = input()
	if len(s) < 3:
		print(s)
		return
	flag = 0
	for i in range(len(s) - 1):
		if s[i] != s[i + 1]:
			flag = 1
			break
	if flag == 0:
		print(s)
		return
	for i in range(len(s) - 1):
		if s[i] == s[i + 1]:
			print(s[i], end='')
			if s[i] == '1':
				print('0', end='')
			else:
				print('1', end='')
		else:
			print(s[i], end='')
	print(s[len(s) - 1])
	return
ans = 0
for i in range(int(input())):
	out()


def allSame(li):
	c = li[0]
	for i in li:
		if i != c:
			return False
	return True
for _ in range(int(input())):
	s = input()
	li = list(s)
	if allSame(li):
		for i in li:
			print(i, end='')
		print()
		continue
	i = 1
	print(li[0], end='')
	ctr = 1
	while i < len(s):
		if li[i] == li[i - 1]:
			if li[i] == '1':
				print('0', end='')
			else:
				print('1', end='')
			ctr += 1
		print(li[i], end='')
		ctr += 1
		i += 1
	if ctr % 2 == 1:
		if li[0] == '0':
			print('1', end='')
		else:
			print('0', end='')
	print()


t = int(input())
while t:
	s = input()
	z = 0
	o = 0
	for i in range(len(s)):
		if s[i] == '0':
			z = z + 1
		else:
			o = o + 1
	if z == len(s):
		for i in range(len(s)):
			print('0', end='')
	elif o == len(s):
		for i in range(len(s)):
			print('1', end='')
	elif s[0] == '1':
		for i in range(len(s)):
			print('10', end='')
	elif s[0] == '0':
		for i in range(len(s)):
			print('01', end='')
	print('')
	t -= 1


import sys
input = sys.stdin.readline
t = int(input())

def countf(s, a):
	counter = 0
	for i in s:
		if i == a:
			counter += 1
	return counter
for r in range(t):
	s = input().strip('\n')
	n = len(s)
	ans = ''
	for i in range(2 * n):
		if i % 2 == 0:
			ans += '1'
		else:
			ans += '0'
	if len(s) == 2 or countf(s, '1') == n or countf(s, '0') == n:
		print(s)
	else:
		print(ans)


def aS(s):
	n = len(s)
	for i in range(1, n):
		if s[i] != s[0]:
			return False
	return True
for _ in range(int(input())):
	s = input()
	a = '01'
	b = '10'
	r = ''
	if aS(s):
		print(s)
	else:
		if s[0] == 1:
			for i in range(len(s)):
				r = r + b
		else:
			for i in range(len(s)):
				r = r + a
		print(r)


T = int(input())
for _ in range(T):
	s = input()
	if '0' not in s or '1' not in s:
		ans = s
	else:
		ans = [s[0]]
		n = len(s)
		i = 1
		while i < n:
			if s[i] == ans[-1]:
				c = str(1 - int(ans[-1]))
				ans.append(c)
			else:
				ans.append(s[i])
				i += 1
		ans = ''.join(ans)
	print(ans)


import sys
import math

def ii():
	return sys.stdin.readline().strip()

def idata():
	return [int(x) for x in ii().split()]

def solve_of_problem():
	s = ii()
	n = len(s)
	if s == '1' * n or s == '0' * n:
		print(s)
	else:
		print('01' * n)
	return
for ______ in range(int(ii())):
	solve_of_problem()


n = int(input())
while n:
	t = input()
	o = t.count('1')
	z = len(t) - o
	if o == 0 or z == 0:
		print(t)
	else:
		s = ''
		if t[0] == '0':
			s += '0'
			z -= 1
			for i in range(1, len(t)):
				if t[i] != s[-1]:
					s += t[i]
				else:
					a = 1 - int(t[i])
					s += str(a) + t[i]
			print(s)
		else:
			s += '1'
			o -= 1
			for i in range(1, len(t)):
				if t[i] != s[-1]:
					s += t[i]
				else:
					a = 1 - int(t[i])
					s += str(a) + t[i]
			print(s)
	n -= 1


import sys
try:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
except:
	input = sys.stdin.readline

def takeInput():
	return [int(x) for x in input().strip().split()]
t = int(input())
while t != 0:
	t -= 1
	s = input()
	if '0' in s and '1' in s:
		if s[0] == '0':
			ans = '01' * (len(s) - 1)
		else:
			ans = '10' * (len(s) - 1)
	else:
		ans = s
	print(ans)


for _ in range(int(input())):
	s = input()
	one = s.count('1')
	zero = s.count('0')
	if one == 0 or zero == 0 or len(s) <= 2:
		print(s)
	else:
		st = s[0]
		output = st
		for i in range(1, 2 * len(s)):
			if st == '0':
				st = '1'
				output += st
			else:
				st = '0'
				output += st
		print(output)


from collections import deque
for _ in range(int(input())):
	x = input()
	if not (x.count('1') > 0 and x.count('0') > 0):
		print(x)
		continue
	for i in range(len(x)):
		if i == len(x) - 1:
			print(x[i])
			continue
		print(x[i], end='')
		if x[i + 1] == x[i]:
			print('1' if x[i] == '0' else '0', end='')


from sys import stdin
input = stdin.readline
for _ in range(int(input())):
	a = input().rstrip()
	if a.count('0') == 0 or a.count('1') == 0:
		print(a)
	else:
		print('10' * len(a))


for _ in range(int(input())):
	t = str(input())
	if len(set(t)) == 1:
		print(t)
	else:
		s = []
		n = len(t)
		for i in range(n):
			s.append(t[i])
			if t[i] == t[min(i + 1, n - 1)]:
				s.append(str(int(not int(t[i]))))
		s = ''.join(s)
		if len(s) > 2 * n:
			print(s[:2 * n])
		else:
			print(s)


inp = []
out = []
for x in range(int(input())):
	s = input()
	for i in range(len(s) - 1):
		if s[i] != s[i + 1]:
			out.append((s[0] + str(1 - int(s[0]))) * len(s))
			break
	if len(out) < x + 1:
		out.append(s)
for o in out:
	print(o)


T = int(input())
while T > 0:
	T -= 1
	t = input()
	l = 2 * len(t)
	s = [0] * l
	for i in range(1, len(s), 2):
		s[i] = 1
	a = ''
	count = [0, 0]
	for i in t:
		count[int(i)] += 1
	if count[0] == 0:
		a = '1' * len(t)
	elif count[1] == 0:
		a = '0' * len(t)
	else:
		for i in s:
			a += str(i)
	print(a)


t = int(input())
for i in range(t):
	s = input()
	if s.find('0') != -1 and s.find('1') != -1:
		ans = ''
		for j in range(len(s)):
			ans += '01'
		print(ans)
	else:
		print(s)


for item in [0] * int(input()):
	pointer = 0
	variable = '1'
	k = []
	s = input()
	if s.count('1') == len(s) or s.count('0') == len(s):
		r = ''.join(s)
	else:
		if s[0] == '1':
			for i in range(len(s)):
				k.append('1')
				k.append('0')
		if s[0] == '0':
			for i in range(len(s)):
				k.append('0')
				k.append('1')
		r = ''.join(k)
	print(r)


def ch(a):
	if a == '0':
		return '1'
	return '0'
T = int(input())
for _ in range(0, T):
	s = input()
	if s.count('1') == len(s) or s.count('0') == len(s):
		print(s)
	else:
		L = [s[0]]
		for i in range(1, len(s)):
			if s[i] == s[i - 1]:
				L.append(ch(s[i]))
			L.append(s[i])
		ans = ''.join(L)
		print(ans)


T = int(input())
while T:
	t = input()
	if '0' in t and '1' in t:
		print('01' * len(t))
	else:
		print(t)
	T -= 1


for _ in range(int(input())):
	t = input()
	if len(t) > 2:
		a = t[0]
		if t.count('0') == len(t) or t.count('1') == len(t):
			print(t)
			continue
		if a == '0':
			ans = ''
			v = 0
			for i in t:
				if v % 2 == 0:
					if i == '0':
						ans += '0'
						v += 1
					else:
						ans += '01'
				elif i == '1':
					ans += '1'
					v += 1
				else:
					ans += '10'
		if a == '1':
			ans = ''
			v = 1
			for i in t:
				if v % 2 == 0:
					if i == '0':
						ans += '0'
						v += 1
					else:
						ans += '01'
				elif i == '1':
					ans += '1'
					v += 1
				else:
					ans += '10'
		print(ans)
	else:
		print(t)


from array import array
from math import log

def solve(s):
	res = []
	lookup = {'1': '0', '0': '1'}
	if '1' in s and '0' not in s:
		return s
	if '0' in s and '1' not in s:
		return s
	res += [s[0]]
	for c in s[1:]:
		if c != res[-1]:
			res += [c]
		else:
			res += lookup[c]
			res += [c]
	return ''.join(res)
test_cases = int(input())
for i in range(test_cases):
	s = input()
	print(str(solve(s)))


n = int(input())

def getp(s):
	k = len(s)
	hp = True
	for i in range(1, k):
		for j in range(k - i):
			if s[j] != s[j - i]:
				hp = False
				break
		if hp == True:
			return i
		hp = True
	return k
for i in range(n):
	s = input()
	l = len(s)
	p = getp(s)
	if p < 2:
		print(s)
		continue
	else:
		t = ''
		for j in range(l - 1):
			if s[j] == s[j + 1]:
				t += s[j]
				t += str(abs(1 - int(s[j])))
			else:
				t += s[j]
		t += s[l - 1]
	print(t)


t = int(input())
for i in range(t):
	s = input()
	l = len(s)
	flag1 = True
	for ch in s:
		if ch == '0':
			flag1 = False
			break
	if flag1:
		print(s)
		continue
	flag0 = True
	for ch in s:
		if ch == '1':
			flag0 = False
			break
	if flag0:
		print(s)
		continue
	print('01' * l)


for _ in range(int(input())):
	string = input()
	(begin, k) = (string[0], 1)
	for x in range(1, len(string)):
		if string[x] != begin:
			k += 1
			break
	if k == 1:
		print(string)
	else:
		for s in range(1, len(string)):
			if begin[-1] == '1':
				if string[s] == '0':
					begin += string[s]
				else:
					begin += '0' + string[s]
			elif begin[-1] == '0':
				if string[s] == '1':
					begin += string[s]
				else:
					begin += '1' + string[s]
		print(begin)


t = int(input())
for _ in range(t):
	string = input()
	s = string[0]
	flag = 0
	for ch in string:
		if ch != s:
			flag = 1
			break
	if flag == 0:
		print(string)
		continue
	flag = string[0]
	i = 1
	res = string[0]
	while i < len(string):
		if flag == string[i]:
			res += str(int(string[i]) ^ 1)
		res += string[i]
		flag = string[i]
		i += 1
	print(res)


T = int(input())
for _ in range(T):
	string = input()
	A = list(string)
	if len(set(A)) == 1:
		print(string)
	else:
		temp = len(string)
		result = ''
		for _ in range(temp):
			result += '01'
		print(result)


def reverse(o):
	if o == '1':
		return '0'
	return '1'

def solve(s):
	ls = set(s)
	if len(ls) == 1:
		return s
	begin = s[0]
	string = s[0]
	for i in range(1, len(s)):
		l = s[i]
		if begin == l:
			string += reverse(l)
		string += l
		begin = string[-1]
	if string[0] == string[-1]:
		string += reverse(string[0])
	return string

def main():
	t = int(input())
	for i in range(t):
		d = input()
		ans = solve(d)
		print(ans)
main()


p = int(input())
for pp in range(p):
	t = input()
	bhul = True
	for i in range(len(t)):
		if t[i] != t[0]:
			bhul = False
	if bhul:
		print(t)
	else:
		k = '10'
		for i in range(len(t)):
			print(k, end='')
		print()


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	t = list(input())
	t.pop(-1)
	n = 0
	if t[0] == '0':
		n = 1
		s = ['0', '1']
	else:
		s = ['1', '0']
	keep = 1
	for i in t:
		if i != t[0]:
			keep = 0
	if len(t) <= 2:
		keep = 1
	if keep == 1:
		print(''.join(t))
	else:
		for l in t:
			if l == s[-1]:
				s.append(s[-2])
			s.append(l)
		s.pop(0)
		s.pop(0)
		print(''.join(s))


for _ in range(int(input())):
	t = input()
	n = len(t)
	flag = True
	for j in range(n - 1):
		if t[j] != t[j + 1]:
			flag = False
	if flag:
		print(t)
	elif t[0] == '1':
		print('10' * n)
	else:
		print('01' * n)


from sys import stdin

def list_int():
	s = stdin.readline()[:-1]
	return list(map(int, s.split()))

def list_float():
	s = stdin.readline()[:-1]
	return list(map(float, s.split()))

def list_str():
	s = stdin.readline()[:-1]
	return list(s.split())

def space_int():
	s = stdin.readline()[:-1]
	return map(int, s.split())

def space_float():
	s = stdin.readline()[:-1]
	return map(float, s.split())

def space_str():
	s = stdin.readline()[:-1]
	return s.split()

def _int():
	s = stdin.readline()[:-1]
	return int(s)

def _str():
	s = stdin.readline()[:-1]
	return s

def _float():
	s = stdin.readline()[:-1]
	return float(s)

def _gcd(a, b):
	if a == 0:
		return b
	return _gcd(b % a, a)

def _sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	prime[0] = False
	prime[1] = False
	return prime
alpha = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
nums = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
maxi = -2 ** 32
mini = 2 ** 32
mod = 10 ** 9 + 7
for _ in range(int(input())):
	t = _str()
	x = t.count('1')
	y = t.count('0')
	if x == 0:
		print(t)
	elif y == 0:
		print(t)
	else:
		s = '01' * len(t)
		print(s)


for t in range(int(input())):
	x = list(input())
	n = len(x)
	if x.count(x[0]) == n:
		print(''.join(x))
	else:
		y = [x[0]]
		for i in range(1, n):
			if x[i] == x[i - 1] == '0':
				y.append('1')
			elif x[i] == x[i - 1] == '1':
				y.append('0')
			y.append(x[i])
		print(''.join(y))


test_cases = int(input())
while test_cases > 0:
	string = input()
	if len(string) < 2:
		print(string)
	else:
		test = list(set(list(string)))
		if len(test) == 1:
			print(string)
		elif string[0] == '0':
			print('01' * len(string))
		else:
			print('10' * len(string))
	test_cases -= 1


def solve():
	test = input()
	temp = list(test)
	z = temp.count('0')
	o = temp.count('1')
	if z == len(test) or o == len(test):
		print(test)
	else:
		ans = []
		if test[0] == '1':
			for i in range(2 * len(test)):
				if i % 2 == 0:
					ans.append('1')
				else:
					ans.append('0')
		else:
			for i in range(2 * len(test)):
				if i % 2 == 0:
					ans.append('0')
				else:
					ans.append('1')
		for i in ans:
			print(i, end='')
		print(end='\n')
T = 1
T = int(input())
for _ in range(1, T + 1):
	solve()


from collections import Counter
for _ in range(int(input())):
	s = input()
	c = Counter(s)
	if c['0'] == 0 or c['1'] == 0:
		print(s)
		continue
	res = ''
	for i in range(len(s) - 1):
		if s[i] == s[i + 1]:
			res += s[i]
			res += str(int(s[i]) ^ 1)
		else:
			res += s[i]
	res += s[-1]
	print(res)


def solve():
	t = int(input())
	for i in range(t):
		s = input()
		if len(set(s)) == 1:
			ans = s
		else:
			ans = s[0]
			for j in range(1, len(s)):
				if s[j] == s[j - 1]:
					ans += str(int(s[j]) ^ 1) + s[j]
				else:
					ans += s[j]
		print(ans)
solve()


T = int(input())
for t in range(T):
	s1 = input()
	if not '0' in s1 or not '1' in s1:
		print(s1)
	else:
		s2 = ''
		for i in range(len(s1) - 1):
			if s1[i] == '1' and s1[i + 1] == '1':
				s2 += '10'
			elif s1[i] == '0' and (i == 0 or s1[i - 1] == '0'):
				s2 += '10'
			else:
				s2 += s1[i]
		if s1[-1] == '0' and s2[-1] == '0':
			s2 += '1'
		s2 += s1[-1]
		print(s2)


import math

def s():
	stri = input()
	n = len(stri)
	if n <= 2:
		print(stri)
	elif len(set(stri)) == 1:
		print(stri)
	else:
		new_str = ''
		for i in range(n):
			new_str += '10'
		print(new_str)
t = int(input())
for i in range(t):
	s()


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__

def gift():
	for _ in range(t):
		kap = input()
		(count0, count1) = (kap.count('0'), kap.count('1'))
		diulei = int(kap, 2)
		if count0 == 0 or count1 == 0:
			yield kap
		else:
			if kap[0] == '0':
				startpattern = '01'
			else:
				startpattern = '10'
			n = len(kap)
			i = 1
			mul = 1
			while i < n:
				tis = kap[i]
				prev = kap[i - 1]
				if tis == kap[0]:
					mul += 1
				elif prev != kap[0]:
					mul += 1
				i += 1
			yield (startpattern * mul)
t = int(input())
ans = gift()
print(*ans, sep='\n')


t = int(input())
for _ in range(t):
	str1 = input()
	len1 = len(str1)
	len2 = len1 * 2
	ans = ['0' * len2, '1' * len2, '10' * (len2 // 2), '01' * (len2 // 2)]
	flag1 = 0
	for i in range(4):
		str2 = ans[i]
		k = 0
		for j in range(len2):
			if str2[j] == str1[k]:
				k += 1
			if k == len1:
				print(ans[i])
				flag1 = 1
				break
		if flag1 == 1:
			break


import sys
input = sys.stdin.readline

def print(val):
	sys.stdout.write(str(val) + '\n')

def yo():
	for _ in range(int(input().strip())):
		s = input().strip()
		new_string = ''
		ele = s[0]
		fail = False
		for char in s:
			if char != ele:
				fail = True
				break
		if fail:
			for i in range(len(s) - 1):
				if s[i] == s[i + 1]:
					if s[i] == '0':
						new_string += '01'
					else:
						new_string += '10'
				else:
					new_string += s[i]
			new_string += s[-1]
			print(new_string)
		else:
			print(s)
yo()


for _ in range(int(input())):
	s = input()
	n = len(s)
	if 1 == len(set(s)):
		print(s)
		continue
	ans = []
	ans.append(s[0])
	for i in range(1, n):
		if s[i] == s[i - 1]:
			if s[i] == '0':
				ans.append('1')
			else:
				ans.append('0')
		ans.append(s[i])
	for x in range(len(ans)):
		print(ans[x], end='')
	print()


for _ in range(int(input())):
	seen = ''
	s = input()
	for c in s:
		if c == '0' and '0' not in seen:
			seen += '0'
		elif c == '1' and '1' not in seen:
			seen += '1'
	print(seen * len(s))


T = int(input())
for _ in range(T):
	s = input()
	n = len(s)
	final_str = ''
	flag = 0
	if n <= 2:
		print(s)
	else:
		for i in range(n - 1):
			if s[i] != s[i + 1]:
				flag = 1
				break
		if flag == 0:
			print(s)
		else:
			final_str = s[0]
			for i in range(1, n):
				if s[i] == s[i - 1]:
					if s[i] == '0':
						final_str += '1'
					else:
						final_str += '0'
				final_str += s[i]
			print(final_str)


for _ in range(int(input())):
	s = input()
	if s.count('0') == len(s):
		print(s)
	elif s.count('1') == len(s):
		print(s)
	else:
		ans = s + ''
		i = 1
		while i < len(ans):
			if ans[i] == ans[i - 1]:
				ans = ans[:i] + str(abs(int(ans[i]) - 1)) + ans[i:]
			i += 1
		print(ans)


n = int(input())
for i in range(n):
	a = input()
	x = len(a)
	s = a.count('0')
	r = a.count('1')
	if r * s == 0:
		if r == 0:
			print('0' * s)
		else:
			print('1' * r)
	elif a[0] == 1:
		print('10' * x)
	else:
		print('01' * x)


t = int(input())
for qq in range(t):
	s = input()
	if s == '0' * len(s) or s == '1' * len(s):
		print(s)
	else:
		print('01' * len(s))


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

def op():
	return list(map(int, input().split()))
for _ in range(int(input())):
	s = input()
	(s1, s2) = (s.count('0'), s.count('1'))
	if s1 == 0:
		print('1' * len(s))
	elif s2 == 0:
		print('0' * len(s))
	else:
		x = len(s)
		print('01' * x)


from sys import stdin
test = int(stdin.readline())
while test > 0:
	test -= 1
	s = stdin.readline()
	n = len(s)
	kt1 = kt2 = False
	for i in range(n - 1):
		if s[i] == '1':
			kt1 = True
		if s[i] == '0':
			kt2 = True
	if not kt1 or not kt2:
		print(s, end='\n')
	else:
		for i in range(n - 1):
			print('01', end='')
		print(end='\n')


t = int(input())
for _ in range(t):
	s = input()
	n = len(s)
	if s.count('1') == n or s.count('1') == 0:
		print(s)
	else:
		odp = [0, 1] * n
		for i in range(n):
			if i < n - 1:
				print('01', end='')
			else:
				print('01')


import sys
from sys import stdin, stdout
ans = []
for h in range(int(stdin.readline())):
	s = stdin.readline().strip()
	if s.count('0') == 0 or s.count('1') == 0:
		ans.append(s)
	else:
		ans.append(''.join(['1' if i % 2 else '0' for i in range(2 * len(s))]))
stdout.write('\n'.join(ans))


import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
from decimal import *

class Scanner:

	@staticmethod
	def int():
		return int(sys.stdin.readline().rstrip())

	@staticmethod
	def string():
		return sys.stdin.readline().rstrip()

	@staticmethod
	def map_int():
		return [int(x) for x in Scanner.string().split()]

	@staticmethod
	def string_list(n):
		return [Scanner.string() for i in range(n)]

	@staticmethod
	def int_list_list(n):
		return [Scanner.map_int() for i in range(n)]

	@staticmethod
	def int_cols_list(n):
		return [Scanner.int() for i in range(n)]

class Math:

	@staticmethod
	def gcd(a, b):
		if b == 0:
			return a
		return Math.gcd(b, a % b)

	@staticmethod
	def lcm(a, b):
		return a * b // Math.gcd(a, b)

	@staticmethod
	def divisor(n):
		res = []
		i = 1
		for i in range(1, int(n ** 0.5) + 1):
			if n % i == 0:
				res.append(i)
				if i != n // i:
					res.append(n // i)
		return res

	@staticmethod
	def round_up(a, b):
		return -(-a // b)

	@staticmethod
	def is_prime(n):
		if n < 2:
			return False
		if n == 2:
			return True
		if n % 2 == 0:
			return False
		d = int(n ** 0.5) + 1
		for i in range(3, d + 1, 2):
			if n % i == 0:
				return False
		return True

def pop_count(x):
	x = x - (x >> 1 & 6148914691236517205)
	x = (x & 3689348814741910323) + (x >> 2 & 3689348814741910323)
	x = x + (x >> 4) & 1085102592571150095
	x = x + (x >> 8)
	x = x + (x >> 16)
	x = x + (x >> 32)
	return x & 127
MOD = int(1000000000.0) + 7
INF = int(1000000000000000.0)

def solve():
	S = Scanner.string()
	if not '0' in S:
		print(S)
	elif not '1' in S:
		print(S)
	else:
		print('10' * len(S))

def main():
	T = Scanner.int()
	for _ in range(T):
		solve()
main()


list_lelo = lambda : list(map(int, input().split()))
int_lelo = lambda : int(input())
for i in range(int_lelo()):
	string = input()
	if len(set(string)) == 1:
		print(string)
	else:
		lst = list(map(int, list(string)))
		i = 0
		while i < len(lst) - 1:
			if lst[i] == lst[i + 1]:
				lst.insert(i + 1, 1 - lst[i])
			i += 1
		print(''.join(map(str, lst)))


def NO():
	return print('NO')

def YES():
	return print('YES')

def INT():
	return int(input())

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

def STR():
	return input()

def MAP():
	return map(int, input().split())
for _ in range(INT()):
	t = STR()
	ans = t[0]
	if '0' in t and '1' in t:
		for i in range(1, len(t)):
			if t[i] == '0' and t[i - 1] == '1':
				ans += '0'
			elif t[i] == '0' and t[i - 1] == '0':
				ans += '10'
			elif t[i] == '1' and t[i - 1] == '0':
				ans += '1'
			elif t[i] == '1' and t[i - 1] == '1':
				ans += '01'
		print(ans)
	else:
		print(t)


for jj in range(int(input())):
	x = input()
	s = len(x)
	if x.count('0') == s:
		print(x)
	elif x.count('1') == s:
		print(x)
	elif x == '01' or x == '10':
		print(x)
	else:
		ans = '01' * s
		print(ans)


for _ in range(int(input())):
	g = input()
	s = list(g)
	count1 = s.count('1')
	count0 = s.count('0')
	if count1 == 0 or count0 == 0:
		print(g)
	else:
		for i in range(2 * len(g)):
			if i & 1 == 0:
				print('1', end='')
			else:
				print('0', end='')
		print()


for _ in range(int(input())):
	a = input()
	if '0' not in a or '1' not in a:
		print(a)
	else:
		print(''.join(['01' for __ in a]))


t = int(input())
for i in range(t):
	str = input()
	pos = []
	for i in range(len(str) - 1):
		if str[i] == str[i + 1]:
			pos.append(i + 1)
	if len(pos) == len(str) - 1:
		print(str)
	elif len(pos) == 0:
		print(str)
	else:
		pos.append(10000000)
		i = 0
		j = 0
		while i < len(str) and j < len(pos):
			if pos[j] == i:
				j = j + 1
				if str[i] == '0':
					print('1', end='')
				else:
					print('0', end='')
			print(str[i], end='')
			i = i + 1
		print('\n')


n = int(input())
for v in range(n):
	b = input()
	p = 0
	if len(b) == b.count('1') or len(b) == b.count('0'):
		print(b)
	elif b[0] == '1':
		print('10' * len(b))
	else:
		print('01' * len(b))


n = int(input())
for i in range(n):
	x = input()
	l = []
	e = 0
	d = ''
	if x.count('0') == len(x):
		e += 1
	elif x.count('1') == len(x):
		e += 1
	else:
		for i in range(len(x) - 1):
			if x[i] == '0' and x[i + 1] == '0':
				l.append(x[i])
				l.append('1')
			elif x[i] == '1' and x[i + 1] == '1':
				l.append(x[i])
				l.append('0')
			else:
				l.append(x[i])
	l.append(x[-1])
	for i in l:
		d += i
	if e > 0:
		print(x)
	else:
		print(d)


t = int(input())
for _ in range(t):
	s = input()
	w = len(s)
	e = list(set(s))
	if len(e) == 1:
		print(s)
	else:
		q = '01' * w
		print(q)


for ii in range(int(input())):
	t = input()
	n = len(t)
	temp = 10000
	f = 1
	for i in range(1, 101):
		f = 1
		for j in range(n - i):
			if t[j] != t[j + i]:
				f = 0
				break
		if f:
			temp = min(temp, i)
			break
	if temp == 1 or temp == 2:
		print(t)
		continue
	ans = ''
	if t[0] == '1':
		ans += '1'
	else:
		ans += '0'
	for i in range(1, 2 * n):
		if ans[i - 1] == '0':
			ans += '1'
		else:
			ans += '0'
	print(ans)


t = int(input())
for ti in range(t):
	s = input()
	if s.count('0') == len(s) or s.count('1') == len(s):
		print(s)
	else:
		print('10' * len(s))


t = int(input())
while t > 0:
	s = input()
	if s.count('1') == 0 or s.count('0') == 0:
		print(s)
	else:
		o = '10' * len(s)
		print(o)
	t -= 1


def isSubSequence(str1, str2):
	m = len(str1)
	n = len(str2)
	j = 0
	i = 0
	while j < m and i < n:
		if str1[j] == str2[i]:
			j = j + 1
		i = i + 1
	return j == m
for _ in range(int(input())):
	t = input()
	flag = 1
	k = 1
	si = 0
	maxlength = 2 * len(t)
	if t == '0' * len(t):
		print(t)
		continue
	if t == '1' * len(t):
		print(t)
		continue
	while flag == 1:
		tempString = t[0]
		i = 0
		while i + 1 < maxlength - k:
			gg = str(1 - int(t[0]))
			tempString += k * gg
			tempString += t[0]
			i = len(tempString) - 1
		while len(tempString) < maxlength:
			tempString += gg
		if isSubSequence(t, tempString):
			print(tempString)
			flag = 0
		k += 1


for _ in range(int(input())):
	s = input()
	f = s[0]
	zero = s.count('0')
	one = len(s) - zero
	if zero == 0 or one == 0:
		print(s)
	else:
		p = '01' if f == '0' else '10'
		print(p * len(s))


def g(t):
	s = ''
	r = 0
	a = 0
	for i in range(1, len(t)):
		if t[i] != t[i - 1]:
			r = 1
			break
	if r == 1 and t[0] == '1':
		for i in range(0, 2 * len(t)):
			if i % 2 == 0:
				s += '1'
			else:
				s += '0'
	elif r == 1 and t[0] == '0':
		for i in range(0, 2 * len(t)):
			if i % 2 == 0:
				s += '0'
			else:
				s += '1'
	if r == 0:
		s = t
	return s
N = int(input())
while N > 0:
	t = input()
	print(g(t))
	N -= 1


import sys
input = sys.stdin.readline

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

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

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

def invr():
	return map(int, input().split())
t = inp()
for _ in range(t):
	s = input().rstrip()
	has = True
	l = s[0]
	for i in range(1, len(s)):
		if l != s[i]:
			has = False
			break
	if has:
		print(s)
	else:
		ans = []
		for i in range(len(s)):
			ans.append('1')
			ans.append('0')
		print(''.join(ans))


T = int(input())
for _ in range(T):
	t = input()
	nt = len(t)
	if len(set(t)) == 1:
		print(t)
	elif len(set(t)) == 2 and nt == 2:
		print(t)
	else:
		tmp = '10' * nt
		ntmp = len(tmp)
		c = [-1] * ntmp
		p = 0
		for i in range(ntmp):
			if t[p] == tmp[i]:
				c[i] = p
				if p == 0:
					init = i
				p += 1
			if p >= nt:
				fin = i
				break
		print(tmp[init:fin + 1])


for _ in range(int(input())):
	t = input()
	count_one = t.count('1')
	if count_one == 0 or count_one == len(t):
		print(t)
	else:
		print('10' * len(t))


l = int(input())
for q in range(l):
	t = input()
	if t.count('0') == 0 or t.count('1') == 0:
		print(t)
	else:
		s = ''
		while len(s) < len(t) * 2:
			s += '10'
		print(s[0:min(len(s), 2 * len(t))])


for i in range(int(input())):
	t = str(input())
	c = t.count('0')
	d = len(t)
	if d <= 2 or c == 0 or c == d:
		print(t)
	else:
		s = ''
		for j in range(0, d - 1):
			if t[j] == t[j + 1]:
				s = s + t[j] + str(1 - int(t[j + 1]))
			else:
				s = s + t[j]
		s = s + t[d - 1]
		print(s)


MOD = 10 ** 9 + 7

def main():
	for _ in inputt():
		t = input()
		if len(set(t)) == 1:
			print(t)
		else:
			t = len(t)
			print('10' * t)
from math import *
from heapq import *
from itertools import *
from functools import reduce, lru_cache, partial
from collections import Counter, defaultdict
import re, copy, operator, cmath
import sys, io, os, builtins
sys.setrecursionlimit(1000)
BUFSIZE = 8192

class FastIO(io.IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = io.BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(io.IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	if args:
		sys.stdout.write(str(args[0]))
		split = kwargs.pop('split', ' ')
		for arg in args[1:]:
			sys.stdout.write(split)
			sys.stdout.write(str(arg))
	sys.stdout.write(kwargs.pop('end', '\n'))

def debug(*args, **kwargs):
	print('debug', *args, **kwargs)
	sys.stdout.flush()
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip()
inputt = lambda t=0: range(t) if t else range(int(input()))
inputs = lambda : input().split()
inputi = lambda : map(int, inputs())
inputl = lambda t=0, k=lambda : list(inputi()): [k() for _ in range(t)] if t else list(k())

def len(a):
	if isinstance(a, range):
		return -((a.start - a.stop) // a.step)
	return builtins.len(a)

def bisect_left(a, x, key=None, lo=0, hi=None):
	if lo < 0:
		lo = 0
	if hi == None:
		hi = len(a)
	if key == None:
		key = do_nothing
	while lo < hi:
		mid = (lo + hi) // 2
		if key(a[mid]) < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def bisect_right(a, x, key=None, lo=0, hi=None):
	if lo < 0:
		lo = 0
	if hi == None:
		hi = len(a)
	if key == None:
		key = do_nothing
	while lo < hi:
		mid = (lo + hi) // 2
		if x < key(a[mid]):
			hi = mid
		else:
			lo = mid + 1
	return lo

def insort_left(a, x, key=None, lo=0, hi=None):
	lo = bisect_left(a, x, key, lo, hi)
	a.insert(lo, x)

def insort_right(a, x, key=None, lo=0, hi=None):
	lo = bisect_right(a, x, key, lo, hi)
	a.insert(lo, x)
do_nothing = lambda x: x
bisect = bisect_right
insort = insort_right

def index(a, x, default=None, key=None, lo=0, hi=None):
	if lo < 0:
		lo = 0
	if hi == None:
		hi = len(a)
	if key == None:
		key = do_nothing
	i = bisect_left(a, x, key, lo, hi)
	if lo <= i < hi and key(a[i]) == x:
		return a[i]
	if default != None:
		return default
	raise ValueError

def find_lt(a, x, default=None, key=None, lo=0, hi=None):
	if lo < 0:
		lo = 0
	if hi == None:
		hi = len(a)
	i = bisect_left(a, x, key, lo, hi)
	if lo < i <= hi:
		return a[i - 1]
	if default != None:
		return default
	raise ValueError

def find_le(a, x, default=None, key=None, lo=0, hi=None):
	if lo < 0:
		lo = 0
	if hi == None:
		hi = len(a)
	i = bisect_right(a, x, key, lo, hi)
	if lo < i <= hi:
		return a[i - 1]
	if default != None:
		return default
	raise ValueError

def find_gt(a, x, default=None, key=None, lo=0, hi=None):
	if lo < 0:
		lo = 0
	if hi == None:
		hi = len(a)
	i = bisect_right(a, x, key, lo, hi)
	if lo <= i < hi:
		return a[i]
	if default != None:
		return default
	raise ValueError

def find_ge(a, x, default=None, key=None, lo=0, hi=None):
	if lo < 0:
		lo = 0
	if hi == None:
		hi = len(a)
	i = bisect_left(a, x, key, lo, hi)
	if lo <= i < hi:
		return a[i]
	if default != None:
		return default
	raise ValueError

class Tree:

	def __init__(n):
		self._n = n
		self._conn = [[] for _ in range(n)]
		self._list = [0] * n

	def connect(a, b):
		pass

class Sieve:

	def __init__(self):
		self._n = 6
		self._list = [2, 3, 5, 7, 11, 13]

	def extend(self, n):
		pass
sieve = Sieve()

def isprime(n):
	pass

def prime(n):
	pass

def factorint(n):
	factordict = defaultdict(int)
	for i in sieve:
		if n <= i * i:
			break
		while not n % i:
			factordict[i] += 1
			n //= i
	if n != 1:
		factordict[n] += 1
	return factordict
main()


import sys
from os import path
if path.exists('C:/Users/prana/Desktop/sublime/input.txt'):
	sys.stdin = open('C:/Users/prana/Desktop/sublime/input.txt', 'r')
	sys.stdout = open('C:/Users/prana/Desktop/sublime/output.txt', 'w')

def solve():
	t = input()
	q = list(t)
	zero = q.count('0')
	one = q.count('1')
	if zero == len(t) or one == len(t):
		print(t)
	else:
		ans = []
		if t[0] == '1':
			for i in range(2 * len(t)):
				if i % 2 == 0:
					ans.append('1')
				else:
					ans.append('0')
		else:
			for i in range(2 * len(t)):
				if i % 2 == 0:
					ans.append('0')
				else:
					ans.append('1')
		for i in ans:
			print(i, end='')
		print(end='\n')
T = 1
T = int(input())
for _ in range(1, T + 1):
	print('Case #', _, file=sys.stderr)
	solve()


from collections import Counter
t = int(input())
while t:
	s = input()
	k = Counter(s)
	if len(k) == 1:
		print(s)
	else:
		s = list(s)
		hehe = s[:]
		inserted = 0
		for i in range(1, len(s)):
			if s[i] == s[i - 1]:
				hehe.insert(i + inserted, str(1 - int(s[i])))
				inserted += 1
		print(''.join(hehe))
	t -= 1


import math
import bisect

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

def list_input():
	return list(num_input())
for _ in range(int(input())):
	t = input()
	if len(set(t)) == 1:
		print(t)
	else:
		if t[0] == '1':
			for i in range(len(t)):
				print('10', end='')
		else:
			for i in range(len(t)):
				print('01', end='')
		print()


t = int(input())
ans = []
for i in range(t):
	line = input()
	flag1 = False
	flag0 = False
	for j in line:
		if j == '1':
			flag1 = True
		else:
			flag0 = True
	if flag1 and flag0:
		len1 = len(line)
		line_new = line[0]
		for j in range(1, len1):
			if line[j] == line[j - 1]:
				if line[j] == '1':
					line_new += '01'
				else:
					line_new += '10'
			else:
				line_new += line[j]
		ans.append(line_new)
	else:
		ans.append(line)
for i in ans:
	print(i)


t = int(input())
for i in range(t):
	a = str(input())
	b = a.count('0')
	c = a.count('1')
	z = 0
	x = len(a)
	if b == 0 or c == 0:
		print(a)
		z += 1
	i = 0
	while i < x - 1:
		if a[i + 1] == a[i]:
			if a[i + 1] == '1':
				a = a[:i + 1] + '0' + a[i + 1:]
			else:
				a = a[:i + 1] + '1' + a[i + 1:]
			i += 1
			x += 1
		else:
			i += 1
	x = len(a)
	if x % 2 == 0 and z == 0:
		print(a)
	if x % 2 == 1 and z == 0:
		if a[-1] == '1':
			print(a + '0')
		if a[-1] == '0':
			print(a + '1')


import sys, math, cmath, time
start_time = time.time()

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

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

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

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

def solve():
	s = insr()
	a = list(s)
	q = a.count('1')
	w = a.count('0')
	if q == 0:
		qw = '0' * len(a)
	elif w == 0:
		qw = '1' * len(a)
	elif a[0] == '0':
		qw = '01' * (q + w)
	else:
		qw = '10' * (q + w)
	print(qw)

def main():
	ONLINE_JUDGE = __debug__
	if not ONLINE_JUDGE:
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	else:
		qw = 1
	t = 1
	t = inp()
	for tt in range(t):
		solve()
	if not ONLINE_JUDGE:
		print('Time Elapsed:', time.time() - start_time, 'seconds')

def counter(a):
	q = [0] * max(a)
	for i in range(len(a)):
		q[a[i] - 1] = q[a[i] - 1] + 1
	return q
main()
sys.stdout.close()


def optimizePeriod(t):
	zero_count = t.count('0')
	ones_count = len(t) - zero_count
	if zero_count == 0 or ones_count == 0:
		return t
	else:
		return '01' * len(t)
for _ in range(int(input())):
	t = input()
	out = optimizePeriod(t)
	print(out)


t = int(input())
for _ in range(t):
	s = input()
	op = ''
	ones = 0
	zeros = 0
	for i in range(len(s)):
		if s[i] == '1':
			ones += 1
		else:
			zeros += 1
	if ones == len(s) or zeros == len(s):
		op = s
	elif s[0] == '0':
		op = '01' * len(s)
	else:
		op = '10' * len(s)
	print(op)


exec(int(input()) * "t=input();print(('01'*len(t),t)[{*t}<{*'01'}]);")


t = int(input())

def allCharactersSame(s):
	n = len(s)
	for i in range(1, n):
		if s[i] != s[0]:
			return False
	return True
for t1 in range(t):
	y = str(input())
	if allCharactersSame(y):
		print(y)
	else:
		print('01' * int(len(y)))


for _ in range(int(input())):
	a = input()
	if '0' not in a or '1' not in a:
		print(a)
	else:
		print('01' * len(a))


for i in range(int(input())):
	a = input()
	b = set(a)
	if len(b) == 1:
		print(a)
	else:
		c = '10'
		print(c * (len(a) - 1) + '1')


def one(s):
	return len(set(s)) == 1
for _ in range(int(input())):
	t = input()
	n = len(t)
	if one(t):
		print(t)
	else:
		s = t[0]
		i = 1
		d = ['1', '0']
		while i < n:
			if t[i] == t[i - 1]:
				s += d[int(t[i])]
			s += t[i]
			i += 1
		print(s)


t = int(input())
for i in range(t):
	x = input()
	if len(set(x)) == 1:
		print(x)
		continue
	digits = {'1': '0', '0': '1'}
	res = []
	x = x + '!'
	for i in range(len(x) - 1):
		if x[i] == x[i + 1]:
			res.extend([x[i], digits[x[i]]])
		else:
			res.append(x[i])
	print(''.join(res))


tt = int(input())
for ii in range(tt):
	t = input()
	zeroes = 0
	ones = 0
	for i in t:
		if i == '0':
			zeroes += 1
		else:
			ones += 1
	if zeroes == 0 or ones == 0:
		print(t)
		continue
	s = []
	start = t[0]
	for i in range(len(t)):
		s.append(t[i])
		if i < len(t) - 1:
			if t[i] == t[i + 1]:
				s.append(str(1 - int(t[i])))
		elif s[0] == s[-1]:
			s.append(str(1 - int(t[i])))
	print(''.join(s))


test = int(input())
for i in range(test):
	t = input()
	if t.count('0') == len(t) or t.count('1') == len(t):
		print(t)
	else:
		string = t[0]
		for i in range(1, len(t)):
			if t[i - 1] == '0' and t[i] == '0':
				string = string + '10'
			elif t[i - 1] == '1' and t[i] == '1':
				string = string + '01'
			else:
				string = string + t[i]
		zero = string.count('0')
		one = string.count('1')
		if zero < one:
			string = string + '0'
		elif zero > one:
			string = string + '1'
		print(string)


def find_s(t):
	if all([t[i] == t[0] for i in range(len(t))]):
		return t
	elif t[0] == 0:
		return '01' * len(t)
	else:
		return '10' * len(t)
T = int(input())
for i in range(T):
	t = input()
	print(find_s(t))


t = int(input())
for _ in range(t):
	a = input()
	l = list(a)
	cn1 = a.count('0')
	if cn1 == 0 or cn1 == len(a):
		print(a)
		continue
	else:
		ans = [a[0]]
		i = 0
		while i < len(a) - 1:
			if a[i] == a[i + 1] and a[i] == '1':
				ans.append('0')
				ans.append('1')
			elif a[i] == a[i + 1] and a[i] == '0':
				ans.append('1')
				ans.append('0')
			else:
				ans.append(a[i + 1])
			i += 1
		an = ''.join(map(str, ans))
		print(an)


for _ in range(int(input())):
	s = input()
	(count0, count1) = (0, 0)
	temp = ''
	for i in s:
		if i == '0':
			count0 += 1
		else:
			count1 += 1
	l = list(s)
	if len(set(l)) == 1:
		print(s)
	elif len(set(l)) == len(s):
		print(s)
	else:
		for i in range(2 * len(s)):
			if i % 2 == 0:
				temp += '1'
			else:
				temp += '0'
		print(temp)


t = int(input())
while t:
	x = input()
	x = list(x)
	if x.count(x[0]) == len(x):
		print(''.join(x))
	elif x.count('1') == x.count('0') == 1:
		print(''.join(x))
	else:
		for i in range(1, len(x)):
			if x[i] == x[i - 1]:
				if x[i] == '1':
					x[i - 1] = '10'
				else:
					x[i - 1] = '01'
		print(''.join(x))
	t = t - 1


for _ in range(int(input())):
	s = input()
	if len(s) <= 2:
		print(s)
	elif '1' not in s or '0' not in s:
		print(s)
	else:
		print('10' * len(s))


from sys import stdin, exit, setrecursionlimit
from collections import deque
from heapq import *
from math import gcd
from math import ceil, log2
setrecursionlimit(10000000)
from collections import deque
input = stdin.readline
lmi = lambda : list(map(int, input().split()))
mi = lambda : map(int, input().split())
si = lambda : input().strip('\n')
ssi = lambda : input().strip('\n').split()
for _ in range(int(input())):
	t = si()
	if t.count('1') == len(t) or t.count('0') == len(t):
		print(t)
	else:
		s = ''
		for i in range(len(t)):
			s += '01'
		print(s)


T = int(input())
for i in range(T):
	t = list(input())
	if '1' not in t or '0' not in t:
		print(''.join((elem for elem in t)))
	else:
		s = []
		for i in range(len(t) - 1):
			s.append(t[i])
			if t[i] == t[i + 1] == '1':
				s.append('0')
			elif t[i] == t[i + 1] == '0':
				s.append('1')
		s.append(t[-1])
		print(''.join((elem for elem in s)))


t = int(input())
for i in range(t):
	s = str(input())
	an = ''
	run = False
	for i in range(1, len(s)):
		if s[i] != s[i - 1]:
			run = True
			break
	if run == True:
		for i in range(len(s)):
			an += '1'
			an += '0'
		print(an)
	else:
		print(s)


T = int(input())

def digitsEqual(t):
	for i in range(len(t)):
		if t[i] != t[0]:
			return False
	return True

def s(t):
	if t == '1':
		return '10'
	if t == '0':
		return '10'
	if t[:2] == '10':
		return '10' + s(t[2:])
	if t[:2] == '11':
		return '10' + s(t[1:])
	if t[:2] == '00':
		return '10' + s(t[1:])
	if t[:2] == '01':
		return '10' + s(t[1:])
	return ''
for _ in range(T):
	t = input()
	if digitsEqual(t):
		print(t)
	else:
		print(s(t))


def find_ans(s):
	n = len(s)
	bool = True
	for i in range(n - 1):
		if s[i] != s[i + 1]:
			bool = False
			break
	if bool:
		print(s)
		return
	ans = ''
	for i in s:
		if i == '1':
			ans += i + '0'
		else:
			ans += '1' + i
	print(ans)
for _ in range(int(input())):
	s = input()
	find_ans(s)


import sys
from math import log2, floor, ceil, sqrt
sys.setrecursionlimit(7 * 10 ** 4)
Ri = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

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

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 998244353
for _ in range(int(ri())):
	st = ri()
	ch = st[0]
	flag = True
	for i in range(1, len(st)):
		if ch != st[i]:
			flag = False
			break
	if not flag:
		ans = ''
		for i in range(len(st)):
			ans += '01'
		print(ans)
	else:
		print(st)


test_cases = int(input())
for case in range(test_cases):
	t = input()
	if len(t) <= 2:
		print(t)
		continue
	one_count = 0
	zero_count = 0
	for i in t:
		if i == '0':
			zero_count += 1
		else:
			one_count += 1
	if one_count == 0 or zero_count == 0:
		print(t)
		continue
	s = '10' * len(t)
	print(s)


s = []
for iii in range(int(input())):
	t = input()
	if '0' not in t or '1' not in t:
		s.append(t)
	else:
		p = str(t[0])
		for i in range(1, len(t)):
			if p[len(p) - 1] == t[i]:
				if t[i] == '1':
					p += '0'
					p += '1'
				else:
					p += '1'
					p += '0'
			else:
				p += t[i]
		s.append(p)
for i in s:
	print(i)


def all(s):
	n = len(s)
	for i in range(1, n):
		if s[i] != s[0]:
			return False
	return True
for _ in range(int(input())):
	s = input()
	if all(s):
		print(s)
	else:
		a = ''
		for i in range(len(s)):
			a += '01'
		print(a)


t = int(input())
for _ in range(t):
	s = input()
	y = []
	count0 = 0
	for i in s:
		y.append(int(i))
		if y[-1] == 0:
			count0 += 1
	if count0 == 0 or count0 == len(s):
		print(s)
	else:
		x = int(s[0])
		ans = str(x)
		for i in range(1, 2 * len(s) - 1):
			x = 1 - x
			ans = ans + str(x)
		print(ans)


test_cases = int(input())
for test_case in range(test_cases):
	t = input()
	if t == '0' * len(t) or t == '1' * len(t):
		print(t)
	else:
		print('10' * len(t))


from sys import stdin
for _ in range(int(stdin.readline())):
	s = input()
	n = len(s)
	l = []
	for i in s:
		l.append(int(i))
	if min(l) == max(l):
		print(s)
	else:
		for i in range(n):
			print('10', end='')
		print()


t = int(input())
for tt in range(t):
	s = input()
	n = len(s)
	flag = False
	for i in range(n - 1):
		if s[i] != s[i + 1]:
			flag = True
			break
	t = list(s[0])
	if flag:
		for i in range(1, n):
			if s[i] == t[len(t) - 1]:
				if s[i] == '1':
					t.append('0')
					t.append(s[i])
				else:
					t.append('1')
					t.append(s[i])
			else:
				t.append(s[i])
		for i in t:
			print(i, end='')
		print('')
	else:
		print(s)


def main():
	t = int(input())
	tlist = list()
	for i in range(t):
		tlist.append(input())
	for i in range(t):
		s = tlist[i]
		if isSame(s):
			print(s)
		else:
			ns = s[0]
			for i in range(1, len(s)):
				if s[i - 1] == '1':
					if s[i] == '0':
						ns += s[i]
					else:
						ns += '0' + s[i]
				elif s[i] == '1':
					ns += s[i]
				else:
					ns += '1' + s[i]
			print(ns)

def isSame(l):
	if l.count('0') == len(l) or l.count('1') == len(l):
		return True
	return False
main()


import sys
from collections import defaultdict as dd
input = sys.stdin.readline
mod = 1000000007

def power(x, y):
	res = 1
	while y > 0:
		if y & 1 == 1:
			res = res * x % m
		y = y >> 1
		x = x * x % m
	return res % m
for _ in range(int(input())):
	t = input()
	l = [int(t[i]) for i in range(len(t) - 1)]
	m = ''.join([str(i) for i in l])
	c1 = l.count(1)
	n = len(l)
	c0 = n - c1
	if c1 == 0 or c0 == 0:
		print(m)
	else:
		if l[0] == 0:
			s = '0'
			f = 0
		else:
			s = '1'
			f = 1
		h = 2 * n
		for i in range(1, h - 1):
			if f == 0:
				s += '1'
				f ^= 1
			else:
				s += '0'
				f ^= 1
		print(s)


t = int(input())
for i in range(t):
	T = input()
	mix = False
	size = len(T)
	for c in range(1, size):
		if T[c] != T[c - 1]:
			mix = True
			break
	if not mix:
		print(T)
		continue
	res = T[0]
	for c in T[1:]:
		if res[-1] == c:
			if c == '0':
				res = res + '1'
			else:
				res = res + '0'
		res = res + c
	print(res)


for _ in range(int(input())):
	t = input()
	(zero, one) = (0, 0)
	for i in t:
		if i == '0':
			zero += 1
		else:
			one += 1
	if zero == 0 or one == 0:
		print(t)
	else:
		s = t[0]
		change = {'0': '1', '1': '0'}
		for i in range(1, len(t)):
			if t[i] == s[-1]:
				s += change[t[i]]
				s += t[i]
			else:
				s += t[i]
		print(s)


T = int(input())
for i in range(T):
	t = input()
	if '0' in t and '1' in t:
		print('01' * len(t))
	else:
		print(t)


t = int(input())
for test in range(t):
	s = input()
	n = len(s)
	countz = s.count('0')
	counto = s.count('1')
	if countz == 0 or countz == n:
		if countz == 0:
			print('1' * n)
		else:
			print('0' * n)
		continue
	print('10' * n)


numTests = int(input())
for a in range(numTests):
	string = input()
	ones = 0
	zeros = 0
	for i in range(len(string)):
		if string[i] == '1':
			ones += 1
		elif string[i] == '0':
			zeros += 1
	if len(string) <= 2:
		print(string)
	elif ones == 0 or zeros == 0:
		print(string)
	else:
		element = '01'
		if string[0] == '1':
			element = '10'
		element = element * (len(string) - 1)
		if string[-1] != element[-1]:
			element += string[-1]
		print(element)


for _ in range(int(input())):
	t = input()
	o = z = 0
	s = ''
	for i in range(len(t)):
		if t[i] == '1':
			o += 1
		elif t[i] == '0':
			z += 1
	if z == 0 or o == 0 or len(t) <= 2:
		s = t
	else:
		if t[0] == '0':
			x = 2
		else:
			x = 1
		for i in range(2 * len(t)):
			s += str(int(x % 2))
			x += 1
	print(s)


ans = ''
for _ in range(int(input())):
	t = list(input())
	p = 1
	i = 0
	n = len(t)
	while i < n - 1:
		cnt = 1
		while i < n - 1 and t[i] == t[i + 1]:
			cnt += 1
			i += 1
		p = max(p, cnt)
		i += 1
	if p == 1 or p == n:
		for item in t:
			ans += item
		ans += '\n'
	else:
		if t[0] == '0':
			ans += '01' * n
		else:
			ans += '10' * n
		ans += '\n'
print(ans)


import sys
from collections import defaultdict
from copy import copy
R = lambda t=int: t(input())
RL = lambda t=int: [t(x) for x in input().split()]
RLL = lambda n, t=int: [RL(t) for _ in range(n)]

def solve():
	t = R(str)
	if len(set(t)) == 1:
		print(t)
		return
	s = ''
	for c in t:
		if c == '0':
			s += c + '1'
		else:
			s += '0' + c
	print(s)
T = R()
for _ in range(T):
	solve()


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

def sign(x):
	return x >= 0

def solve(t):
	s = ''
	if t == '0' * len(t) or t == '1' * len(t):
		return t
	for i in range(len(t) - 1):
		s += t[i]
		if t[i] == '0' and t[i + 1] == '0':
			s += '1'
		elif t[i] == '1' and t[i + 1] == '1':
			s += '0'
	s += t[-1]
	if t[-1] == t[0]:
		if t[-1] == '1':
			s += '0'
		else:
			s += '1'
	return s
main()


t = int(input())
for i in range(t):
	s1 = input()
	if '0' not in s1 or '1' not in s1:
		print(s1)
	else:
		s2 = ''
		n1 = s1.count('1')
		l = len(s1)
		n2 = l - n1
		if n1 == n2:
			if s1[0] == '1':
				s2 += '10' * l
			else:
				s2 += '01' * l
		elif s1[0] == '1':
			s2 += '10' * l
		else:
			s2 += '01' * l
		print(s2)


from sys import stdin, stdout
from math import *
from heapq import *
from collections import *

def main():
	ntest = int(stdin.readline())
	for testcase in range(ntest):
		t = stdin.readline().strip()
		s = []
		if len(set(t)) == 2:
			s = ['01'] * len(t)
		else:
			s = [t]
		stdout.write('%s\n' % ''.join(s))
	return 0
main()


T = int(input())
for i in range(T):
	t = input()
	if '1' not in t or '0' not in t:
		print(t)
	else:
		print('01' * len(t))


T = int(input())
for i in range(T):
	t = input()
	s = t[0]
	j = 0
	if '0' not in t or '1' not in t:
		print(t)
		continue
	while j < len(t):
		if j == len(t) - 1:
			break
		if t[j] == t[j + 1] and t[j] == '1':
			s += '0' + t[j + 1]
			j += 1
		elif t[j] == t[j + 1] and t[j] == '0':
			s += '1' + t[j + 1]
			j += 1
		else:
			s += t[j + 1]
			j += 1
	print(s)


for i in range(int(input())):
	a = input()
	b = 0
	for j in range(1, len(a)):
		if a[j] != a[j - 1]:
			b = 1
			break
	print('10' * len(a) if b == 1 else a)


for _ in range(int(input())):
	n = input()
	f = 0
	for i in range(0, len(n) - 1):
		if n[i] == n[i + 1]:
			f = 0
			pass
		else:
			f = 1
			break
	if f == 0:
		print(n)
	else:
		k = ''
		for i in range(0, 2 * len(n) - 1):
			if i % 2 == 0:
				k = k + '1'
			else:
				k = k + '0'
		print(k)


T = int(input())
for z in range(T):
	t = input()
	count = 0
	for i in t:
		if i == '0':
			count += 1
	if count == len(t) or count == 0:
		print(t)
	else:
		List = [t[0]]
		i = 1
		for x in range(1, len(t)):
			if t[x] == List[i - 1]:
				if t[x] == '0':
					List.extend(['1', '0'])
				else:
					List.extend(['0', '1'])
				i += 2
			else:
				List.append(t[x])
				i += 1
		print(''.join(List))


t = int(input())
for test in range(t):
	s = input()
	if '1' in s and '0' not in s:
		print(s)
	elif '1' not in s and '0' in s:
		print(s)
	else:
		print('01' * len(s))


def isSubSequence(string1, string2, m, n):
	if m == 0:
		return True
	if n == 0:
		return False
	if string1[m - 1] == string2[n - 1]:
		return isSubSequence(string1, string2, m - 1, n - 1)
	return isSubSequence(string1, string2, m, n - 1)
for _ in range(int(input())):
	s = input()
	x = set(s)
	if len(x) == 1:
		print(s)
	else:
		l = []
		l1 = []
		for i in range(2 * len(s)):
			if i % 2 == 0:
				l.append('1')
			else:
				l.append('0')
		for i in range(2 * len(s)):
			if i % 2 == 0:
				l1.append('0')
			else:
				l1.append('1')
		s1 = ''
		s1 = s1.join(l)
		s2 = ''
		s2 = s2.join(l1)
		n = len(s)
		n1 = len(s1)
		n2 = len(s2)
		x = isSubSequence(s, s1, n, n1)
		if x == 1:
			print(s1)
		else:
			print(s2)


import sys
T = int(sys.stdin.readline())
for _ in range(T):
	s = input()
	if s.count('0') == 0 or s.count('1') == 0:
		print(s)
	else:
		print('10' * len(s))


for _ in range(int(input())):
	s = input()
	n = len(s)
	x = s.count('1')
	y = s.count('0')
	if n == x:
		s = '1' * (2 * n)
		print(s)
	elif n == y:
		s = '0' * (2 * n)
		print(s)
	else:
		s = ''
		for i in range(1, 2 * n + 1):
			if i % 2 == 0:
				s = s + '0'
			else:
				s = s + '1'
		print(s)


import heapq as hp
import collections
import bisect
import math
import re

def unpack(func=int):
	return map(func, input().split())

def l_unpack(func=int):
	return list(map(func, input().split()))

def s_unpack(func=int):
	return sorted(map(func, input().split()))

def ml_unpack(n):
	return [int(input()) for i in range(n)]

def range_n():
	return range(int(input()))

def counter(a):
	d = {}
	for x in a:
		if x in d:
			d[x] += 1
		else:
			d[x] = 1
	return d

def getint():
	return int(input())

def main():
	for _ in range_n():
		s = input()
		zero = s.count('0')
		one = len(s) - zero
		if (one == 0) ^ (zero == 0):
			print(s)
			continue
		print('01' * len(s))
main()


from sys import stdin, stdout
from math import gcd, sqrt, floor, ceil
input = stdin.readline

def list_inp(x):
	return list(map(x, input().split()))

def map_inp(x):
	return map(x, input().split())

def lcm(a, b):
	return a * b / gcd(a, b)
t = int(input())
for _ in range(t):
	n = input().strip('\n')
	s = list(set(n))
	q = ''.join(s)
	if q == n:
		print(n)
	else:
		print(q * len(n))


t = int(input())
for k in range(t):
	str = input()
	if len(str) <= 2:
		print(str)
		continue
	answer = ''
	one = 0
	zero = 0
	for character in str:
		if character == '0':
			zero += 1
		else:
			one += 1
	if one == 0 or zero == 0:
		print(str)
		continue
	unit = None
	if str[0] == '0':
		unit = '01'
	else:
		unit = '10'
	for j in range(len(str)):
		answer += unit
	print(answer)


T = int(input())
for _ in range(T):
	t = input()
	one = True
	for j in range(1, len(t)):
		if t[0] != t[j]:
			one = False
			break
	if one:
		print(t)
	else:
		print('01' * len(t))


t = int(input())
for q in range(0, t):
	s = input()
	n = len(s)
	flag1 = False
	flag2 = False
	for i in range(0, n):
		if s[i] == '0':
			flag1 = True
		else:
			flag2 = True
	if not flag2 or not flag1:
		print(s)
	else:
		print('10' * n)


T = int(input())
while T:
	t = input()
	if t.count('0') == len(t) or t.count('1') == len(t):
		print(t)
	else:
		print('10' * len(t))
	T -= 1


import sys
import heapq
import math
import bisect

def input():
	return sys.stdin.readline().strip()

def iinput():
	return int(input())

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

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

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

def main():
	s = input()
	if s.count('0') % len(s) == 0:
		print(s)
	else:
		print('10' * len(s))
for i in range(iinput()):
	main()


t = int(input())
for _ in range(t):
	u = [int(item) for item in input()]
	if sum(u) == 0 or sum(u) == len(u):
		print(''.join([str(item) for item in u]))
	elif u[0] == 0:
		print('01' * len(u))
	else:
		print('10' * len(u))


t = int(input())
while t > 0:
	a = input()
	if a.count('0') == 0 or a.count('1') == 0:
		print(a)
	else:
		ans = a[0]
		for i in range(1, len(a)):
			if a[i] == a[i - 1] and a[i] == '1':
				ans = ans + '01'
			elif a[i] == a[i - 1] and a[i] == '0':
				ans = ans + '10'
			else:
				ans = ans + a[i]
		print(ans)
	t -= 1


import sys
T = int(sys.stdin.readline())
for _ in range(T):
	s = list(map(int, list(sys.stdin.readline().strip())))
	dict_test = {1: '0', 0: '1'}
	test = [0, 0]
	for word in s:
		test[word] = 1
	if sum(test) == 2:
		check = 1
	else:
		check = 0
	former = -1
	result = []
	for word in s:
		if word == former and check:
			result.append(dict_test[word])
		result.append(str(word))
		former = word
	print(''.join(result))


exec(int(input()) * "t=input();print([t,'01'*len(t)][len(set(t))>1]);")


def main():
	s = input()
	n = len(s)
	sm = 0
	for i in range(n):
		sm += int(s[i])
	if sm == n or sm == 0:
		print(s)
		return
	if s[0] == '1':
		print('10' * n)
	else:
		print('01' * n)
for _ in range(int(input())):
	main()


for t in range(int(input())):
	s = input()
	my_s = []
	if len(set(s)) == 1:
		print(s)
	else:
		prev = s[0]
		my_s.append(prev)
		for i in s[1:]:
			if i == prev:
				my_s.append(str(int(not int(i))))
				my_s.append(i)
				prev = i
			else:
				my_s.append(i)
				prev = i
		print(''.join(my_s))


T = int(input())
for _ in range(T):
	s = list(input())
	ze = 0
	one = 0
	for i in range(len(s)):
		if s[i] == '0':
			ze = 1
		else:
			one = 1
	if ze == 0 or one == 0:
		print(''.join(s))
		continue
	else:
		if s[0] == '0':
			ans = '01' * len(s)
		else:
			ans = '10' * len(s)
		print(ans)


T = int(input())
for loop in range(T):
	t = list(input())
	if '1' not in t or '0' not in t:
		print(''.join(t))
	else:
		s = []
		for i in t:
			s.append('01')
		print(''.join(s))


def solve(t):
	if len(t) <= 2:
		return t
	else:
		c = t[0]
		if t == len(t) * c:
			return t
		else:
			c1 = t[0]
			s = list(c1)
			for i in range(len(t) - 1):
				if t[i + 1] == t[i]:
					s.append('0' if t[i] == '1' else '1')
					s.append(t[i + 1])
				else:
					s.append(t[i + 1])
			return ''.join(s)
T = int(input())
for _n in range(0, T):
	t = input()
	print(solve(t))


T = int(input())
for _ in range(T):
	n = input()
	leng = len(n)
	if leng <= 2 or '1' not in n or '0' not in n:
		print(n)
	else:
		s = ''
		for i in range(leng - 1):
			s += n[i]
			if n[i] == n[i + 1]:
				s += str(1 - int(n[i]))
		s += n[-1]
		print(s)


def get_mixture(s):
	total = 0
	for i in range(len(s)):
		if s[i] == '1':
			total += 1
	return total

def homogenize(s):
	result = s[0]
	for i in range(1, len(s)):
		if result[-1] == s[i]:
			if s[i] == '1':
				result += '0' + s[i]
			else:
				result += '1' + s[i]
		else:
			result += s[i]
	return result

def main():
	N = int(input())
	for i in range(N):
		t = input()
		mixture = get_mixture(t)
		if mixture == 0 or mixture == len(t):
			print(t)
			continue
		print(homogenize(t))
main()


import math
n = int(input())
for i in range(n):
	s = input()
	if len(s) == 2:
		print(s)
	else:
		j = math.ceil(len(s) / 2)
		m1 = s.count('0')
		m2 = s.count('1')
		if m1 == len(s):
			print(s)
		elif m2 == len(s):
			print(s)
		elif s[0] == '0':
			print('01' * len(s))
		else:
			print('10' * len(s))


t = int(input())
for cs in range(t):
	s = input()
	same = True
	for c in s:
		if c != s[0]:
			same = False
	if same:
		print(s)
	else:
		print('01' * len(s))


I = lambda : list(map(int, input().split()))
for _ in range(int(input())):
	t = input()
	if t.count('0') == 0 or t.count('1') == 0:
		print(t)
		continue
	t += 'k'
	for i in range(len(t) - 1):
		if t[i] == t[i + 1] and t[i] == '1':
			print('10', end='')
		elif t[i] == t[i + 1] and t[i] == '0':
			print('01', end='')
		else:
			print(t[i], end='')
	print('')


import sys
sys.setrecursionlimit(10 ** 6)

def f(t):
	cnt = [0, 0]
	for ti in t:
		if ti == '1':
			cnt[1] += 1
		elif ti == '0':
			cnt[0] += 1
	if cnt[1] == 0 or cnt[0] == 0:
		return t
	m = sum(cnt)
	return ''.join(['01' for i in range(m)])
nofkase = int(input())
for kase in range(nofkase):
	t = input()
	print(f(t))


for _ in range(int(input())):
	n = input()
	if len(set(n)) == 1:
		print(n)
		continue
	else:
		print('10' * len(n))


numcases = int(input())

def solve(s):
	ans = ''
	for i in range(len(s) - 1):
		if s[i] != s[i + 1]:
			break
	else:
		print(s)
		return
	for i in range(len(s)):
		ans = ans + '10'
	print(ans)
	return
for i in range(numcases):
	s = input()
	solve(s)


for _ in range(int(input())):
	word = list(map(str, input()))
	(cnt0, cnt1) = (0, 0)
	for i in word:
		if i == '1':
			cnt1 += 1
		else:
			cnt0 += 1
	if cnt1 == 0 or cnt0 == 0:
		print(''.join((str(x) for x in word)))
	else:
		ans = ''
		if word[0] == '0':
			ans += '0'
			ans += '1'
		else:
			ans += '1'
			ans += '0'
		print(ans * len(word))


from sys import stdin, gettrace
if not gettrace():

	def input():
		return next(stdin)[:-1]

def main():

	def solve():
		tt = input()
		t0 = tt[0]
		for t in tt:
			if t != t0:
				break
		else:
			print(tt)
			return
		ss = [t0]
		for t in tt[1:]:
			if t == ss[-1]:
				ss.append('0' if t == '1' else '1')
			ss.append(t)
		print(''.join(ss))
	q = int(input())
	for _ in range(q):
		solve()
main()


t = int(input())
while t > 0:
	s = input()
	if len(s) <= 2:
		print(s)
	else:
		cnt0 = s.count('0')
		cnt1 = s.count('1')
		if cnt0 == 0 or cnt1 == 0:
			print(s)
		else:
			printer = '01' if s[0] == '0' else '10'
			print(printer * len(s))
	t -= 1


t = int(input())
for i in range(t):
	s = input()
	equal = True
	for j in range(1, len(s)):
		if s[j] != s[j - 1]:
			equal = False
			break
	if equal:
		print(s)
	else:
		ans = ''
		for j in range(len(s)):
			ans += '01'
		print(ans)


for _ in range(int(input())):
	t = input()
	n = len(t)
	if t.count('0') == n:
		print('0' * n)
	elif t.count('1') == n:
		print('1' * n)
	else:
		print('10' * n)


q = int(input())

def check(t):
	for i in range(1, len(t)):
		if t[i] != t[i - 1]:
			return False
	return True
for _ in range(q):
	t = input()
	if check(t):
		print(t)
		continue
	print(t[0], end='')
	for i in range(1, len(t)):
		if t[i] == t[i - 1]:
			print('1' if t[i] == '0' else '0', end='')
		print(t[i], end='')
	print()


k = int(input())
while k > 0:
	a = input()
	l = len(a)
	if len(set(a)) == 1:
		print(a)
	else:
		b = [None] * 2 * l
		for j in range(0, 2 * l):
			if j % 2 == 0:
				b[j] = 1
			else:
				b[j] = 0
		c = ''.join([str(elem) for elem in b])
		print(c)
	k = k - 1


def least_period_string(s):
	x = len(s)
	if x == 1 or x == 2:
		return s
	if s == '0' * x or s == '1' * x:
		return s
	L = []
	for i in range(x):
		L.append(s[i])
	i = 0
	a = i
	c = 0
	while i < x - 1:
		if s[i] == '1':
			if s[i + 1] == '1':
				L = L[:a + 1] + ['0'] + L[a + 1:]
				c = c + 1
		elif s[i + 1] == '0':
			L = L[:a + 1] + ['1'] + L[a + 1:]
			c = c + 1
		i = i + 1
		a = i + c
	S = ''
	for i in range(len(L)):
		S = S + L[i]
	return S
t = int(input())
for i in range(t):
	s = input()
	print(least_period_string(s))


for i in range(int(input())):
	check = 0
	s = str(input())
	for j in range(len(s) - 1):
		if s[j] != s[j + 1]:
			check = 1
			break
	if check == 0:
		print(s)
	elif s[0] == '1':
		print('10' * len(s))
	else:
		print('01' * len(s))


from collections import Counter

def solution(st):
	c = Counter(st)
	if len(c) == 1:
		return st
	else:
		return ('01' if st[0] == '0' else '10') * (c['0'] + c['1'])
n_test = int(input())
for _ in range(n_test):
	st = input()
	print(solution(st))


for lo in range(int(input())):
	st = input()
	l = len(st)
	p = st[0]
	ans = p
	c = 0
	for i in range(1, l):
		if st[i] != st[i - 1]:
			c = 1
			break
	if c == 0:
		print(st)
		continue
	for i in range(1, l):
		if st[i] == p:
			if p == '0':
				ans += '1'
			else:
				ans += '0'
			ans += st[i]
		else:
			p = st[i]
			ans += st[i]
	c1 = 0
	c2 = 0
	for i in ans:
		if i == '0':
			c1 += 1
		else:
			c2 += 1
	if c1 != c2:
		if c1 > c2:
			ans += '1'
		else:
			ans += '0'
	print(ans)


ans = '10' * 200
T = int(input())
for t in range(T):
	s = input()
	flag = False
	for c in s:
		if c != s[0]:
			flag = True
			break
	if flag:
		if s[0] == '0':
			print(s[0] + ans[:2 * len(s) - 1])
		else:
			print(ans[:2 * len(s)])
	else:
		print(s)


for _ in range(int(input())):
	a = input()
	arr = list(a)
	z = len(a)
	zz = z * 2
	if len(set(arr)) == 1:
		print(a)
	elif arr[0] == '1':
		print(''.join(['1', '0'] * z))
	else:
		print(''.join(['0', '1'] * z))


t = int(input())
for _ in range(t):
	s = input()
	if len(list(set(s))) == 1:
		print(s)
	else:
		for _ in range(len(s)):
			print('01', end='')
		print()


for _ in range(int(input())):
	s = input()
	l = []
	if '0' in s and '1' in s:
		for i in range(len(s)):
			l.append('01')
		print(''.join(l))
	else:
		print(s)


T = int(input())
for i in range(T):
	t = input()
	s = ''
	flag = False
	for i in range(len(t) - 1):
		if t[i] != t[i + 1]:
			flag = True
	if flag:
		for i in range(len(t) - 1):
			if t[i] == t[i + 1]:
				if t[i] == '0':
					s += t[i] + '1'
				else:
					s += t[i] + '0'
			else:
				s += t[i]
		print(s + t[len(t) - 1])
	else:
		print(t)


def can(s, t):
	if len(s) > 2 * len(t):
		return False
	ct = len(t)
	pos = 0
	for i in range(len(s)):
		if s[i] == t[pos]:
			ct -= 1
			pos += 1
		if ct == 0:
			break
	return ct == 0
for _ in range(int(input())):
	t = input()
	s = ''
	ans = t
	ansp = len(t)
	for p in range(len(t) - 1, 0, -1):
		for i in range(len(t)):
			curr = t[i:i + p + 1]
			cs = ''
			while len(cs) < 2 * len(t):
				cs += curr
			if can(cs, t) and ansp > p:
				ansp = p
				ans = cs
	print(ans)


T = int(input())

def sol():
	t = input().strip()
	if len(t) <= 2:
		return t
	if '0' not in t or '1' not in t:
		return t
	res = ''
	for c in t:
		if c == '0':
			res += c + '1'
		if c == '1':
			res += '0' + c
	return res
for _ in range(T):
	print(sol())


import sys
input = sys.stdin.readline
t = int(input())
for tests in range(t):
	S = input().strip()
	if len(set(S)) == 1:
		print(S)
	else:
		print('01' * len(S))


t = int(input())
for _ in range(t):
	s = input()
	if all((x == '0' for x in s)) or all((x == '1' for x in s)):
		print(s)
	else:
		ans = []
		ans.append(s[0])
		for i in range(1, len(s)):
			if s[i] == s[i - 1]:
				ans.append('1' if s[i] == '0' else '0')
				ans.append(s[i])
			else:
				ans.append(s[i])
		print(''.join(ans))


t = int(input())
for o in range(t):
	a = list(map(int, input()))
	f = 0
	for i in range(1, len(a)):
		if a[i] != a[i - 1]:
			f = 1
			break
	if f == 0:
		print(*a, sep='')
	else:
		ans = []
		j = 0
		m = len(a)
		for i in range(len(a) - 1):
			ans.append(a[j])
			j += 1
			if a[i] == a[i + 1]:
				if a[i] == 1:
					ans.append(0)
				else:
					ans.append(1)
		ans.append(a[m - 1])
		print(*ans, sep='')


t = int(input())
for _ in range(t):
	t = str(input())
	s = ''
	flag = True
	for i in range(1, len(t)):
		if t[i] != t[i - 1]:
			flag = False
			break
	if flag:
		s = t
	elif t[0] == '1':
		s = '10' * len(t)
	else:
		s = '01' * len(t)
	print(s)


for t in range(int(input())):
	s = input().strip()
	same = all((c == s[0] for c in s))
	if same:
		print(s)
	else:
		print('01' * len(s))


for t in range(int(input())):
	s = input()
	print(''.join(set(s)) * len(s))


T = int(input())
for i in range(T):
	s = ''
	t = str(input())
	if len(t) < 3:
		print(t)
		continue

	def ans():
		for i in range(len(t) - 1):
			if t[i] != t[i + 1]:
				return True
		return False
	if ans():
		for i in range(2 * len(t)):
			if i % 2 != 0:
				s += '0'
			else:
				s += '1'
	elif t[0] == '0':
		s += 2 * len(t) * '0'
	else:
		s += 2 * len(t) * '1'
	print(s)


def solve(s):
	if all((c == '0' for c in s)) or all((c == '1' for c in s)):
		return s
	if s[0] == '0':
		return '01' * len(s)
	else:
		return '10' * len(s)

def main():
	T = int(input())
	for t in range(T):
		s = input()
		print(solve(s))
main()


T = int(input())

def solve(t):
	if len(set(t)) == 1:
		return ''.join(t)
	if t[0] == '0':
		return '01' * len(t)
	return '10' * len(t)
for i in range(T):
	t = list(input())
	print(solve(t))


t = int(input())
while t:
	s = input()
	one = 0
	zero = 0
	for i in s:
		if i == '1':
			one += 1
		else:
			zero += 1
	if one and zero:
		for i in s:
			print('01', end='')
		print()
	else:
		print(s)
	t -= 1


def main():
	for _ in range(int(input())):
		t = list(input())
		if min(t) == max(t):
			print(''.join(map(str, t)))
		else:
			i = 0
			s = ''
			while 2 * i < 2 * len(t):
				s += '10'
				i += 1
			print(s)
main()


from bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right
from itertools import permutations
from datetime import datetime
from math import ceil, sqrt, log, gcd

def ii():
	return int(input())

def si():
	return input()

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

def li():
	return list(mi())
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def powmod(a, b):
	a %= mod
	if a == 0:
		return 0
	res = 1
	while b > 0:
		if b & 1:
			res = res * a % mod
		a = a * a % mod
		b >>= 1
	return res

def main():
	for _ in range(ii()):
		s = si()
		s = list(s)
		n = len(s)
		if '1' not in s or '0' not in s:
			print(''.join(s))
			continue
		if s[0] == '1':
			s1 = '10'
		else:
			s1 = '01'
		for i in range(n):
			print(s1, end='')
		print()
main()


import sys, math, random
input = sys.stdin.readline

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

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

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

def invr():
	return map(int, input().split())
t = inp()
for _ in range(t):
	x = insr()
	one = 0
	zero = 0
	for num in x:
		if num == '1':
			one += 1
		else:
			zero += 1
	if one == 0:
		for i in range(zero):
			print('0', end='')
	elif zero == 0:
		for i in range(one):
			print('1', end='')
	else:
		for i in range(len(x)):
			print('01', end='')
	print()


t = int(input())
testcases = []
for x in range(t):
	testcases.append(str(input()))
for x in range(t):
	string = testcases[x]
	if '0' not in string or '1' not in string:
		print(string)
	else:
		ans = ''
		if string[0] == '0':
			while len(ans) < 2 * len(string) - 2:
				ans += '01'
			print(ans)
		else:
			while len(ans) < 2 * len(string) - 2:
				ans += '10'
			print(ans)


t = int(input())
for ii in range(t):
	s = list(str(input()))
	z = 0
	for i in s:
		if i == '0':
			z += 1
	o = len(s) - z
	if z == len(s) or o == len(s):
		print(''.join(s))
	else:
		ans = ''
		for i in range(len(s)):
			ans += '01'
		print(ans)


for _ in range(int(input())):
	t = input()
	if t.count('0') == 0 or t.count('1') == 0:
		print(t)
	else:
		print('01' * len(t))


for _ in range(int(input())):
	t = input()
	lt = len(t)
	t0 = t.count('0')
	if lt <= 2 or t0 == 0 or t0 == lt:
		print(t)
	else:
		ans = '' + t[0]
		for i in range(1, lt):
			if t[i] == ans[-1]:
				if ans[-1] == '0':
					ans += '1'
				else:
					ans += '0'
			ans += t[i]
		print(ans)


import sys
t = int(sys.stdin.readline())
for query in range(t):
	s = sys.stdin.readline().strip()
	t = ''
	one = s.count('1')
	if one == 0 or one == len(s):
		t = s
	else:
		for pos in range(len(s) - 1):
			t += s[pos]
			if s[pos] == s[pos + 1]:
				add = '1'
				if s[pos] == '1':
					add = '0'
				t += add
		t += s[-1]
	print(t)


t = int(input())
while t:
	s = input()
	ans = ''
	check1 = '1' * len(s)
	check2 = '0' * len(s)
	if check1 == s or check2 == s or len(s) < 3:
		print(s)
	else:
		ans = ans + s[0]
		i = 1
		while i < len(s):
			if s[i] != ans[-1]:
				ans = ans + s[i]
				i = i + 1
			else:
				p = str(1 - int(s[i]))
				ans = ans + p
		print(ans)
	t = t - 1


for f in range(int(input())):
	s = input()
	l = len(s)
	z = 0
	o = 0
	for i in range(l):
		if s[i] == '0':
			o += 1
		else:
			z += 1
	if o == l or o == 0:
		print(s)
	else:
		sol = ['0', '1'] * l
		so = ''.join(sol)
		print(so)


for _ in range(int(input())):
	a = input()
	n0 = a.count('0')
	n1 = a.count('1')
	if len(a) == n0 or len(a) == n1:
		print(a)
	else:
		ans = a[0]
		for i in range(1, len(a)):
			if ans[-1] == a[i] == '0':
				ans += '10'
			elif ans[-1] == a[i] == '1':
				ans += '01'
			else:
				ans += a[i]
		print(ans)


from __future__ import division, print_function
import sys
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip
import os, sys, bisect, copy
from collections import defaultdict, Counter, deque
if os.path.exists('in.txt'):
	sys.stdin = open('in.txt', 'r')
if os.path.exists('out.txt'):
	sys.stdout = open('out.txt', 'w')

def input():
	return sys.stdin.readline()

def mapi(arg=0):
	return map(int if arg == 0 else str, input().split())
for _ in range(int(input())):
	a = input().strip()
	n = len(a)
	res = []
	if a.count('1') == n or a.count('0') == n:
		print(a)
		continue
	res.append(a[0])
	for i in range(1, n):
		if a[i] == a[i - 1]:
			if a[i] == '1':
				res.append('01')
			else:
				res.append('10')
			continue
		res.append(a[i])
	print(''.join(res))


t = int(input())
for xy in range(t):
	x = input()
	if x.count('1') == len(x) or x.count('0') == len(x):
		print(x)
	else:
		a = x[0]
		if a == '0':
			print('01' * len(x))
		else:
			print('10' * len(x))


T = int(input())
for i in range(T):
	t = list(map(int, list(input())))
	if 0 in t and 1 in t:
		s = [t[0]]
		le = len(t)
		j = 1
		while j < le:
			if s[-1] == t[j]:
				s.append((t[j] + 1) % 2)
			else:
				s.append(t[j])
				j += 1
		print(''.join(list(map(str, s))))
	else:
		print(''.join(list(map(str, t))))


for i in range(int(input())):
	t = input()
	if '0' in t and '1' in t:
		if t[0] == '0':
			s = '01' * len(t)
		else:
			s = '10' * len(t)
	else:
		s = t
	print(s)


import sys
input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__
ilele = lambda : map(int, input().split())
alele = lambda : list(map(int, input().split()))
for _ in range(int(input())):
	S = input()
	if '1' not in S:
		print(S * 2)
	elif '0' not in S:
		print(S * 2)
	else:
		if S[0] == '1':
			for i in range(2 * len(S)):
				if i % 2 == 0:
					print('1', end='')
				else:
					print('0', end='')
		else:
			for i in range(2 * len(S)):
				if i % 2 == 0:
					print('0', end='')
				else:
					print('1', end='')
		print()


for _ in range(int(input())):
	s = input()
	n = len(s)
	n1 = s.count('1')
	n0 = n - n1
	if n1 == 0 or n0 == 0:
		print(s)
	else:
		t = s[0]
		ini = 0
		for i in range(1, n):
			if s[ini] == s[i]:
				t = t + str(1 - int(s[i])) + s[i]
			else:
				t = t + s[i]
			ini += 1
		if s[0] == s[n - 1]:
			t = t + str(1 - int(s[n - 1]))
		print(t)


from collections import Counter
c = int(input())
t = [0, 1]
for _ in range(c):
	n = input()
	d = Counter(list(n)).most_common()
	x = d[0][0]
	y = d[0][1]
	try:
		m3 = d[1][0]
		m4 = d[1][1]
	except:
		print(n)
		continue
	print('01' * len(n))


T = int(input())
for i in range(T):
	t = input()
	t1 = list(t)
	t2 = [t1[0]]
	if len(set(t1)) == 1:
		print(t)
	else:
		for i in range(len(t1) - 1):
			if t1[i] == t1[i + 1] == '0':
				t2.append('1')
				t2.append(t1[i + 1])
			elif t1[i] == t1[i + 1] == '1':
				t2.append('0')
				t2.append(t1[i + 1])
			else:
				t2.append(t1[i + 1])
		print(''.join(map(str, t2)))


for _ in range(int(input())):
	s = input()
	l = []
	a0 = 0
	a1 = 0
	for i in range(len(s)):
		if s[i] == '0':
			a0 = 1
		else:
			a1 = 1
	if a0 == 0 or a1 == 0 or len(s) <= 2:
		print(s)
	else:
		initial = s[0]
		print(s[0], end='')
		for i in range(1, len(s)):
			if s[i] == initial:
				if initial == '1':
					print(0, end='')
				else:
					print(1, end='')
			print(s[i], end='')
			initial = s[i]
		print()


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

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

def invert(n):
	if n == '0':
		return '1'
	else:
		return '0'
for _ in range(int(input())):
	s = input()
	n = len(s)
	count = 0
	for i in s:
		if i == '0':
			count += 1
	if count == 0 or count == n:
		print(s)
	else:
		ans = s[0]
		pos = 0
		for i in range(1, n):
			if s[i] != ans[pos]:
				ans += s[i]
				pos += 1
			else:
				ans += invert(s[i])
				ans += s[i]
				pos += 2
		print(ans)


t = int(input())
while t:
	a = input().rstrip()
	if '0' in a and '1' in a:
		T = True
	else:
		T = False
	if T:
		ans = ''
		for i in range(2 * len(a)):
			if i % 2 == 0:
				ans += '0'
			else:
				ans += '1'
		print(ans)
	else:
		print(a)
	t -= 1


from math import *
from bisect import bisect_left, bisect_right
from queue import Queue
from sys import stdin, stdout
from collections import Counter
input = lambda : stdin.readline().strip()
fast_print = stdout.write
t = int(input())
for _ in range(t):
	t = input()
	if '1' not in t or '0' not in t:
		fast_print(t + '\n')
	else:
		fast_print('01' * len(t) + '\n')


t = int(input())
while t:
	t = t - 1
	s = input()
	ans = ''
	ii = 0
	oo = 0
	for i in range(len(s)):
		if s[i] == '1':
			ii = ii + 1
		else:
			oo = oo + 1
	if oo == len(s) or ii == len(s):
		print(s + s)
	else:
		if s[0] == '1':
			for i in range(2 * len(s)):
				if i % 2 == 0:
					ans = ans + '1'
				else:
					ans = ans + '0'
		else:
			for i in range(2 * len(s)):
				if i % 2 == 0:
					ans = ans + '0'
				else:
					ans = ans + '1'
		print(ans)


def count3(t):
	counter = 0
	for i in t:
		if i == '1':
			counter += 1
	return counter

def count2(t):
	counter = 0
	for i in t:
		if i == '0':
			counter += 1
	return counter

def main():
	n = int(input())
	for i in range(n):
		s = list(input())
		result = ''
		if count3(s) and count2(s):
			for j in range(len(s) - 1):
				if s[j] == '0':
					if s[j + 1] == '0':
						result += '01'
					else:
						result += '0'
				if s[j] == '1':
					if s[j + 1] == '1':
						result += '10'
					else:
						result += '1'
			print(result + s[-1])
		else:
			print('0' * len(s) if count2(s) else '1' * len(s))
main()


def op(a):
	if a == '0':
		return '1'
	return '0'

def f(t):
	ans = ''
	x = len(t)
	if '01' in t:
		ans = '01' * (x - 1)
	elif '10' in t:
		ans = '10' * (x - 1)
	else:
		ans = t
	print(ans)
t = int(input())
for _ in range(t):
	ti = input()
	f(ti)


import io
import os
from collections import Counter, defaultdict, deque

def solve(S):
	if '1' not in S or '0' not in S:
		return S
	return '01' * len(S)
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
T = int(input())
for t in range(T):
	S = input().decode().rstrip()
	ans = solve(S)
	print(ans)


num = int(input())
for _ in range(num):
	x = input()
	count_x = 0
	count_y = 0
	first = x[0]
	if len(x) == 2:
		print(x)
		continue
	for i in x:
		if i == '0':
			count_x += 1
		elif i == '1':
			count_y += 1
	if not count_x or not count_y:
		ans = x
		print(x)
		continue
	if first == '0':
		ans = '01' * (count_x + count_y)
	elif first == '1':
		ans = '10' * (count_x + count_y)
	print(ans)


T = int(input())
for i in range(T):
	t = [int(_) for _ in input()]
	oz = t[0]
	anstrue = False
	for j in t:
		if j != oz:
			if oz == 1:
				print('10' * len(t))
				anstrue = True
				break
			if oz == 0:
				print('01' * len(t))
				anstrue = True
				break
	if anstrue == False:
		print(str(oz) * len(t))
		anstrue = True


for _ in range(int(input())):
	a = input()
	print(a) if '0' not in a or '1' not in a else print((a[0] + str(abs(1 - int(a[0])))) * len(a))


from math import *
t = int(input())
for _ in range(t):
	l = input()
	c = 0
	s = 0
	k = len(l)
	for i in range(k):
		if l[i] == '0':
			c = 1
		else:
			s = 1
	if c == 1 and s == 0:
		for i in range(k):
			print('0', end='')
		print()
	elif c == 0 and s == 1:
		for i in range(k):
			print('1', end='')
		print()
	elif c == 1 and s == 1:
		for i in range(k):
			print('1', end='')
			print('0', end='')
		print()


t = int(input())
while t > 0:
	t -= 1
	s = input()
	cnt = 0
	n = len(s)
	for i in range(n - 1):
		if s[i] == s[i + 1]:
			cnt += 1
	if cnt == n - 1:
		print(s)
	else:
		print('10' * n)


t = int(input())
for _ in range(t):
	ss = input()
	if len(set(ss)) == 1:
		print(ss)
		continue
	if ss[0] == '0':
		print('01' * len(ss))
	else:
		print('10' * len(ss))


te = int(input())
for _ in range(te):
	t = input()
	l = len(t)
	co = 0
	cz = 0
	for i in t:
		if i == '0':
			cz = cz + 1
		else:
			co = co + 1
	if co == l or cz == l:
		print(t)
	else:
		f = t[0]
		if t[0] == '0':
			s = '1'
		else:
			s = '0'
		for i in range(2 * l):
			if i % 2 == 0:
				print(f, end='')
			else:
				print(s, end='')
		print()


n = int(input())
ans = []

def insert0(n1):
	alter = ''
	for i in range(len(n1) - 1):
		if n1[i] == '1' and n1[i + 1] == '1':
			alter = alter + '10'
		elif n1[i] == '0' and n1[i + 1] == '0':
			alter = alter + '01'
		else:
			alter = alter + n1[i]
	if n1[len(n1) - 1] != alter[len(alter) - 1]:
		alter = alter + n1[len(n1) - 1]
	elif n1[len(n1) - 1] == '0':
		alter = alter + '10'
	else:
		alter = alter + '01'
	return alter
for i in range(n):
	x = input()
	if len(x) <= 2:
		ans.append(x)
	elif x == '0' * len(x) or x == '1' * len(x):
		ans.append(x)
	else:
		ans.append(insert0(x))
for i in range(len(ans)):
	print(ans[i])


from collections import Counter
cases = int(input())
t = [0, 1]
for _ in range(cases):
	n = input()
	d = Counter(list(n)).most_common()
	m1 = d[0][0]
	m2 = d[0][1]
	try:
		m3 = d[1][0]
		m4 = d[1][1]
	except:
		print(n)
		continue
	print('01' * len(n))


n = int(input())
for i in range(n):
	s = '10'
	x = input()
	l1 = list(x)
	l = len(x)
	c = l1.count('0')
	if c == 0:
		print('1' * (l * 2))
	elif c == l:
		print('0' * (2 * l))
	else:
		s = s * l
		print(s)


t = int(input())
for asd in range(t):
	a = input()
	if a.count('0') == 0 or a.count('1') == 0:
		print(a)
	else:
		count = 0
		out = a[0]
		for i in range(2 * len(a) - 1):
			if out[-1] == '0':
				out += '1'
			else:
				out += '0'
		print(out)


from sys import stdin, exit
from collections import Counter
input = stdin.readline

def i():
	return input()

def ii():
	return int(input())

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

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

def print_array(a):
	print(''.join(map(str, a)), end='')
t = ii()
for _ in range(t):
	s = input()
	c = Counter(s)
	if len(c) == 2:
		print(s, end='')
		continue
	else:
		last = s[0]
		ans = [s[0]]
		for i in s[1:]:
			if i == '1':
				if ans[-1] == '0':
					ans.append(i)
				else:
					ans.append('0')
					ans.append(i)
			elif ans[-1] == '0':
				ans.append('1')
				ans.append(i)
			else:
				ans.append(i)
		print_array(ans)


import sys
for _ in range(int(sys.stdin.readline())):
	s = sys.stdin.readline().strip()
	if '1' in s:
		one = s.count('1')
	else:
		one = 0
	if '0' in s:
		zero = s.count('0')
	else:
		zero = 0
	if one * zero == 0:
		print(s)
	else:
		n = len(s)
		ans = '10' * n
		print(ans)


T = int(input())
for i in range(T):
	t = input()
	if '1' not in t:
		print(t)
	elif '0' not in t:
		print(t)
	else:
		ans = '01' * len(t)
		print(ans)


t = int(input())
for _ in range(0, t):
	l = input()
	x = ''
	L = list(l)
	if '1' in L and '0' in L:
		for i in range(0, len(L) - 1):
			if L[i] == '1' and L[i + 1] == '1':
				x = x + '1'
				x = x + '0'
			elif L[i] == '0' and L[i + 1] == '0':
				x = x + '0'
				x = x + '1'
			else:
				x = x + l[i]
		x = x + l[i + 1]
	else:
		x = l
	print(x)


import sys
input = sys.stdin.readline
case = int(input())
for _ in range(case):
	x = input().strip()
	(ones, zeros) = (True, True)
	for char in x:
		if char == '0':
			ones = False
		else:
			zeros = False
	if ones or zeros or len(x) == 2:
		print(x)
		continue
	print('10' * len(x))


exec(int(input()) * 'a=input();print("".join(set(a))*len(a));')


from math import inf
t = int(input())
for q in range(t):
	tt = input()
	s = '01' * len(tt)
	one = False
	zero = False
	for i in tt:
		if i == '0':
			zero = True
		else:
			one = True
	if not one or not zero:
		print(tt)
	else:
		print(s)


for i in range(0, int(input())):
	x = input()
	if '0' in x and '1' in x:
		s = ''
		for i in range(0, len(x) - 1):
			s += x[i]
			if x[i] == x[i + 1]:
				s = s + '0' if x[i] == '1' else s + '1'
		s += x[-1]
		print(s)
	else:
		print(x)


for T in range(int(input())):
	t = [int(s) for s in input()]
	if not any(t) or all(t):
		print(''.join((str(num) for num in t)))
		continue
	s = [t[0]]
	for char in t[1:]:
		if char ^ s[-1] == 1:
			s.append(char)
		else:
			s.append(1 ^ char)
			s.append(char)
	print(''.join((str(num) for num in s)))


t = int(input())
while t > 0:
	tt = input()
	ca = sorted(tt)
	if ca[0] == ca[len(ca) - 1]:
		print(tt)
	else:
		newTt = '' + tt[0]
		pre = tt[0]
		i = 1
		while i < len(tt):
			if pre == tt[i]:
				pre = '0' if pre == '1' else '1'
			else:
				pre = tt[i]
				i += 1
			newTt += pre
		print(newTt)
	t -= 1


T = int(input())
for _t in range(T):
	t = input()
	s = []
	zeros = t.count('0')
	if zeros == 0 or zeros == len(t):
		print(t)
		continue
	for i in range(len(t) - 1):
		s.append(t[i])
		if t[i] == t[i + 1]:
			if t[i] == '1':
				s.append('0')
			else:
				s.append('1')
	s.append(t[-1])
	print(''.join(s))


def solve():
	t = input()
	if all(map(lambda x: x == t[0], t)):
		print(t)
		return
	print('10' * len(t))
t = int(input())
for _ in range(t):
	solve()


t = int(input())
for _ in range(t):
	s = input().strip()
	n = len(s)
	zero = one = 0
	for i in s:
		if i == '0':
			zero += 1
		else:
			one += 1
	if zero == n or one == n:
		print(s)
	else:
		ans = []
		i = 0
		while i < n - 1:
			if s[i] == s[i + 1]:
				if s[i] == s[0]:
					ans.append(s[i])
					ans.append(str(1 - int(s[i])))
				else:
					ans.append(str(1 - int(s[i])))
					ans.append(s[i])
				i += 1
			elif s[i] == s[0]:
				ans.append(s[i])
				ans.append(s[i + 1])
				i += 2
			else:
				ans.append(str(1 - int(s[i])))
				ans.append(s[i])
				i += 1
		if i < n:
			if s[i] == s[0]:
				ans.append(s[i])
				ans.append(str(1 - int(s[i])))
			else:
				ans.append(str(1 - int(s[i])))
				ans.append(s[i])
		print(''.join(ans))


for _ in range(int(input())):
	s = str(input())
	z = 0
	o = 0
	for i in range(len(s)):
		if s[i] == '0':
			z += 1
		else:
			o += 1
	if z == 0:
		for i in range(len(s) + 1):
			print('1', end='')
	elif o == 0:
		for i in range(len(s) + 1):
			print('0', end='')
	elif s[0] == '0':
		for i in range(len(s)):
			print('01', end='')
	else:
		for i in range(len(s)):
			print('10', end='')
	print()


def zubi(a):
	if a == 1:
		return 0
	if a == 0:
		return 1
	return

def prob(t):
	z = []
	for i in range(len(t)):
		if t[i] not in z:
			z.append(t[i])
	if len(z) == 1:
		return t
	L = [int(t[i]) for i in range(len(t))]
	s = [L[0]]
	for i in range(1, len(L)):
		if L[i] == L[i - 1]:
			s.append(zubi(L[i]))
			s.append(L[i])
		else:
			s.append(L[i])
	s = [str(s[i]) for i in range(len(s))]
	m = ''
	for i in range(len(s)):
		m += s[i]
	return m
t = int(input())
for _ in range(t):
	string = input()
	print(prob(string))


for _ in range(int(input())):
	t = input()
	k = len(t)
	s = ''
	p = set(t)
	if len(p) == 1:
		print(t)
	else:
		for i in range(k - 1):
			if t[i] != t[i + 1]:
				s = s + t[i]
			elif t[i] == '1':
				s = s + t[i] + '0'
			else:
				s = s + t[i] + '1'
		if t[k - 1] == t[0]:
			if t[k - 1] == '0':
				print(s + t[k - 1] + '1')
			else:
				print(s + t[k - 1] + '0')
		else:
			print(s + t[k - 1])


class SegmentTree:

	def __init__(self, data, default=0, func=lambda a, b: a + b):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
for _ in range(int(input())):
	s = input()
	n = len(s)
	zero = s.count('0')
	if zero == n or zero == 0:
		print(s)
		continue
	print('10' * n)


t = int(input())
for i in range(t):
	s = input()
	arr = []
	for i in s:
		arr.append(int(i))
	li = [int(s[0])]
	se = set(arr)
	if len(se) == 1 or len(s) == 2:
		print(s)
	else:
		for i in range(1, len(arr)):
			if arr[i] == arr[i - 1]:
				li.append(1 - arr[i])
			li.append(arr[i])
		for i in li:
			print(i, end='')
		print()


t = int(input())
for _ in range(t):
	s = input()
	le = len(set(s))
	if le == 1:
		print(s)
	else:
		ans = '10' * len(s)
		print(ans)


for _ in range(int(input())):
	t = input()
	(coun, coun2) = (0, 0)
	for i in t:
		if i == '0':
			coun += 1
		else:
			coun2 += 1
	if coun == len(t) or coun2 == len(t):
		print(t)
	else:
		print('10' * len(t))


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 foo():
	st = insr()
	x = list(set(st))
	ans = ''.join(map(str, x))
	print(ans * len(st))
t = inp()
for i in range(t):
	foo()


def solve():
	t = input()
	if all((a == t[0] for a in t)):
		print(t)
	elif t[0] == '1':
		print('10' * len(t))
	else:
		print('01' * len(t))
T = int(input())
for t in range(T):
	solve()


for _ in range(int(input())):
	t = input()
	l = list(t)
	if len(l) > 2:
		if '1' not in l:
			ans = t
		elif '0' not in l:
			ans = t
		else:
			ans = '10' * len(t)
	else:
		ans = t
	print(ans)


for _ in range(int(input())):
	s = input()
	if len(set(s)) == 2:
		ans = '10' * len(s)
		assert len(ans) <= 200
		print(ans)
	else:
		print(s)


t = int(input())
for _ in range(t):
	s = input()
	cnt_1 = s.count('1')
	if cnt_1 == len(s) or cnt_1 == 0:
		print(s)
	else:
		for i in range(len(s)):
			if s[0] == '1':
				print('10', end='')
			else:
				print('01', end='')
		print()


from sys import stdin, stdout
import math

def main():
	T = int(input())
	for _ in range(T):
		t = input()
		mnoh = set(t)
		if len(mnoh) == 1:
			print(t)
		else:
			print('01' * len(t))
main()


def all_same(s):
	for i in range(1, len(s)):
		if s[i] != s[i - 1]:
			return False
	return True
t = int(input().strip())
for _ in range(t):
	s = input().strip()
	if all_same(s):
		print(s)
	else:
		new_s = ''
		for i in range(len(s)):
			new_s += '01'
		print(new_s)


T = int(input())
for _ in range(T):
	T = input()
	if len(set(T)) == 1:
		print(T)
		continue
	else:
		print('01' * len(T))


for z in range(int(input())):
	t = input()
	s = list(t)
	n = len(s)
	d = []
	if len(set(s)) == 1:
		print(t)
	else:
		for i in range(n):
			d.append(s[i])
			if s[i] == '1' and i + 1 < n and (s[i + 1] != '0'):
				d.append('0')
			elif s[i] == '0' and i + 1 < n and (s[i + 1] != '1'):
				d.append('1')
		print(''.join(d))


def yo():
	for _ in range(int(input().strip())):
		s = str(input().strip())
		new_string = ''
		ele = s[0]
		fail = False
		for char in s:
			if char != ele:
				fail = True
				break
		if fail:
			for i in range(len(s) - 1):
				if s[i] == s[i + 1]:
					if s[i] == '0':
						new_string += '01'
					else:
						new_string += '10'
				else:
					new_string += s[i]
			new_string += s[-1]
			print(new_string)
		else:
			print(s)
yo()


t = int(input())
for i in range(t):
	t = input()
	li = list(t)
	se = set(li)
	if len(se) == 1:
		print(t)
		continue
	elif li[0] == 0:
		print('01' * len(t))
	else:
		print('10' * len(t))


def solve(s):
	period1 = True
	period2 = True
	ans = []
	for i in range(len(s) - 1):
		if s[i] != s[i + 1]:
			period1 = False
			break
	for i in range(len(s) - 2):
		if s[i] != s[i + 2]:
			period2 = False
			break
	if period1 or period2:
		return s
	s = [c for c in s]
	i = 0
	length = len(s)
	while i < length - 1:
		if s[i] == s[i + 1]:
			s.insert(i + 1, str(1 - int(s[i])))
			length += 1
		i += 1
	return ''.join(s)
for _ in range(int(input())):
	s = input()
	print(solve(s))


for _ in range(int(input())):
	t = input()
	if all((i == '0' for i in t)) or all((i == '1' for i in t)):
		print(t)
	else:
		print(len(t) * '01')


import sys
input = sys.stdin.readline
from collections import defaultdict as dd
t = int(input())
while t:
	s = input()
	n = len(s)
	ss = set(s.strip())
	if len(ss) == 1:
		print(s)
	else:
		res = ''
		res += s[0]
		for i in range(1, n):
			if s[i] == s[i - 1]:
				if s[i] == '1':
					res += '0'
				else:
					res += '1'
				res += s[i]
			else:
				res += s[i]
		print(res)
	t -= 1


def soln(t):
	if len(set(t)) == 1:
		return t
	result = ''
	for (i, c) in enumerate(t):
		if i == 0:
			result += c
		if c == '0':
			if result[-1] == '1':
				result += c
			else:
				result += '1' + c
		elif c == '1':
			if result[-1] == '1':
				result += '0' + c
			else:
				result += c
	if result[0] == '0' and result[-1] != '1':
		result += '1'
	elif result[0] == '1' and result[-1] != '0':
		result += '0'
	return result

def main():
	T = int(input())
	for _ in range(T):
		t = input()
		result = soln(t)
		print(result)
main()


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
testcases = int(input())
for j in range(testcases):
	string1 = input()
	if '1' in string1 and '0' in string1:
		output = [string1[0]]
		for s in range(1, len(string1)):
			if string1[s] == output[-1]:
				if output[-1] == '0':
					output.append('1')
					output.append(string1[s])
				else:
					output.append('0')
					output.append(string1[s])
			else:
				output.append(string1[s])
		print(''.join(output))
	elif string1[0] == '0':
		print(string1 + '0')
	else:
		print(string1 + '1')


import sys
input = lambda : sys.stdin.readline().strip()
t = int(input())
while t:
	t -= 1
	t1 = input()
	ans = t1[0]
	i = 1
	if list(t1).count('0') == len(t1) or list(t1).count('1') == len(t1):
		print(t1)
		continue
	while i < len(t1):
		if ans[-1] == '0':
			if t1[i] == '1':
				ans += '1'
				i += 1
			else:
				ans += '1'
		elif t1[i] == '0':
			ans += '0'
			i += 1
		else:
			ans += '0'
	print(ans)


import sys
from math import *
zz = 1
if zz:
	input = sys.stdin.readline
else:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
t = int(input())
while t > 0:
	t -= 1
	s = list(input().rstrip())
	if s.count('0') == 0:
		print('1' * len(s))
	elif s.count('1') == 0:
		print('0' * len(s))
	else:
		for i in range(2 * len(s)):
			if i % 2:
				print(0, end='')
			else:
				print(1, end='')
		print()


from sys import stdin
a = int(stdin.readline())
for b in range(0, a):
	c = stdin.readline()
	d = len(c) - 1
	e = int(c[0])
	K = 0
	for q in range(1, d):
		if c[q] != c[q - 1]:
			K = 1
			break
	if K == 0:
		for k in range(0, d):
			if k < d - 1:
				print(e, end='')
			else:
				print(e)
				continue
	else:
		for j in range(0, d):
			if j < d - 1:
				print(0, end='')
				print(1, end='')
			else:
				print(0, end='')
				print(1)


for t in range(int(input())):
	inp = input()
	has0 = False
	has1 = False
	for c in inp:
		if c == '0':
			has0 = True
		if c == '1':
			has1 = True
	if not (has0 and has1):
		print(inp)
	else:
		ans = ''
		for _ in inp:
			ans += '01'
		print(ans)


t = int(input())
for i in range(t):
	s = input().rstrip()
	if len(s) == 1:
		print(s + s)
		continue
	if s.count('0') == s.count('1'):
		y = s.count('0')
		g = []
		n = len(s)
		for i in range(n):
			g.append('0')
			g.append('1')
		print(''.join(g))
	elif s.count('0') == len(s) or s.count('1') == len(s):
		print(s)
	else:
		g = len(s)
		y = []
		for i in range(g):
			y.append('1')
			y.append('0')
		print(''.join(y))


(N,) = map(int, input().split())
for _ in range(N):
	s = input().strip()
	if len(s) <= 2:
		print(s)
		continue
	if '0' in s and '1' in s:
		if s[0] == '1':
			r = s[0] + '01' * (len(s) - 1)
		else:
			r = s[0] + '10' * (len(s) - 1)
		print(r)
	else:
		print(s)


n = int(input())
for _ in range(n):
	t = input()
	(out, tmod) = (t[0], t[1:])
	skip = True
	for x in range(len(tmod)):
		if tmod[x] != out:
			skip = False
	for x in range(len(tmod)):
		if out[-1] == tmod[x]:
			out += str((int(out[-1]) + 1) % 2) + tmod[x]
		else:
			out += tmod[x]
	if skip:
		print(t)
	else:
		print(out)


for i in range(int(input())):
	t = input()
	sol = ''
	c = t[0]
	if t.count(c) == len(t):
		print(t)
		continue
	for i in range(len(t)):
		if i != len(t) - 1 and t[i] == t[i + 1]:
			sol += t[i] + str(1 - int(t[i]))
		else:
			sol += t[i]
	print(sol)


t = int(input())
for i in range(t):
	l = input()
	m = [0, 0]
	for i in l:
		if i == '0':
			m[0] += 1
		else:
			m[1] += 1
	if m[0] == 0 or m[1] == 0:
		print(l)
	else:
		a = l[0]
		if a == '0':
			s = '01' * len(l)
		else:
			s = '10' * len(l)
		print(s)


from sys import stdin
input = stdin.readline

def main():
	test = int(input())
	for t in range(test):
		s = input().strip()
		zero = s.count('0')
		one = s.count('1')
		if zero == 0 or one == 0:
			print(s)
		else:
			print('01' * len(s))
main()


t = int(input())

def nots(s):
	if s == '0':
		return '1'
	return '0'
for _ in range(t):
	s = input()
	ss = s[0]
	iso = 1
	for i in range(1, len(s)):
		if s[i] != s[i - 1]:
			iso = 0
	if iso:
		print(s)
		continue
	for i in range(1, len(s)):
		if s[i] == s[i - 1]:
			ss += nots(s[i])
		ss += s[i]
	print(ss)


cases = int(input())
for _ in range(cases):
	s = input().strip()
	count = 0
	for e in s:
		if e == '0':
			count += 1
	if count == 0 or count == len(s):
		print(s)
		continue
	else:
		print('01' * len(s))


def ans(t):
	if t in ['00', '01', '11', '10']:
		return t
	if len(set(t)) == 1:
		return t
	s = ''
	for i in t:
		s += '10'
	return s
for _ in range(int(input())):
	t = input()
	print(ans(t))


def main():
	n_num = int(input())
	for k in range(n_num):
		t = input()
		if t.count('0') == 0 or t.count('1') == 0 or len(t) == 2:
			print(t)
		else:
			ant = t[0]
			s = ant
			for nuv in t[1:]:
				if nuv == ant:
					s = s + str(1 - int(ant))
				s = s + nuv
				ant = nuv
			print(s)
main()


def solution():
	from sys import stdout, stdin
	(_input, _print) = (stdin.readline, stdout.write)
	for _ in range(int(input())):
		t = input()
		if t.count('1') == 0 or t.count('0') == 0:
			print(t * 2)
		else:
			print('10' * len(t))
solution()


LI = lambda : list(map(int, input().split()))
MI = lambda : map(int, input().split())
yes = lambda : print('Yes')
no = lambda : print('No')
I = lambda : list(input())
J = lambda x: ''.join(x)
II = lambda : int(input())
SI = lambda : input()
t = II()
for i in range(t):
	s = list(SI())
	if len(set(s)) == 1:
		print(''.join(s))
	else:
		temp = s[0]
		ans = [temp]
		for i in range(1, len(s)):
			if s[i] == temp:
				temp = '1' if temp == '0' else '0'
				ans.append(temp)
				temp = s[i]
				ans.append(s[i])
			else:
				temp = s[i]
				ans.append(s[i])
		print(''.join(ans))


for _ in range(int(input())):
	a = list(map(int, input()))
	if 0 in a and 1 in a:
		print('10' * len(a))
	else:
		print(''.join(map(str, a)))


for _ in range(int(input())):
	s = list(input())
	n = len(s)
	if min(s) == max(s):
		print(''.join(s))
		continue
	for i in range(n):
		if s[i] == '0':
			if i < n - 1 and s[i + 1] == '1':
				print('0', end='')
				continue
			print('01', end='')
		elif s[i] == '1':
			if i < n - 1 and s[i + 1] == '0':
				print('1', end='')
				continue
			print('10', end='')
	print()


t = int(input())
for i in range(t):
	s = input()
	a = s.count('0')
	l = []
	if len(s) == 1 or len(s) == 2:
		print(s)
	elif a > 0 and len(s) - a > 0:
		for j in range(len(s) - 1):
			if s[j] == '1' and s[j + 1] == '1':
				l.append('1')
				l.append('0')
			elif s[j] == '0' and s[j + 1] == '0':
				l.append('0')
				l.append('1')
			else:
				l.append(s[j])
		l.append(s[-1])
		print(''.join(l))
	else:
		print(s)


for t in range(int(input())):
	str = input()
	if str == str[0] * len(str):
		print(str)
		continue
	lngth = len(str)
	ans = ''
	for x in range(2 * lngth):
		if x % 2 == 0:
			ans += '0'
		else:
			ans += '1'
	print(ans)


t = int(input())
for _ in range(t):
	n = input()
	one = 0
	zero = 0
	ans = ''
	for i in n:
		if i == '1':
			one += 1
		else:
			zero += 1
	if min(one, zero) == 0:
		print(n)
	else:
		if n[0] == '1':
			ans = '10' * len(n)
		else:
			ans = '01' * len(n)
		print(ans)


def main():
	for _ in range(int(input())):
		t = list(input())
		l = [t[0]]
		if t.count('0') > 0 and t.count('1') > 0:
			for i in range(1, len(t)):
				if l[len(l) - 1] == '0' and t[i] == '0':
					l.append('1')
					l.append('0')
				elif l[len(l) - 1] == '1' and t[i] == '1':
					l.append('0')
					l.append('1')
				elif l[len(l) - 1] == '0' and t[i] == '1':
					l.append('1')
				else:
					l.append('0')
			print(''.join(l))
		else:
			print(''.join(t))
main()


from math import *
for _ in range(int(input())):
	s = input()
	if len(s) < 3:
		print(s)
	elif not '1' in s or not '0' in s:
		print(s)
	else:
		print(s[0], end='')
		for i in range(1, len(s)):
			if s[i] == s[i - 1]:
				if s[i] == '0':
					print('1', '0', end='', sep='')
				else:
					print('0', '1', end='', sep='')
			else:
				print(s[i], end='', sep='')
		print()


from collections import defaultdict
con = 10 ** 9 + 7

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

def main():
	T = int(input())
	for i in range(T):
		t = list(input())
		N = len(t)
		num0 = 0
		num1 = 0
		for j in range(N):
			if t[j] == '0':
				num0 += 1
			else:
				num1 += 1
		if N == num0:
			print('0' * N)
		elif N == num1:
			print('1' * N)
		elif t[0] == '0':
			ans = '01' * (N - 1)
			print(ans)
		else:
			ans = '10' * (N - 1)
			print(ans)
main()


def Solve():
	s = input()
	chars = set()
	for c in s:
		chars.add(c)
	if len(chars) == 1:
		print(s)
	else:
		t = ['0', '1'] * len(s)
		print(''.join(t))
t = int(input())
for i in range(t):
	Solve()


for _ in range(int(input())):
	s = input()
	l = len(s)
	if l <= 2:
		print(s)
	elif '0' not in s:
		print(s)
	elif '1' not in s:
		print(s)
	else:
		print('01' * l)


for _ in range(int(input())):
	s = input()
	l = len(s)
	one = -1
	zero = -1
	for i in range(l):
		if s[i] == '0' and zero == -1:
			zero = i
		if s[i] == '1' and one == -1:
			one = i
	if one == -1:
		print('0' * (2 * l))
	elif zero == -1:
		print('1' * (2 * l))
	elif one < zero:
		print('10' * l)
	else:
		print('01' * l)


t = int(input())
for _ in range(t):
	s = input()
	f1 = 0
	f2 = 0
	for i in s:
		if i != '0':
			f1 = 1
			break
	for i in s:
		if i != '1':
			f2 = 1
			break
	if f1 == 0 or f2 == 0:
		print(s)
	else:
		ans = ''
		x = s[0]
		l = len(s)
		if x == '0':
			for i in range(l):
				ans += '01'
		else:
			for i in range(l):
				ans += '10'
		print(ans)


from sys import stdin, stdout
import math
from itertools import permutations, combinations
from collections import defaultdict
from bisect import bisect_left
from bisect import bisect_right

def L():
	return list(map(int, stdin.readline().split()))

def In():
	return map(int, stdin.readline().split())

def I():
	return int(stdin.readline())
P = 1000000007

def main():
	for t in range(I()):
		s = input()
		n = len(s)
		if s == '0' * n or s == '1' * n or s == '01' * (n // 2) or (s == '10' * (n // 2)):
			print(s)
		else:
			st = s[0]
			for i in range(1, n):
				if s[i] == s[i - 1]:
					if s[i] == '0':
						st += '1'
					else:
						st += '0'
				st += s[i]
			print(st)
main()


T = int(input())
for _ in range(T):
	t = input().strip()
	n1 = t.count('1')
	n0 = t.count('0')
	if n1 == 0 or n0 == 0:
		print(t)
	else:
		ans = ''
		if t[0] == '0':
			q = '01'
		else:
			q = '10'
		for v in t:
			if v == '0':
				ans += q
			else:
				ans += q
		print(ans)


from math import *
t = int(input())
m = []
n = []
for i in range(t):
	x = input()
	m.append(x)
for i in range(t):
	k = m[i][0]
	flag = 0
	for j in range(len(m[i])):
		if m[i][j] != k:
			flag = 1
	if flag == 0:
		print(m[i])
		continue
	if m[i][0] == '0':
		for j in range(len(m[i]) - 1):
			print('01', end='')
		print('0')
	if m[i][0] == '1':
		for j in range(len(m[i]) - 1):
			print('10', end='')
		print('1')


t = int(input())
for _ in range(t):
	s = input()
	res = ''
	i = 0
	while i < len(s):
		j = i
		while i < len(s) and s[i] == s[j]:
			i += 1
		if i == len(s) and j == 0:
			res = s
			break
		for _ in range(i - j):
			res += '10'
	print(res)


T = int(input())
for i in range(T):
	t = input()
	zero = '0' * len(t)
	un = '1' * len(t)
	string = ''
	avant = ''
	if t != zero and t != un:
		for i in range(len(t)):
			if t[i] == avant:
				string += str(1 - int(t[i]))
			string += t[i]
			avant = t[i]
	else:
		string = t
	print(string)


for t in range(int(input())):
	s = input()
	if '0' not in s or '1' not in s:
		print(s)
	elif s[0] == '1':
		print('10' * len(s))
	elif s[0] == '0':
		print('01' * len(s))


import sys
t = int(sys.stdin.readline().rstrip())

def main():
	for _ in range(t):
		s = sys.stdin.readline().rstrip()
		if len(set(s)) == 1:
			print(s)
			continue
		c = '01' if s[0] == '0' else '10'
		print(c * len(s))
main()


t = int(input())
while t:
	t = t - 1
	s = input()
	cnt1 = s.count('1')
	if cnt1 == len(s) or cnt1 == 0:
		print(s)
	else:
		out = s[0]
		lst = s[0]
		for i in range(1, len(s)):
			if lst != s[i]:
				out += s[i]
				lst = s[i]
			elif s[i] == '1':
				out += '01'
				lst = '1'
			else:
				out += '10'
				lst = '0'
		print(out)


t = int(input())
for _ in range(t):
	s = list(input())
	arr = []
	if s.count('1') == 0:
		print(''.join(s))
	elif s.count('0') == 0:
		print(''.join(s))
	else:
		print('10' * len(s))


import sys

def main():
	t = int(sys.stdin.readline())
	strings = []
	for i in range(t):
		strings.append(list(sys.stdin.readline().strip()))
	sols = []
	for i in range(t):
		ones = set()
		zeroes = set()
		if strings[i].count(strings[i][0]) == len(strings[i]):
			sols.append(''.join(strings[i]))
		else:
			for j in range(1, len(strings[i])):
				if strings[i][j] == '0' and strings[i][j - 1] == '0':
					ones.add(j)
				elif strings[i][j] == '1' and strings[i][j - 1] == '1':
					zeroes.add(j)
			fixed = ''
			for j in range(0, len(strings[i])):
				if j in ones:
					fixed += '10'
				elif j in zeroes:
					fixed += '01'
				else:
					fixed += strings[i][j]
			sols.append(fixed)
	for i in sols:
		sys.stdout.write(i + '\n')
main()


t = int(input())
for _ in range(t):
	s = input()
	if '0' in s and '1' in s:
		s = '10' * len(s)
	print(s)


def main():
	string = input()
	marker = 1
	for i in range(len(string)):
		if string[0] != string[i]:
			marker = 0
	if marker:
		print(string)
	else:
		print('10' * len(string))
test = int(input())
for idx in range(test):
	main()


import sys

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def input():
	return sys.stdin.readline().strip()
for _ in range(int(input())):
	s = input()
	st = ''
	a = s.count('1')
	b = s.count('0')
	if a == len(s) or b == len(s):
		print(s)
	else:
		ans = ''
		if s[0] == '1':
			st = '1'
			stt = '0'
		else:
			st = '0'
			stt = '1'
		for i in range(0, len(s)):
			if i % 2 == 0:
				ans = ans + st
				ans = ans + stt
			else:
				ans = ans + st
				ans = ans + stt
		print(ans)


t = int(input())
for _ in range(t):
	s = input()
	if '1' in s and '0' in s:
		print(s[0], end='')
		for i in range(1, len(s)):
			if s[i] == s[i - 1]:
				print(str((int(s[i]) + 1) % 2), end='')
			print(s[i], end='')
		print()
	else:
		print(s)


t = int(input())
for i in range(t):
	s = input()
	c0 = s.count('0')
	c1 = s.count('1')
	if len(s) == 1:
		print(s)
	elif c0 == len(s) or c1 == len(s):
		print(s)
	else:
		s1 = ''
		i = 0
		while i < len(s) - 1:
			if s[i] == '1' and s[i + 1] == '1':
				s1 += s[i] + '0'
				i += 1
			elif s[i] == '0' and s[i + 1] == '1':
				s1 += s[i]
				i += 1
			elif s[i] == '1' and s[i + 1] == '0':
				s1 += s[i]
				i += 1
			else:
				s1 += s[i] + '1'
				i += 1
		s1 += s[len(s) - 1]
		print(s1)


from sys import stdin, stdout
T = int(stdin.readline())
for _ in range(T):
	t = input()
	t1 = list(t)
	n = len(t)
	if n <= 2:
		print(t)
	else:
		x = t[0]
		flag = 0
		for i in range(1, n):
			if t[i] != x:
				flag = 1
				break
			x = t[i]
		if flag == 1:
			s = '10' * n
			print(s)
		else:
			print(t)


import sys, math, itertools, collections, copy
input = sys.stdin.readline

def solve():
	s = input()
	s = s[:-1]
	(zero, one) = (False, False)
	for i in range(len(s)):
		if s[i] == '0':
			zero = True
		else:
			one = True
	if zero and one:
		print('10' * len(s))
	elif zero:
		print('0' * len(s))
	else:
		print('1' * len(s))
for _ in range(int(input())):
	solve()


for ii in range(int(input())):
	t = input()
	a = [i for i in t]
	if len(set(a)) == 1:
		print(t)
	else:
		ans = [t[0]]
		for i in range(1, len(t)):
			if ans[-1] == a[i]:
				if a[i] == '0':
					ans = ans + ['1', '0']
				else:
					ans = ans + ['0', '1']
			else:
				ans = ans + [a[i]]
		print(''.join(ans))


for _ in range(int(input())):
	t = input()
	if t.count('0') == 0:
		print(t)
	elif t.count('1') == 0:
		print(t)
	else:
		ans = ''
		for i in t:
			if i == '1':
				ans += '10'
			else:
				ans += '10'
		print(ans)


cases = int(input())
for t in range(cases):
	s = input()
	if len(set(s)) == 1:
		print(s)
	else:
		print('10' * len(s))


t = int(input())
for _ in range(t):
	st = input()
	f = 0
	o = z = 0
	for i in range(len(st)):
		if st[i] == '1':
			o += 1
			if i == 0:
				f = 1
		else:
			z += 1
	if z == 0 or o == 0:
		print(st)
	else:
		a = o + z
		l = 2 * a
		s = ''
		for i in range(l):
			if f == 0:
				if i % 2 == 1:
					s += '1'
				else:
					s += '0'
			elif f == 1:
				if i % 2 == 0:
					s += '1'
				else:
					s += '0'
		print(s)


t = int(input())
for _ in range(t):
	s = input()
	n = len(s)
	if '0' in s and '1' in s:
		ans = '10' * n
		print(ans)
	else:
		print(s)


for _ in range(int(input())):
	top = input()
	if len(top) <= 2 or '1' not in top or '0' not in top:
		print(top)
	else:
		sub = ''
		for i in range(len(top) - 1):
			sub += top[i]
			if top[i] == top[i + 1]:
				sub += str(1 - int(top[i]))
		sub += top[-1]
		print(sub)


for _ in range(int(input())):
	s = input().strip()
	n = len(s)

	def isok(a, b):
		x = len(a)
		y = len(b)
		i = 0
		j = 0
		while i < x and j < y:
			if a[i] == b[j]:
				i += 1
				j += 1
			else:
				j += 1
		return i == x
	n *= 2
	ans = ['0' * n, '1' * n, '01' * (n // 2), '10' * (n // 2)]
	period = [1, 1, 2, 2]
	mini = 1000
	res = ''
	ind = 0
	for i in ans:
		if isok(s, i):
			if period[ind] < mini:
				mini = period[ind]
				res = i
		ind += 1
	print(res)


t = int(input())
for _ in range(t):
	x = input()
	flag = True
	for i in range(len(x) - 1):
		if x[i] != x[i + 1]:
			flag = False
			break
	if not flag:
		n = len(x)
		ans = '10' * n
		print(ans)
	else:
		print(x)


T = int(input())
for p in range(T):
	t = input()
	ones = 0
	for i in t:
		if i == '1':
			ones += 1
	if ones == len(t) or ones == 0:
		print(t)
	else:
		s = [t[0]]
		for i in range(1, len(t)):
			if t[i] == t[i - 1]:
				if t[i - 1] == '1':
					s.append('0')
					s.append(t[i])
				else:
					s.append('1')
					s.append(t[i])
			else:
				s.append(t[i])
		for i in s:
			print(i, end='')
		print()


tt = int(input())
for i in range(tt):
	t = input()
	s = ''
	if '0' not in t:
		s = t
	elif '1' not in t:
		s = t
	else:
		n = len(t)
		n = 2 * n
		for j in range(1, n):
			if j % 2 == 1:
				s = s + '1'
			else:
				s = s + '0'
	print(s)


from collections import Counter, defaultdict, deque
import heapq as hq
import math
import sys
input = sys.stdin.readline

def solve():
	s = input().strip()
	if '0' in s and '1' in s:
		print('10' * len(s))
	elif '0' in s:
		print('0' * len(s))
	else:
		print('1' * len(s))
tt = int(input())
for test in range(tt):
	solve()


def inp_n():
	return int(input())

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

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

def is_odd(n):
	if n & 1:
		return True
	return False

def is_prime(n):
	i = 2
	while i * i <= n:
		if n % i == 0:
			return False
		i += 1
	return True
from collections import defaultdict
import math
for _ in range(inp_n()):
	l = input()
	n = len(l)
	c = 1
	for i in range(1, n):
		if l[i] == l[i - 1]:
			c += 1
	if c == 1:
		print(l)
	elif c == n:
		print(l)
	else:
		s = ''
		f = 0
		for i in range(2 * n):
			if f == 0:
				f = 1
				s += '0'
			else:
				f = 0
				s += '1'
		print(s)


n = int(input())
for i in range(n):
	s = input()
	ans = [-1] * len(s) * 2
	if len(set(list(s))) == 1:
		print(s)
	else:
		k = 0
		for j in range(len(s) - 1):
			if s[j] == s[j + 1]:
				if s[j] == '0':
					ans[k + 1] = '1'
				else:
					ans[k + 1] = '0'
				ans[k] = s[j]
				k += 2
			else:
				ans[k] = s[j]
				k += 1
		ans[k] = s[-1]
		final = ''
		for j in range(len(ans)):
			if ans[j] != -1:
				final += ans[j]
		print(final)


T = int(input())
for times in range(T):
	s = input()
	if s.find('1') != -1 and s.find('0') != -1:
		print('10' * len(s))
	else:
		print(s)


from sys import stdin
tc = int(stdin.readline())
for _ in range(tc):
	t = stdin.readline().rstrip()
	result = ''
	if t.count(t[0]) == len(t):
		print(t)
	else:
		for _ in range(len(t)):
			result += '01'
		print(result)


def binary_period(string):
	l = len(string)
	if l == 2:
		return string
	elif l == 1:
		return string
	if '1' not in string or '0' not in string:
		return string
	else:
		string_ = string[0]
		for i in range(1, l):
			if string[i - 1] != string[i]:
				string_ += string[i]
			elif string[i] == '0':
				string_ += '1' + string[i]
			elif string[i] == '1':
				string_ += '0' + string[i]
		return string_
t = int(input())
array = []
for i in range(t):
	array.append(input())
for j in array:
	print(binary_period(j))


from sys import stdin, stdout
from collections import defaultdict, deque

def main():
	for _ in range(int(stdin.readline())):
		string = input()
		if len(string) == 2:
			print(string)
		else:
			counter = 0
			for i in range(len(string) - 1):
				if string[i] != string[i + 1]:
					counter = 1
					break
				else:
					continue
			lis = []
			if counter == 1:
				st = '10'
				l = len(string)
				m = l
				print(st * m)
			else:
				print(string)
main()


T = int(input())
for _ in range(T):
	t = list(map(int, input()))
	if len(set(t)) == 1:
		s = t
	else:
		l = len(t)
		s = [t[0] if i % 2 == 0 else 1 - t[0] for i in range(2 * l)]
	print(''.join(map(str, s)))


t = int(input())
for _ in range(t):
	s = input()
	one = 0
	zero = 0
	for i in range(len(s)):
		if s[i] == '0':
			zero += 1
		else:
			one += 1
	if one == 0 or zero == 0:
		print(s)
		continue
	else:
		for i in range(len(s)):
			print('10', end='')
		print()


t = int(input().strip())
for _ in range(t):
	s = input().strip()
	l = [s[0]]
	i = 1
	if all(map(lambda i: s[i] == s[i - 1], range(1, len(s)))):
		print(s)
		continue
	while i < len(s):
		if s[i] == l[-1]:
			l.append('0' if l[-1] == '1' else '1')
		else:
			l.append(s[i])
			i += 1
	print(''.join(l))


def funz(s):
	for k in range(1, min(len(s), 2) + 1):
		if all((s[i] == s[i + k] for i in range(len(s) - k))):
			return True
	return False
for _ in range(int(input())):
	s = input()
	print(s if funz(s) else '10' * len(s))


import sys
t = int(input())
for _ in range(t):
	s = input()
	zeros = s.count('0')
	ones = s.count('1')
	if zeros == 0 or ones == 0:
		print(s)
	else:
		print('01' * len(s))


t = int(input())
for _ in range(t):
	s = input()
	if s.find('1') > -1 and s.find('0') == -1 or (s.find('0') > -1 and s.find('1') == -1):
		print(s)
	else:
		a = []
		k = 0
		for i in range(len(s) - 1):
			if s[i] == s[i + 1]:
				a.append(i + k + 1)
				k += 1
		for i in a:
			l = s[:i]
			r = s[i:]
			if s[i] == '1':
				s = l + '0' + r
			else:
				s = l + '1' + r
		if len(s) % 2 == 0:
			print(s)
		else:
			print(s + s[1])


t = int(input())
for i in range(t):
	k = input()
	n = len(k)
	a = 0
	s = ''
	s = s + k[0]
	for i in range(1, n):
		if k[i] != k[i - 1]:
			a = 1
			break
	if a == 0:
		print(k)
	else:
		for i in range(1, n):
			if k[i] != k[i - 1]:
				s = s + k[i]
			else:
				t = 1 - int(k[i])
				s = s + str(t) + k[i]
		print(s)


t = int(input())
i = 0
while i < t:
	s = input()
	a = s.count('0')
	b = s.count('1')
	if a != 0 and b == 0:
		print(s)
	elif a == 0 and b != 0:
		print(s)
	else:
		res = []
		res.append(s[0])
		for x in range(1, len(s)):
			if res[-1] == s[x]:
				if s[x] == '1':
					res.append('0')
				else:
					res.append('1')
				res.append(s[x])
			else:
				res.append(s[x])
		print(''.join(res))
	i = i + 1


T = int(input())
results = []
for case in range(T):
	t = input()
	t2 = ''
	zeroes = 0
	ones = 0
	for i in range(len(t) - 1):
		d1 = t[i]
		d2 = t[i + 1]
		t2 += d1
		if d1 == d2:
			t2 += int(d1 == '0') * '1' + int(d1 == '1') * '0'
		zeroes += int(d1 == '0')
		ones += int(d1 == '1')
	last = t[len(t) - 1]
	t2 += last
	zeroes += int(last == '0')
	ones += int(last == '1')
	if zeroes == 0 or ones == 0:
		t2 = t
	results.append(t2)
for result in results:
	print(result)


t = int(input())
for i in range(t):
	s = input()
	arr = []
	k = 0
	if len(s) == 1 or len(s) == 2:
		print(s)
	elif s.count('1') == len(s) or s.count('0') == len(s):
		k = 1
		for j in range(len(s) * 2 - 1):
			arr.append(s[0])
		print(*arr, sep='')
	else:
		a = s[0]
		b = '0'
		if a == '0':
			b = '1'
		for j in range(len(s)):
			arr.append(a)
			arr.append(b)
		print(*arr, sep='')


from collections import *
from itertools import *
from functools import *
import sys
import os
import time
timer = False
debug = False

def timeit(method):

	def wrapper(*args, **kwargs):
		mname = method.__name__
		if debug:
			print('{}(args:{}, kwargs:{})'.format(mname, args, kwargs))
		if timer:
			ts = time.time()
		result = method(*args, **kwargs)
		if timer:
			te = time.time()
			print('%r  %2.2f ms' % (mname, (te - ts) * 1000))
		return result
	return wrapper

@timeit
def main():
	t = int(input())
	for _ in range(t):
		a = input()
		deg = 1
		for i in range(len(a) - 1):
			if a[i] != a[i + 1]:
				deg = 2
				break
		if deg == 1:
			print(a)
		else:
			ans = ['01' for i in range(len(a))]
			print(''.join(ans))
main()


import sys
input = sys.stdin.readline
from collections import Counter

def main():
	T = int(input())
	for _ in range(T):
		S = list(map(int, list(input().strip())))
		N = len(S)
		C = Counter(S)
		if C[0] == N or C[0] == 0:
			print(''.join(map(str, S)))
			continue
		ans = [S[0]]
		for s in S[1:]:
			if ans[-1] == s:
				ans.append(s ^ 1)
				ans.append(s)
			else:
				ans.append(s)
		print(''.join(map(str, ans)))
main()


from collections import defaultdict
t = int(input())
for test in range(t):
	s = list(input())
	d = defaultdict(int)
	for elem in s:
		d[elem] += 1
	if len(d) == 1:
		print(''.join(s))
	else:
		ans = len(s) * ['1', '0']
		print(''.join(ans))