Polycarp has come up with a new game to play with you. He calls it "A missing bigram".

A bigram of a word is a sequence of two adjacent letters in it.

For example, word "abbaaba" contains bigrams "ab", "bb", "ba", "aa", "ab" and "ba".

The game goes as follows. First, Polycarp comes up with a word, consisting only of lowercase letters 'a' and 'b'. Then, he writes down all its bigrams on a whiteboard in the same order as they appear in the word. After that, he wipes one of them off the whiteboard.

Finally, Polycarp invites you to guess what the word that he has come up with was.

Your goal is to find any word such that it's possible to write down all its bigrams and remove one of them, so that the resulting sequence of bigrams is the same as the one Polycarp ended up with.

The tests are generated in such a way that the answer exists. If there are multiple answers, you can print any of them.


-----Input-----

The first line contains a single integer $t$ ($1 \le t \le 2000$) — the number of testcases.

The first line of each testcase contains a single integer $n$ ($3 \le n \le 100$) — the length of the word Polycarp has come up with.

The second line of each testcase contains $n-2$ bigrams of that word, separated by a single space. Each bigram consists of two letters, each of them is either 'a' or 'b'.

Additional constraint on the input: there exists at least one string such that it is possible to write down all its bigrams, except one, so that the resulting sequence is the same as the sequence in the input. In other words, the answer exists.


-----Output-----

For each testcase print a word, consisting of $n$ letters, each of them should be either 'a' or 'b'. It should be possible to write down all its bigrams and remove one of them, so that the resulting sequence of bigrams is the same as the one Polycarp ended up with.

The tests are generated in such a way that the answer exists. If there are multiple answers, you can print any of them.


-----Examples-----

Input
4
7
ab bb ba aa ba
7
ab ba aa ab ba
3
aa
5
bb ab bb
Output
abbaaba
abaabaa
baa
bbabb


-----Note-----

The first two testcases from the example are produced from the word "abbaaba". As listed in the statement, it contains bigrams "ab", "bb", "ba", "aa", "ab" and "ba".

In the first testcase, the $5$-th bigram is removed.

In the second testcase, the $2$-nd bigram is removed. However, that sequence could also have been produced from the word "abaabaa". It contains bigrams "ab", "ba", "aa", "ab", "ba" and "aa". The missing bigram is the $6$-th one.

In the third testcase, all of "baa", "aab" and "aaa" are valid answers.

Difficulty: EASY

Solutions:
t = int(input())
for _ in range(t):
	(n, l) = (int(input()), input().split())
	x = l[0]
	for i in range(1, n - 2):
		if l[i][0] == l[i - 1][-1]:
			x = x + l[i][1]
		else:
			x = x + l[i]
	x = x if len(x) == n else x + 'a'
	print(x)


for _ in range(int(input())):
	n = int(input()) - 2
	(b, i) = (input().split(), 1)
	while i < n and b[i][0] == b[i - 1][1]:
		i += 1
	b.append(b[-1][1] + 'a')
	b = b[:i] + [b[i - 1][1] + b[i][0]] + b[i:n] + [b[n - 1][1]]
	print(''.join(b[::2]))


def main():
	n = int(input())
	bigram = input().split()
	for i in range(n - 3):
		if bigram[i][1] == bigram[i + 1][0]:
			continue
		else:
			bigram.insert(i + 1, bigram[i][1] + bigram[i + 1][0])
			print(*[j[0] for j in bigram] + [bigram[-1][1]], sep='')
			return
	print(*[j[0] for j in bigram] + [bigram[-1][1] * 2], sep='')
for _ in range(int(input())):
	main()


import sys
t = int(sys.stdin.readline())
ans = []
for _ in range(t):
	n = int(sys.stdin.readline())
	arr = sys.stdin.readline().split()
	res = arr[0]
	for s in arr[1:]:
		if s[0] == res[-1]:
			res += s[1]
		else:
			res += s
	if len(res) < n:
		res += 'a'
	ans.append(res)
print('\n'.join(ans))


for _ in range(int(input())):
	n = int(input())
	s = input().split()
	r = s[0]
	for i in s[1:]:
		if r[-1] != i[0]:
			r += i
		else:
			r += i[1]
	if len(r) != n:
		r += 'a'
	print(r)


t = int(input())
from collections import Counter
for _ in range(t):
	n = int(input())
	bis = input().split()
	sbis = ''.join(bis)
	if len(bis) == 1:
		print(bis[0] + 'a')
		continue
	s = [bis[0]]
	i = 1
	while 1:
		if len(s) >= n or i >= len(bis):
			break
		if s[-1][-1] == bis[i][0]:
			s.append(bis[i][1])
		else:
			s.append(bis[i])
		i += 1
	print(''.join(s) + sbis[-1] * (n - len(''.join(s))))


t = int(input())
for _ in range(t):
	n = int(input())
	(*b,) = map(str, input().split())
	ans = b[0][0]
	flag = False
	for i in range(1, n - 2):
		if b[i][0] == b[i - 1][1]:
			ans += b[i][0]
		else:
			flag = True
			ans += b[i - 1][1] + b[i][0]
	ans += b[-1][1]
	if flag:
		print(ans)
	else:
		print(ans + b[-1][1])


def listToString(s):
	str1 = ''
	for ele in s:
		str1 += ele
	return str1
t = int(input())
while t > 0:
	m = []
	lst = []
	n = int(input())
	m = list(map(str, input().strip().split()))[:n - 2]
	marker = 0
	lst.append(m[0][0])
	for y in range(0, n - 3):
		if m[y][1] == m[y + 1][0]:
			lst.append(m[y][1])
		elif m[y][1] != m[y + 1][0]:
			lst.append(m[y][1])
			lst.append(m[y + 1][0])
			marker = 1
	lst.append(m[n - 3][1])
	if marker == 0:
		lst.append('a')
	print(listToString(lst))
	t -= 1


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

def si():
	return input()

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

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

def li():
	return list(mi())
t = ii()
for _ in range(t):
	m = ii()
	a = input().split()
	n = len(a)
	if n == 1:
		print(a[0] + 'a')
	else:
		res = a[0]
		for i in range(n - 1):
			if a[i][1] == a[i + 1][0]:
				res += a[i + 1][1]
			else:
				res += a[i + 1]
		if len(res) == m:
			print(res)
		else:
			print(res + 'a')


def solver():

	def flatten(bigrams, elem, pos=None):
		final_string = ''
		if pos is None:
			for i in bigrams:
				final_string = final_string + i[0]
			final_string = final_string + elem
		else:
			for i in range(len(bigrams)):
				final_string = final_string + bigrams[i][0]
				if i == pos:
					final_string = final_string + elem[0]
			final_string = final_string + bigrams[-1][-1]
		return final_string
	n = int(input())
	for i in range(n):
		j = int(input())
		bigram_list = str(input()).split()
		missing_bigram = None
		counter = None
		for k in range(j - 3):
			first_char = bigram_list[k][1]
			second_char = bigram_list[k + 1][0]
			if first_char != second_char:
				missing_bigram = first_char + second_char
				counter = k
		if missing_bigram is None:
			final_elem = bigram_list[-1][-1]
			print(flatten(bigram_list, final_elem + final_elem))
		else:
			print(flatten(bigram_list, missing_bigram, counter))
solver()


for i in range(int(input())):
	n = int(input())
	tec = input().split()
	ans = tec[0]
	last = ans[-1]
	fl = False
	for j in tec[1:]:
		if j[0] == last:
			ans += j[1]
			last = j[1]
		else:
			ans += j
			last = j[1]
			fl = True
	if not fl:
		ans += 'a'
	print(ans)


def solve(A, n):
	N = len(A)
	ans = A[0][0]
	for i in range(1, N):
		if A[i][0] != A[i - 1][1]:
			ans += A[i - 1][1]
			ans += A[i][0]
		else:
			ans += A[i][0]
	ans += A[-1][1]
	ans += 'a' * (n - len(ans))
	print(ans)
N = int(input())
for _ in range(N):
	n = int(input())
	A = [x for x in input().split(' ')]
	solve(A, n)


t = int(input())
for i in range(t):
	n = int(input())
	ss = input()
	s = ss.split(' ')
	ans = []
	t = False
	ans.append(s[0][0])
	for j in range(0, n - 3):
		if s[j][1] != s[j + 1][0]:
			t = True
			ans.append(s[j][1])
			ans.append(s[j + 1][0])
		else:
			ans.append(s[j][1])
	ans.append(s[n - 3][1])
	if t == False:
		ans.append('a')
	for x in ans:
		print(x, end='')
	print()


def answer():
	n = int(input())
	s = list(input().split())
	x = [''] * (n - 1)
	cnt = 0
	if n == 3:
		print(s[0] + 'a')
		return
	for i in range(n - 3):
		if s[i][1] != s[i + 1][0]:
			x[cnt] = s[i]
			cnt += 1
			x[cnt] = s[i][1] + s[i + 1][0]
		else:
			x[cnt] = s[i]
		cnt += 1
	x[cnt] = s[-1]
	if cnt == i + 1:
		x[-1] = s[-1][1] + 'a'
	ans = x[0][0]
	for i in range(n - 1):
		ans += x[i][1]
	print(ans)
for _ in range(int(input())):
	answer()


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')

class SegmentTree:

	def __init__(self, data, default, func):
		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):
		start += self._size
		stop += self._size
		res_left = res_right = self._default
		while start < stop:
			if start & 1:
				res_left = self._func(res_left, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res_right = self._func(self.data[stop], res_right)
			start >>= 1
			stop >>= 1
		return self._func(res_left, res_right)

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from collections import defaultdict, deque
from math import ceil, floor, sqrt, log2, gcd, pi
from heapq import heappush, heappop
from bisect import bisect_left, bisect
from functools import reduce
from copy import deepcopy
from itertools import permutations
import sys
abc = 'abcdefghijklmnopqrstuvwxyz'
ABC = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
dig = '012345678901'
odd = '13579'
mod = 998244353
for _ in range(int(input())):
	n = int(input())
	arr = list(input().split())
	ans = ''
	for i in arr:
		if ans != '' and ans[-1] == i[0]:
			ans += i[1]
		else:
			ans += i
	if len(ans) != n:
		ans += (n - len(ans)) * 'a'
	print(ans)


t = int(input())
for x in range(t):
	n = int(input())
	row = input().split()
	for i in range(1, len(row)):
		if row[i - 1][1] != row[i][0]:
			row.insert(i, row[i - 1][1] + row[i][0])
			break
	if len(row) == n - 2:
		row.append(row[-1][1] + 'a')
	ans = [b[0] for b in row] + [row[-1][1]]
	ans = ''.join(ans)
	assert len(ans) == n
	check = []
	for i in range(n - 1):
		check.append(ans[i:i + 2])
	assert check == row
	print(ans)


import sys
import math
import bisect
from sys import stdin, stdout
from math import gcd, floor, sqrt, log
from collections import defaultdict as dd
from bisect import bisect_left as bl, bisect_right as br
sys.setrecursionlimit(100000000)

def solve():
	n = int(input())
	s = ''.join(map(str, input().split()))
	ans = ''
	for i in range(1, len(s) - 1, 2):
		if s[i] != s[i + 1]:
			ans = ans + s[i] + s[i + 1]
		else:
			ans += s[i]
	res = s[0] + ans + s[-1]
	if len(res) < n:
		return res + 'a'
	else:
		return res

def main():
	t = int(input())
	while t:
		print(solve())
		t -= 1
main()


def fun(li, n):
	st = ''
	if len(li) == 1:
		x = n - len(li[0])
		st = li[0] + li[0][1] * x
		return st
	else:
		for i in range(len(li)):
			if i == 0:
				st = st + li[0]
			elif li[i][0] == pre:
				st = st + li[i][1]
			else:
				st = st + li[i]
			pre = li[i][1]
		if len(st) != n:
			y = n - len(st)
			st = st + st[-1] * y
		return st
t = int(input())
for z in range(t):
	n = int(input())
	li = [x for x in input().split()]
	res = fun(li, n)
	print(res)


def bigram(n, bi):
	a = []
	a.append(bi[0][0])
	if len(bi) == 1:
		a.append(bi[0][1])
		a.append(bi[0][1])
		print(''.join(a))
		return
	for i in range(1, len(bi)):
		if bi[i][0] != bi[i - 1][1]:
			a.append(bi[i - 1][1])
		a.append(bi[i][0])
	a.append(bi[-1][1])
	while len(a) < n:
		a.append(a[-1])
	print(''.join(a))
t = int(input())
for _ in range(t):
	n = int(input())
	bi = input().split()
	bigram(n, bi)


t = int(input())
while t:
	t -= 1
	n = int(input())
	dat = list(map(str, input().split()))
	ans = dat[0]
	for i in range(1, len(dat)):
		if dat[i][0] != dat[i - 1][1]:
			ans += dat[i]
		else:
			ans += dat[i][1]
	if len(ans) != n:
		ans += 'a'
	print(ans)


for _ in range(int(input())):
	n = int(input())
	l = []
	ans = ''
	if n == 3:
		g = input()
		print(g + 'a')
	else:
		l = list(map(str, input().split()))
		ans += l[0][0]
		for x in range(1, n - 2):
			if l[x][0] == l[x - 1][1]:
				ans += l[x][0]
			else:
				ans += l[x - 1][1]
				ans += l[x][0]
		ans += l[-1][1]
		if len(ans) != n:
			ans += 'a'
		print(ans)


class Solution:

	def find(self, j, arr):
		string = arr[0]
		for i in range(1, len(arr), 1):
			if arr[i][0] == string[-1]:
				string += arr[i][1]
			else:
				string += arr[i]
		while len(string) < j:
			string += 'a'
		print(string[:j])
t = int(input())
obj = Solution()
for _ in range(t):
	j = int(input())
	obj.find(j, input().split())


def solution():
	n = int(input())
	a = list(input().split())
	s = a[0]
	for i in range(1, n - 2):
		if a[i][0] != s[-1]:
			s += a[i]
			continue
		s += a[i][1]
	if len(s) != n:
		s += 'a'
	print(s)
t = int(input())
for _ in range(t):
	solution()


import sys, os, io
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline

def word_from_bigrams(bigrams):
	all_bigrams = []
	added = False
	for i in range(len(bigrams) - 1):
		all_bigrams += [bigrams[i]]
		if bigrams[i][1] != bigrams[i + 1][0]:
			all_bigrams += [bigrams[i][1] + bigrams[i + 1][0]]
			added = True
	all_bigrams += [bigrams[-1]]
	if not added:
		all_bigrams += [bigrams[-1][1] + 'a']
	s = ''
	for i in range(len(all_bigrams) - 1):
		s += all_bigrams[i][0]
	s += all_bigrams[-1]
	sys.stdout.write(f'{s}\n')
for _ in range(int(input())):
	n = int(input())
	bigrams = input().decode().split()
	word_from_bigrams(bigrams)


t = int(input())
for i in range(t):
	n = int(input())
	bigrams = list(input().strip().split())
	if n == 3:
		print(bigrams[0] + 'a')
		continue
	newl = []
	for (ind, bg) in enumerate(bigrams[:n - 3]):
		if bg[1] != bigrams[ind + 1][0]:
			newl.append(bg)
			newl.append(bg[1] + bigrams[ind + 1][0])
		else:
			newl.append(bg)
	newl.append(bigrams[-1])
	res = newl[0]
	for bg in newl[1:]:
		res += bg[1]
	if len(res) < n:
		res += res[0]
	print(res)


import sys
import math

def run(function):

	def wrapper(*args, **kwargs):
		testcases = int(input())
		for _ in range(testcases):
			function(*args, **kwargs)
	return wrapper

def map_input(datatype=int):
	return map(datatype, input().split())

def list_input(datatype=int):
	return list(map(datatype, input().split()))

@run
def solve():
	n = int(input())
	arr = list_input(str)
	ans = ' '
	for i in arr:
		if i[0] == ans[-1]:
			ans += i[1]
		else:
			ans += i
	ans = ans[1:]
	if len(ans) < n:
		while len(ans) != n:
			ans += 'a'
	print(ans)
solve()


t = int(input())
for i in range(t):
	n = int(input())
	a = [x for x in input().split()]
	s = a[0][0]
	for j in range(len(a) - 1):
		if a[j][1] == a[j + 1][0]:
			s += a[j][1]
		else:
			s += a[j][1] + a[j + 1][0]
	s += a[-1][1]
	if len(s) == n:
		print(s)
	else:
		print(s + s[-1])


import itertools
from math import floor, log, log2, ceil, sqrt
from itertools import groupby
from decimal import Decimal, getcontext
import sys
from collections import deque
primes = set()
maxN = 1000001

def generatePrimes():
	used = [False] * maxN
	for i in range(2, maxN):
		if not used[i]:
			primes.add(i)
			for j in range(i, maxN, i):
				used[j] = True

def isPrime(n):
	if n < 2:
		return True
	x = 2
	while x * x <= n:
		if n % x == 0:
			return False
		x += 1
	return True
t = int(input())
res = []
for _ in range(t):
	n = int(input())
	arr = list(input().split())
	ans = ''
	exists = False
	for i in range(n - 2):
		if i == 0:
			ans += arr[0]
		else:
			if arr[i][0] != arr[i - 1][1]:
				exists = True
				ans += arr[i][0]
			ans += arr[i][1]
	if not exists:
		ans += 'a'
	res.append(ans)
for i in range(t):
	print(res[i])


def getInts():
	return list(map(int, input().split()))
[T] = getInts()
for case in range(T):
	[n] = getInts()
	bigs = input()
	bigs = list(bigs.split(' '))
	if n == 3:
		print(bigs[0] + 'a')
		continue
	ans = [bigs[0][0]]
	hasFound = False
	for i in range(1, len(bigs)):
		if bigs[i - 1][1] != bigs[i][0]:
			ans.append(bigs[i - 1][1])
			ans.append(bigs[i][0])
			hasFound = True
		else:
			ans.append(bigs[i][0])
	if hasFound:
		ans.append(bigs[-1][-1])
	else:
		ans.append(bigs[-1][-1])
		ans.append('a')
	print(''.join(ans))


for _ in range(int(input())):
	n = int(input())
	s = input().split()
	for i in range(n - 3):
		if s[i][1] != s[i + 1][0]:
			s.insert(i + 1, s[i][1] + s[i + 1][0])
			break
	else:
		s.append(s[-1][1] + 'a')
	print(s[0][0], end='')
	for i in range(n - 1):
		print(s[i][1], end='')
	print()


def sample():
	return
for i in range(int(input())):
	sample()
	num = int(input())
	st = list(map(str, input().split()))
	lst = ''
	for i in range(len(st) - 1):
		if st[i][1] == st[i + 1][0]:
			lst = lst + st[i][0]
		else:
			lst = lst + st[i]
	lst = lst + st[-1]
	if len(lst) < num:
		lst = lst + 'a' * (num - len(lst))
	print(lst)


def solve(bigrams, length):
	prev = bigrams[0]
	for (i, bigram) in enumerate(bigrams[1:]):
		if prev[1] != bigram[0]:
			bigrams.insert(i + 1, f'{prev[1]}{bigram[0]}')
			break
		prev = bigram
	ans = bigrams[0]
	for bigram in bigrams[1:-2]:
		ans += bigram[1]
	ans += bigrams[-1]
	while len(ans) < length:
		ans += 'a'
	print(ans[:length])
C = int(input())
for _ in range(C):
	L = int(input())
	bigrams = input().split(' ')
	solve(bigrams, L)


deekht2 = int(input())
while deekht2 != 0:
	dcrtg = int(input())
	vfty7 = input().split()
	deeklai9 = vfty7[0]
	for i in vfty7[1:]:
		if deeklai9[-1] != i[0]:
			deeklai9 += i
		else:
			deeklai9 += i[1]
	if len(deeklai9) != dcrtg:
		deeklai9 += 'a'
	print(deeklai9)
	deekht2 -= 1


for _ in range(int(input())):
	n = int(input())
	l = input().split()
	ans = l[0]
	f = 0
	for i in range(1, n - 2):
		if l[i][0] == l[i - 1][1]:
			ans += l[i][1]
		else:
			f = 1
			ans += l[i]
	if f == 1:
		print(ans)
	else:
		print(ans + 'a')


t = int(input())
for _ in range(t):
	n = int(input())
	A = list(map(str, input().split()))
	ans = ''
	first = True
	found = False
	ans += A[0][0]
	for (idx, (before, after)) in enumerate(zip(A, A[1:])):
		if before[1] == after[0]:
			ans += before[1]
		else:
			ans += before[1]
			ans += after[0]
			found = True
		if idx == n - 4:
			ans += after[1]
			if found == False:
				ans += after[1]
	if len(A) == 1:
		ans += A[0]
	print(ans)


def main():
	t = int(input())
	while t:
		x = int(input())
		l = input().split()
		res = l[0][0]
		flag = 0
		for i in range(len(l)):
			if i == len(l) - 1:
				res += l[i][-1]
				break
			if l[i][-1] == l[i + 1][0]:
				res += l[i][-1]
			else:
				flag = 1
				res += l[i][-1]
				res += l[i + 1][0]
		if flag == 0 and len(res) != x:
			res += res[-1]
		print(res)
		t -= 1
main()


for s in [*open(0)][2::2]:
	(a, b) = zip(*s.split())
	(r, *a) = a
	for (x, y) in zip(b, a):
		r += (x + y)[x == y:]
	print((r + 2 * b[-1])[:len(b) + 2])


T = int(input())
for t in range(T):
	n = int(input())
	bis = [s for s in input().split()]
	ans = None
	for i in range(n - 3):
		if bis[i][1] == bis[i + 1][0]:
			continue
		ans = (i, bis[i][1] + bis[i + 1][0])
	if ans:
		bis = bis[:ans[0] + 1] + [ans[1]] + bis[ans[0] + 1:]
		word = ''.join([b[0] for b in bis])
		word += bis[len(bis) - 1][1]
		print(word)
	else:
		word = ''.join([b[0] for b in bis])
		word += bis[len(bis) - 1][1] + 'a'
		print(word)


from sys import stdin
test = int(stdin.readline())
for t in range(test):
	n = int(stdin.readline())
	strings = stdin.readline().rstrip().split()
	ans = strings[0]
	for i in range(1, len(strings)):
		if ans[-1] == strings[i][0]:
			ans = ans + strings[i][1:]
		else:
			ans = ans + strings[i]
	if len(ans) == n:
		print(ans)
	else:
		print(ans + 'a')


for i in range(int(input())):
	n = int(input())
	b = list(input().split())
	ans = []
	ans.append(b[0][0])
	for i in range(len(b) - 1):
		if b[i][1] == b[i + 1][0]:
			ans.append(b[i][1])
		else:
			ans.append(b[i][1] + b[i + 1][0])
	ans.append(b[-1][1])
	if len(''.join(ans)) != n:
		ans.append('a')
	print(''.join(ans))


def main(t):
	n = int(input())
	arr = input().split()
	flag = False
	for i in range(n - 3):
		if arr[i][1] != arr[i + 1][0]:
			arr.insert(i + 1, arr[i][1] + arr[i + 1][0])
			flag = True
			break
	if not flag:
		arr.append(arr[-1][0] + 'a')
	ans = [arr[0]]
	for i in range(1, len(arr)):
		ans.append(arr[i][1])
	print(''.join(ans))
T = int(input())
t = 1
while t <= T:
	main(t)
	t += 1


for _ in range(int(input())):
	n = int(input())
	s = input()
	if len(s) == 2:
		s = s + 'a'
	else:
		s = s.replace('b b', 'b')
		s = s.replace('a a', 'a')
		s = s.replace('a b', 'ab')
		s = s.replace('b a', 'ba')
		if len(s) < n:
			s = s + 'a'
	print(s)


tc = int(input())
for case in range(tc):
	n = int(input())
	parejas = [i for i in input().split()]
	my_str = parejas[0]
	for pos in range(1, len(parejas)):
		if parejas[pos][0] != my_str[-1]:
			my_str += parejas[pos]
		else:
			my_str += parejas[pos][1]
	if len(my_str) != n:
		my_str += 'a'
	print(my_str)


def find_word(bigram_arr):
	idx = 1
	prev_elem = bigram_arr[0]
	arr_size = size - 2
	for j in range(1, arr_size):
		if prev_elem[1:] != bigram_arr[j][:1]:
			temp_elem = prev_elem[1:] + bigram_arr[j][:1]
			bigram_arr.insert(idx, temp_elem)
			break
		idx += 1
		prev_elem = bigram_arr[j]
	word = bigram_arr[0][::1]
	for k in range(1, len(bigram_arr)):
		word = word + bigram_arr[k][1:]
	word_size = len(word)
	if word_size != size:
		flag = True
		while flag:
			lst_alpha = word[word_size - 1]
			word = word + lst_alpha
			if len(word) == size:
				flag = False
	print(word)
t = int(input())
for i in range(t):
	size = int(input())
	user_input = input().split()
	find_word(user_input)


for t in range(int(input())):
	n = int(input())
	b = input()
	b = b.replace('b b', 'b')
	b = b.replace('a a', 'a')
	b = b.replace(' ', '')
	while len(b) != n:
		b += 'a'
	print(b)


import sys
import math
from collections import deque, Counter
from sys import stdin
int1 = lambda x: int(x) - 1
stinput = lambda : stdin.readline()[:-1]
ii = lambda : int(stinput())
mi = lambda : map(int, stdin.readline().split())
li = lambda : list(mi())
mi1 = lambda : map(int1, stdin.readline().split())
li1 = lambda : list(mi1())
mis = lambda : map(str, stdin.readline().split())
lis = lambda : list(mis())
from collections import defaultdict
import heapq
mod = 10 ** 9 + 7
Mod = 998244353
INF = 10 ** 18
ans = 0
t = ii()
for _ in range(t):
	n = ii()
	x = lis()
	ans = []
	for i in x[0]:
		ans.append(i)
	for s in x[1:]:
		(i, j) = (s[0], s[1])
		if ans[-1] == i:
			ans.append(j)
		else:
			ans.append(i)
			ans.append(j)
	ans.append('a' * (n - len(ans)))
	print(''.join(ans))


n = int(input())
while n != 0:
	x = int(input())
	lst = input().split()
	st = lst[0][0]
	for it in lst:
		if it[0] != st[-1]:
			st += it
		else:
			st += it[1]
	if len(st) < x:
		st += 'a' * (x - len(st))
	print(st)
	n -= 1


t = int(input())
for i in range(t):
	n = int(input())
	a = input().split()
	u = 0
	st = ''
	for i in range(len(a) - 1):
		if a[i][1] != a[i + 1][0]:
			u = i
			st = a[i][1] + a[i + 1][0]
	b = []
	if st != '':
		for i in range(u + 1):
			b.append(a[i])
		b.append(st)
		for i in range(u + 1, len(a)):
			b.append(a[i])
	if st == '':
		b = a.copy()
		st = a[len(a) - 1][1] * 2
		b.append(st)
	srt = ''
	for i in b:
		srt += i[0]
	srt += b[len(b) - 1][1]
	print(srt)


for _ in range(int(input())):
	n = int(input())
	x = input().split()
	k = ''
	for i in x:
		if not len(k):
			k += i
			continue
		if k[-1] == i[0]:
			k += i[1]
		else:
			k += i
	k = k + 'a' * (n - len(k))
	print(k)


def create_string(bgrm_list):
	size = len(bgrm_list)
	ret_str = ''
	for ele in bgrm_list:
		ret_str += ele[0]
	ret_str += bgrm_list[size - 1][1]
	return ret_str

def mismatch(bgrm_list):
	mis_ind = -1
	size = len(bgrm_list)
	for i in range(1, size):
		if bgrm_list[i][0] != bgrm_list[i - 1][1]:
			mis_ind = i
	return mis_ind
t = int(input())
for i in range(t):
	n = int(input())
	og_bgrm = input()
	bgrm_list = og_bgrm.split()
	mis_ind = mismatch(bgrm_list)
	if mis_ind == -1:
		inserter = ''
		inserter += bgrm_list[n - 3][1]
		inserter += inserter[0]
		bgrm_list.append(inserter)
	else:
		inserter = ''
		inserter += bgrm_list[mis_ind - 1][1]
		inserter += bgrm_list[mis_ind][0]
		bgrm_list.insert(mis_ind, inserter)
	ret_str = create_string(bgrm_list)
	print(ret_str)


import sys
from typing import List

def solve(arr: List, n):
	ans = ''
	ans = arr[0][0] + arr[0][1]
	k = len(arr)
	i = 1
	while i < k:
		ele = arr[i]
		if ele[0] != arr[i - 1][1]:
			ele = arr[i - 1][1] + ele[0]
			arr.insert(i, ele)
		ans += ele[1]
		k = len(arr)
		i += 1
	if len(ans) == n:
		return ans
	else:
		return ans + 'a'
t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	arr = list(sys.stdin.readline().strip().split())
	ans = solve(arr, n)
	print(ans)


q = int(input())
while q != 0:
	n = int(input())
	s = input().split()
	r = s[0]
	for i in s[1:]:
		if r[-1] != i[0]:
			r += i
		else:
			r += i[1]
	if len(r) != n:
		r += 'a'
	print(r)
	q -= 1


sr = lambda : input()
ir = lambda : int(sr())
lr = lambda : list(map(int, sr().split()))
inf = 10 ** 18
mod = 998244353
test = ir()
for t in range(test):
	n = ir()
	a = sr().split()
	if n == 3:
		print(''.join(['a', a[0]]))
	else:
		flg = False
		pre = a[0][1]
		ans = [a[0]]
		for c in a[1:]:
			if pre == c[0]:
				ans.append(c[1])
			else:
				ans.append(c)
				flg = True
			pre = c[1]
		if not flg:
			ans.append('a')
		print(''.join(ans))


t = int(input())
while t > 0:
	n = int(input())
	l = input().split()
	s = l[0]
	for i in range(1, n - 2):
		if l[i - 1][1] == l[i][0]:
			s = s + l[i][1]
		else:
			s = s + l[i]
	if len(s) == n:
		print(s)
	else:
		s = s + 'a'
		print(s)
	t = t - 1


t = int(input())
for i in range(0, t):
	n = int(input())
	b = list(map(str, input().split()))
	s = b[0]
	for j in range(0, n - 3):
		if b[j][1] == b[j + 1][0]:
			s += b[j + 1][1]
		else:
			s += b[j + 1][0] + b[j + 1][1]
	if len(s) != n:
		s += 'a'
	print(s)


t = int(input())
for i in range(t):
	n = int(input())
	lst = list(map(str, input().split()))
	s = lst[0]
	for j in range(1, len(lst)):
		if lst[j][0] == s[len(s) - 1]:
			s += lst[j][1]
		else:
			s += lst[j]
	if len(s) != n:
		dif = n - len(s)
		s += 'a' * dif
	print(s)


def check(l1, l2):
	l3 = [l1[0], l1[1], l1[2], l1[0] + l1[1], l1[0] + l1[2], l1[1] + l1[2], l1[1] + l1[2] + l1[0]]
	return l3 == l2
for _ in range(int(input())):
	n = int(input())
	l = input().split()
	ans = ''
	for i in range(len(l) - 1):
		ans += l[i][0]
		if l[i][1] != l[i + 1][0]:
			ans += l[i][1]
	ans += l[-1][0]
	ans += l[-1][1]
	if len(ans) < n:
		ans += 'a' * (n - len(ans))
	print(ans)


def solve(n, tempstr):
	inmid = -1
	for i in range(len(tempstr) - 1):
		if tempstr[i][1] != tempstr[i + 1][0]:
			inmid = i + 1
			break
	ans = ''
	if inmid != -1:
		for i in range(len(tempstr)):
			if i == 0 or i == inmid:
				ans += tempstr[i]
			else:
				ans += tempstr[i][1]
		if len(ans) < n:
			ans += tempstr[-1][1]
		print(ans)
		return
	else:
		for i in range(len(tempstr)):
			ans += tempstr[i][0]
		ans += tempstr[len(tempstr) - 1][1]
		ans += ans[-1]
		print(ans)
		return
t = int(input())
while t > 0:
	n = int(input())
	tempstr = input().split(' ')
	solve(n, tempstr)
	t -= 1


n = int(input())
for _ in range(n):
	t = int(input())
	a = list(input().split())
	if len(a) != 1:
		for i in range(1, len(a)):
			if a[i][0] != a[i - 1][1]:
				a.insert(i, a[i - 1][0] + a[i][0])
				break
		print(a[0], end='')
		for i in range(1, len(a)):
			print(a[i][1], end='')
		if len(a) + 1 != t:
			print(a[-1][1])
		else:
			print()
	else:
		print('a' + a[0])


from sys import stdin
for _ in range(int(stdin.readline())):
	n = int(stdin.readline())
	arr = list(map(str, stdin.readline().split()))
	ans = ''
	f = 0
	n = len(arr)
	for i in range(n - 1):
		if arr[i][1] != arr[i + 1][0]:
			ans += arr[i][0]
			ans += arr[i][1]
			f = 1
		else:
			ans += arr[i][0]
	ans += arr[-1]
	if f == 0:
		ans += 'a'
	print(ans)


t = int(input())
l = []
while t:
	t = t - 1
	n = int(input())
	s = ''
	s1 = list(input().split())
	for i in s1:
		if s == '':
			s = s + i
		elif s[-1] == i[0]:
			s = s + i[1]
		else:
			s = s + i
	if len(s) != n:
		while len(s) != n:
			s = s + 'a'
	l.append(s)
for i in l:
	print(i)


k = int(input())
for i in range(k):
	n = int(input())
	ans = list()
	l = input().split()
	ans.append(l[0][0])
	for (x, y) in zip(l[:-1], l[1:]):
		if x[1] == y[0]:
			ans.append(x[1])
		else:
			ans.append(x[1])
			ans.append(y[0])
	ans.append(l[-1][1])
	if len(ans) < n:
		ans.append('a')
	print(''.join(ans))


testcase = int(input())
g = 0
while testcase > 0:
	n_length = int(input())
	strr = input().split()
	r = strr[0]
	for i in strr[1:]:
		if r[-1] != i[0]:
			r += i
			g += 1
		else:
			r += i[1]
	if len(r) != n_length:
		r += 'a'
	print(r)
	testcase -= 1


t = int(input())
while t:
	t -= 1
	n = int(input())
	s = input()
	s = s.replace('b b', 'b')
	s = s.replace('a a', 'a')
	s = s.replace(' ', '')
	if n > len(s):
		s += 'a' * (n - len(s))
	print(s)


for _ in range(int(input())):
	n = int(input())
	l = list(map(str, input().split()))
	flag = False
	ans = ''
	j = 0
	for i in range(n - 2):
		if i == 0:
			ans += l[i]
		elif ans[j] == l[i][0]:
			ans += l[i][1]
		else:
			ans += l[i]
			j += 1
			flag = True
		j += 1
	if flag == False:
		ans += 'a'
	print(ans)


import sys, os, io
import math
from collections import defaultdict

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

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

def solve():
	n = ii()
	l = [i for i in input().split()]
	new = []
	new.append(l[0][0])
	for i in range(len(l) - 1):
		if l[i][1] == l[i + 1][0]:
			new.append(l[i][1])
		else:
			new.append(l[i][1])
			new.append(l[i + 1][0])
	new.append(l[-1][-1])
	if len(new) != n:
		new.append(new[-1])
	print(''.join(new))
t = 1
t = ii()
for _ in range(t):
	solve()


try:
	import sys
	import math
	import collections
	M = 10 ** 9 + 7

	def solve():
		n = int(input())
		arr = list(map(str, input().split()))
		string = '' + arr[0]
		for i in range(1, len(arr)):
			if arr[i - 1][1] == arr[i][0]:
				string += arr[i][1]
			else:
				string += arr[i]
		if len(string) == n:
			return string
		else:
			return string + 'a' * (n - len(string))
	test = int(input())
	count1 = 1
	while count1 <= test:
		ans = solve()
		sys.stdout.write(str(ans) + '\n')
		count1 += 1
except EOFError:
	print('')


import sys
input = sys.stdin.readline
T = int(input())
R = []
for _ in range(T):
	N = int(input())
	l = input()[:-1].split()
	s = ''
	is_selected = False
	for c in l:
		if s == '':
			s += c
		elif s[-1] == c[0]:
			s += c[1]
		else:
			is_selected = True
			s += c
	if len(s) < N:
		s += 'a'
	R.append(s)
print('\n'.join(R))


import sys

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

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

def get_strings():
	return list(sys.stdin.readline().strip().split())

def get_num():
	return int(sys.stdin.readline().strip())
t = get_num()
for _ in range(t):
	n = get_num()
	arr = get_strings()
	ans = arr[0]
	found = False
	for i in range(1, len(arr)):
		if ans[-1] != arr[i][0]:
			found = True
			ans += arr[i]
		else:
			ans += arr[i][1]
	if not found:
		ans += 'a'
	print(ans)


n = int(input())
for i in range(n):
	le = int(input())
	l = list(map(str, input().split()))
	st = l[0]
	for i in range(1, len(l)):
		a = l[i]
		b = l[i - 1]
		if a[0] == b[1]:
			st = st + a[1]
		else:
			st = st + a
	if len(st) != le:
		st = st + 'a'
	print(st)


t = int(input())
for _ in range(t):
	n = int(input())
	ans = ''
	stringArr = input().split()
	ans += stringArr[0]
	matchFound = False
	for i in range(1, n - 2):
		if stringArr[i - 1][1] != stringArr[i][0]:
			matchFound = True
			ans += stringArr[i]
		else:
			ans += stringArr[i][1]
	if matchFound == False:
		ans += 'a'
	print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	a = s.split()
	ans = ''
	ans += a[0]
	for i in range(1, len(a)):
		p = a[i]
		if ans[-1] == p[0]:
			ans += p[-1]
		else:
			ans += p
	if len(ans) == n:
		print(ans)
	elif len(ans) == 2:
		print(ans + 'a')
	else:
		print(ans + 'a' * (n - len(ans)))


z = int(input())
for _ in range(z):
	n = int(input())
	s = input()
	s = s.split(' ')
	s = ''.join(s)
	k = ''
	c = 0
	for i in range(1, len(s) - 1, 2):
		if s[i] != s[i + 1]:
			c = 1
			k += s[i] + s[i + 1]
		else:
			k += s[i]
	if c == 1:
		print(s[0] + k + s[len(s) - 1])
	else:
		print(s[0] + k + s[len(s) - 1] + 'a')


import sys
input = lambda : sys.stdin.readline().rstrip('\r\n')

def solve():
	T = int(input())
	for i in range(T):
		word_len = int(input())
		bigrams = list(map(list, input().split()))
		ans = []
		ans.append(bigrams[0][0])
		for i in range(1, word_len - 2):
			if bigrams[i][0] == bigrams[i - 1][1]:
				ans.append(bigrams[i - 1][1])
			else:
				ans.append(bigrams[i - 1][1])
				ans.append(bigrams[i][0])
		ans.append(bigrams[word_len - 3][1])
		if len(ans) < word_len:
			ans.append('a')
		print(''.join(ans))
solve()


def solve(n, arr):
	ans = arr[0][0]
	for i in range(1, len(arr)):
		if arr[i - 1][1] == arr[i][0]:
			ans += arr[i - 1][1]
		else:
			ans += arr[i - 1][1] + arr[i][0]
	if len(ans) == n - 2:
		return ans + arr[-1][1] * 2
	return ans + arr[-1][1]
for i in range(int(input())):
	print(solve(int(input()), input().split()))


def bigram(n, ls):
	ans = ls[0]
	for i in range(1, len(ls), 1):
		if ls[i][0] == ans[-1]:
			ans += ls[i][1]
		else:
			ans += ls[i]
	if len(ans) < n:
		ans += 'a'
	return ans

def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		ls = list(input().split())
		print(bigram(n, ls))
main()


for _ in range(int(input())):
	n_letters = int(input())
	words = input().split()
	new_word = ' '
	for word in words:
		if word[0] == new_word[-1]:
			new_word += word[1]
		else:
			new_word += word
	if len(new_word) - 1 < n_letters:
		new_word += 'a'
	print(new_word[1:])


t = int(input())
for _ in range(t):
	n = int(input())
	l = input().split()
	res = []
	res.append(l[0][0])
	for i in range(n - 3):
		if l[i][1] == l[i + 1][0]:
			res.append(l[i][1])
		else:
			res.append(l[i][1])
			res.append(l[i + 1][0])
	res.append(l[-1][1])
	s = ''.join(res)
	if len(s) == n:
		print(s)
	else:
		s += s[-1]
		print(s)


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	d = list(input().strip().split())
	nd = []
	for i in range(len(d) - 1):
		nd.append(d[i])
		if d[i][1] != d[i + 1][0]:
			nd.append(d[i][1] + d[i + 1][0])
	nd.append(d[-1])
	for i in range(len(nd)):
		if i % 2 == 0:
			print(nd[i], end='')
			n -= 2
	if n > 0:
		print(nd[-1][1] * n)
	elif n < 0:
		print('error')
	else:
		print()


t = int(input())
s = ''

def read_input():
	return input().split()

def calc(s):
	r = s[0]
	for i in s[1:]:
		if r[-1] != i[0]:
			r += i
		else:
			r += i[1]
	return r

def display(r, n):
	if len(r) != n:
		r += 'a'
	print(r)
while t != 0:
	n = int(input())
	s = read_input()
	r = calc(s)
	display(r, n)
	t -= 1


import sys
input = iter(sys.stdin.read().splitlines()).__next__

def solve(N, A):
	res = A[0][0]
	mismatch_found = False
	for i in range(1, N - 2):
		if A[i - 1][1] != A[i][0]:
			mismatch_found = True
			res += A[i - 1][1]
		res += A[i][0]
	res += A[-1][1]
	if not mismatch_found:
		res += 'a'
	return res
TC = int(input())
for tc in range(TC):
	N = int(input())
	A = list(input().split())
	res = solve(N, A)
	print(res)


for _ in range(int(input())):
	n = int(input())
	li = list(input().split())
	if len(li) == 1:
		print('a' + li[0])
		continue
	ans = ''
	for i in range(len(li)):
		if i == 0:
			ans += li[i][0]
		elif li[i][0] != li[i - 1][-1]:
			ans += li[i - 1][-1] + li[i][0]
		else:
			ans += li[i][0]
	if len(ans) != n:
		if len(ans) - n == -1:
			print(ans + li[-1][-1])
		else:
			print(ans + li[-1][-1] + 'a')
	else:
		print(ans)


cases = int(input())
for i in range(cases):
	n = int(input())
	arr = list(input().split())
	count = n
	new = ''
	previous = ''
	for (i, item) in enumerate(arr):
		if i == 0:
			new += item[0]
			previous = item
			count -= 1
			continue
		if item[0] == previous[1]:
			new += item[0]
			count -= 1
		else:
			new += previous[1] + item[0]
			count -= 2
		previous = item
	if i == n - 3:
		new += item[1]
		count -= 1
	if count > 0:
		new += 'a'
	print(new)


import os, sys
from io import BytesIO, IOBase
from types import GeneratorType
from bisect import *
from collections import defaultdict, deque, Counter
import math, string
from heapq import *
from operator import add
from itertools import accumulate
BUFSIZE = 8192
sys.setrecursionlimit(10 ** 5)

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		import os
		self.os = os
		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 = self.os.read(self._fd, max(self.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 = self.os.read(self._fd, max(self.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:
			self.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')
inf = float('inf')
en = lambda x: list(enumerate(x))
ceil_ = lambda a, b: (a + b - 1) // b
ii = lambda : int(input())
r = lambda : map(int, input().split())
rr = lambda : list(r())

def solve():
	n = ii()
	arr = input().split()
	s = ''
	f = 1
	n = len(arr)
	for i in range(n - 1):
		if arr[i][1] != arr[i + 1][0]:
			f = 0
			s += arr[i][0] + arr[i][1]
		else:
			s += arr[i][0]
	s += arr[-1]
	if f:
		s += s[-1]
	print(s)
for _ in ' ' * ii():
	solve()


import sys

def parseInput():
	rawInput = sys.stdin.read().split('\n')
	rawInput = rawInput[1:-1]
	inputs = rawInput[1::2]
	return inputs

def createOriginalString(bigrams):
	extraBigramAdded = False
	originalString = ''
	for bigram in bigrams.split():
		if originalString == '':
			originalString = bigram
		elif bigram[0] == originalString[-1]:
			originalString += bigram[1]
		else:
			originalString += bigram
			extraBigramAdded = True
	if extraBigramAdded == False:
		originalString += 'a'
	return originalString
for bigrams in parseInput():
	print(createOriginalString(bigrams))


x = int(input())

def abhishek(LIST, m):
	txt = LIST[0]
	for i in range(len(LIST) - 1):
		if LIST[i][1] == LIST[i + 1][0]:
			txt += LIST[i + 1][1]
		else:
			txt += LIST[i + 1]
	if len(txt) == m:
		print(txt)
	else:
		print(txt + 'a')

def main():
	for _ in range(x):
		n = int(input())
		LIST = input().split()
		abhishek(LIST, n)
main()


for _ in range(int(input())):
	n = int(input())
	big = input().split(' ')
	k = 0
	for i in range(n - 3):
		if big[i][1] != big[i + 1][0]:
			big.insert(i + 1, big[i][1] + big[i + 1][0])
			k = 1
			break
	if k != 1:
		big.append(big[-1][-1] * 2)
	ans = big[0]
	for i in range(1, len(big)):
		ans += big[i][1]
	print(ans)


import os
import sys
from io import BytesIO, IOBase
alphabets = 'abcdefghijklmnopqrstuvwxyz'
from sys import maxsize
from itertools import permutations
import math
Modulo = 10 ** 9 + 7

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

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

def int_inp():
	return int(input())
from math import gcd
from collections import Counter
from functools import reduce

def solution():
	n = int_inp()
	s = list(map(str, input().split()))
	if len(s) == 1:
		print(s[0] + s[0][1])
		return
	count = 0
	st = s[0][0]
	for i in range(1, len(s)):
		if s[i][0] != s[i - 1][1]:
			count += 1
			st = st + s[i - 1][1] + s[i][0]
		else:
			st += s[i][0]
	st += s[-1][1]
	if count == 0:
		st = st + s[-1][1]
	print(st)

def main():
	testcases = int(input())
	for _ in range(testcases):
		solution()

def main1():
	testcases = 1
	for _ in range(testcases):
		solution()
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')
main()


for _ in range(int(input())):
	n = int(input())
	q = input().split()
	ans = ''
	flag = 0
	for i in range(len(q)):
		if i and q[i][0] != q[i - 1][1]:
			ans += q[i - 1][1]
			ans += q[i][0]
			flag = 1
		else:
			ans += q[i][0]
	ans += q[-1][1]
	if not flag:
		ans += 'a'
	print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = input().split(' ')
	if len(arr) == 1:
		print(arr[0] + 'a')
		continue
	ans = arr[0][0]
	for i in range(1, n - 2):
		if arr[i - 1][1] != arr[i][0]:
			ans += arr[i - 1][1] + arr[i][0]
		else:
			ans += arr[i - 1][1]
	ans += arr[n - 3][1]
	if len(ans) < n:
		ans += 'a' * (n - len(ans))
	print(ans)


n = int(input())
lengths = []
bigrams = []
for a in range(n):
	lengths.append(int(input()))
	bigrams.append(input().split(' '))
word = ''
for (q, i) in enumerate(bigrams):
	word = ''
	counter = 0
	for j in range(len(i)):
		currentletter = i[j][0]
		if j == 0:
			word += currentletter
		else:
			prevletter = i[j - 1][1]
			if currentletter != prevletter:
				counter += 1
				if prevletter == 'a':
					word += 'ab'
				else:
					word += 'ba'
			else:
				word += i[j][0]
		if j == lengths[q] - 3:
			word += i[j][1]
	if counter == 0:
		word += 'a'
	print(word)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(str, input().split()))
	if n == 3:
		print(a[0] + 'a')
	elif n == 4:
		print(a[0] + a[1])
	else:
		s = a[0]
		k = 0
		for j in range(1, len(a) - 1):
			if k == 0:
				if a[j + 1][0] != a[j][1]:
					s += a[j][1] + a[j + 1][0]
					k = 1
				elif s[-1] != a[j][0]:
					s += a[j]
					k = 1
				else:
					s += a[j][1]
			else:
				s += a[j][1]
		if k == 1:
			s += a[-1][1]
		else:
			s += a[-1][1] + 'a'
		print(s)


for ii in range(int(input())):
	n = int(input())
	a = list(input().split())
	ans = a[0][0]
	for jj in range(1, n - 2):
		if a[jj - 1][-1] == a[jj][0]:
			ans += a[jj - 1][1]
		else:
			ans += a[jj - 1][1] + a[jj][0]
	ans += a[-1][-1]
	if len(ans) != n:
		ans += 'a'
	print(ans)


t = int(input())
for _ in range(t):
	l = int(input())
	st = [str(i) for i in input().split()]
	s = st[0]
	for i in range(1, len(st)):
		if s[-1] == st[i][0]:
			s = s + st[i][1]
		else:
			s = s + st[i]
	if len(s) != l:
		for j in range(l - len(s)):
			s = s + 'a'
	print(s)


import sys, os, io
import math
from collections import defaultdict

def ij():
	return int(input())

def li():
	return list(map(int, input().split()))
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def solve():
	n = ij()
	l = [i for i in input().split()]
	newer = []
	newer.append(l[0][0])
	for i in range(len(l) - 1):
		if l[i][1] == l[i + 1][0]:
			newer.append(l[i][1])
		else:
			newer.append(l[i][1])
			newer.append(l[i + 1][0])
	newer.append(l[-1][-1])
	if len(newer) != n:
		newer.append(newer[-1])
	print(''.join(newer))
test = 1
test = ij()
for _ in range(test):
	solve()


T = int(input())
for t in range(T):
	n = int(input())
	bigrams = [i for i in input().split()]
	ans = bigrams[0]
	prv = bigrams[0][0]
	nxt = bigrams[0][1]
	done = 0
	i = 1
	while i < len(bigrams):
		if bigrams[i][0] == nxt:
			prv = bigrams[i][0]
			nxt = bigrams[i][1]
			ans += bigrams[i][1]
		else:
			ans += bigrams[i][0]
			done = 1
			prv = nxt
			nxt = bigrams[i][0]
			i -= 1
		i += 1
	if done == 0:
		ans += 'a'
	print(ans)


testcase = int(input())
g = 0
while testcase > 0:
	length_of_word = int(input())
	bigram = input().split()
	polycarp = bigram[0]
	for i in bigram[1:]:
		if polycarp[-1] != i[0]:
			polycarp += i
		else:
			polycarp += i[1]
	if len(polycarp) != length_of_word:
		polycarp += 'a'
	print(polycarp)
	testcase -= 1
	g += 1


t = int(input())
for i in range(t):
	n = int(input())
	bigrams = input().split()
	word = bigrams[0]
	for j in bigrams[1:]:
		word += j[1] if word[-1] == j[0] else j
	print(word.ljust(n, 'a'))


def bigram(n, bigrams):
	a = ''
	for i in range(n - 2):
		char = bigrams[i]
		if i == 0:
			a += char
		else:
			l = a[-1]
			if char[0] == l:
				a += char[-1]
			else:
				a += char
	if len(a) != n:
		a += 'a'
	return a
t = int(input())
for i in range(t):
	n = int(input())
	bigrams = input().split()
	result = bigram(n, bigrams)
	print(result)


for _ in range(int(input())):
	n = int(input())
	l = input().split()
	if n == 3:
		print(l[0] + l[0][1])
		continue
	f = 0
	for i in range(len(l) - 1):
		if l[i][1] != l[i + 1][0]:
			ind = i
			f = 1
	if f:
		if l[ind][1] == 'b':
			l.insert(ind + 1, 'ba')
		else:
			l.insert(ind + 1, 'ab')
		ans = l[0]
		for i in range(1, len(l)):
			ans += l[i][1]
		print(ans)
	else:
		ans = l[0]
		for i in range(1, len(l)):
			ans += l[i][1]
		ans += l[-1][1]
		print(ans)


for _ in range(int(input())):
	n = int(input())
	arr = [s for s in input().split()]
	res = ''
	for i in arr:
		if not res:
			res += i
		elif i[0] == res[-1]:
			res += i[1]
		else:
			res += i
	if len(res) != n:
		res += 'a'
	print(res)


import sys

def solve(li, x):
	ans = li[0][0]
	flag = 0
	for i in range(len(li) - 1):
		if li[i][1] != li[i + 1][0]:
			flag = 1
			missing = str(li[i][1] + li[i + 1][0])
			ans += missing
		else:
			ans += li[i][1]
	ans += li[-1][1]
	if flag == 0:
		ans += 'a'
		return ans
	return ans
n = int(input())
for _ in range(n):
	x = int(input())
	numbers = [x for x in input().split()]
	print(solve(numbers, x))


n = int(input())
for i in range(n):
	m = int(input())
	arr = input().split()
	arr2 = str(arr.pop(0))
	for j in range(m - 3):
		if arr2[-1] == arr[j][0]:
			arr2 = arr2 + arr[j][-1]
		elif arr2[-1] != arr[j][0]:
			arr2 = arr2 + arr[j]
			j += 1
	if len(arr2) < m:
		arr2 += arr2[-1]
	print(arr2)


t = int(input())
for k in range(t):
	add = False
	n = int(input())
	x = input().split()
	s = x[0]
	for i in range(1, n - 2):
		if s[-1] == x[i][0]:
			s += x[i][1]
		else:
			s += x[i]
			add = True
	if not add:
		s += 'a'
	print(s)


n = int(input())
l = []
p = []
for i in range(n):
	g = input()
	y = input()
	p.append(g)
	l.append(y)
for i in l:
	y = i.split()
	o = []
	p = len(y) - 1
	flag = True
	if len(y) == 1:
		o.append(y[0])
		o.append('a')
		v = ''.join(o)
		print(v)
	else:
		for j in range(p):
			s = y[j]
			u = y[j + 1]
			if j == 0:
				o.append(s[0])
			if s[1] == u[0]:
				o.append(s[1])
			else:
				flag = False
				o.append(s[1])
				o.append(u[0])
			o.append
		h = y[-1][-1]
		o.append(h)
		v = ''.join(o)
		if flag:
			print(v + 'a')
		else:
			print(v)


import heapq
import sys
import math
from collections import deque
from bisect import bisect_left, bisect_right
I = sys.stdin.readline
II = lambda : int(I())
IN = lambda x: map(int, x.split())
FN = lambda x: map(float, x.split())
L = lambda x: list(IN(x))
M = 1000000007
P = print
T = True
F = False
for _ in range(II()):
	n = II()
	l = list(I().split())
	c = l[0][0]
	ans = []
	f = True
	for i in range(len(l)):
		if f and c != l[i][0]:
			ans.append(c)
			f = False
		c = l[i][1]
		ans.append(l[i][0])
	ans.append(l[-1][1])
	if f:
		ans.append(l[-1][1])
	print(*ans, sep='')


for _ in range(int(input())):
	n = int(input())
	a = input().split()
	s = a[0]
	t = True
	for i in range(1, n - 2):
		if a[i][0] != s[i] and t:
			s += a[i]
			t = False
		else:
			s += a[i][1]
	if t:
		s += s[-1]
	print(s)


import sys
input = sys.stdin.readline
ri = lambda : int(input())
rl = lambda : list(map(int, input().split()))
rs = lambda : input().strip('\r\n')

def solve():
	n = ri()
	s = list(map(str, input().split()))
	ans = s[0]
	flag = 0
	for i in range(1, len(s)):
		if s[i][0] == s[i - 1][-1]:
			ans += s[i][-1]
		else:
			flag = 1
			ans += s[i]
	if not flag:
		ans += s[-1][-1]
	return ans
for _ in range(ri()):
	print(solve())


import sys
input = lambda : sys.stdin.readline().rstrip()
for _ in range(int(input())):
	n = int(input())
	a = input().split()
	if len(a) == 1:
		print(a[0] + 'a')
		continue
	ans = ''
	idx = -1
	for i in range(len(a) - 1):
		if a[i][1] == a[i + 1][0]:
			idx = i
		else:
			break
	if idx == len(a) - 2:
		ans = a[0]
		for i in range(1, len(a)):
			ans += a[i][1]
		ans += 'a'
	elif idx == -1:
		ans += a[0] + a[1]
		for i in range(2, len(a)):
			ans += a[i][1]
	else:
		idx += 1
		ans += a[0][0]
		for i in range(1, idx + 1):
			ans += a[i][0]
		ans += a[idx][1]
		ans += a[idx + 1]
		for i in range(idx + 2, len(a)):
			ans += a[i][1]
	print(ans)


t = int(input(''))
while t != 0:
	a = int(input(''))
	li1 = list(input('').split(' '))
	cnt = 0
	p1 = li1[0]
	print(p1[0], end='')
	cnt = cnt + 1
	for k in range(0, len(li1) - 1):
		s = li1[k]
		p = li1[k + 1]
		if s[1] == p[0]:
			print(p[0], end='')
			cnt = cnt + 1
		else:
			print(s[1], end='')
			print(p[0], end='')
			cnt = cnt + 2
	p2 = li1[len(li1) - 1]
	print(p2[1], end='')
	cnt = cnt + 1
	diff = a - cnt
	if diff == 1:
		print('a', end='')
	print('')
	t = t - 1


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	x = input().split()
	result = x[0][0]
	if len(x) == 1:
		print(x[0] + 'a')
		continue
	for i in range(1, len(x)):
		if x[i - 1][-1] == x[i][0]:
			result += x[i][0]
		else:
			result += x[i - 1][-1] + x[i][0]
	result = result + x[-1][-1] + ''.join(['a' for i in range(n - len(result) - 1)])
	print(result)


def solve(n, bigrams):
	ans = [bigrams[0][0]]
	for (i, bi) in enumerate(bigrams[1:], 1):
		if bigrams[i - 1][1] != bi[0]:
			ans.append('a' if bi[0] == 'b' else 'b')
		ans.append(bi[0])
	ans.append(bigrams[-1][1])
	ans = ''.join(ans)
	if len(ans) != n:
		ans += 'a'
	return ans
ans = []
for _ in range(int(input())):
	ans.append(solve(int(input()), list(input().split())))
print(*ans, sep='\n')


tst = int(input())
for i in range(tst):
	n = int(input())
	arr = list(input().split(' '))
	ans = arr[0]
	for i in range(1, len(arr)):
		if arr[i - 1][1] == arr[i][0]:
			ans += arr[i][1]
		else:
			ans += arr[i]
	if len(ans) == n:
		print(ans)
	else:
		print(ans + 'a')


n = int(input())
for i in range(n):
	l = int(input())
	ar = list(map(str, input().split()))
	a = ar[0]
	q = 0
	for g in range(1, len(ar)):
		if ar[g][0] != ar[g - 1][1]:
			for h in range(1, g):
				a += ar[h][1]
			a += ar[g]
			for h in range(g + 1, len(ar)):
				a += ar[h][1]
			q = 1
			print(a)
			break
	if q == 0:
		a = ar[0]
		for i in range(1, len(ar)):
			a += ar[i][1]
		a += ar[-1][1]
		print(a)


import sys
for _ in range(int(input())):
	n = int(input())
	l = list(map(str, input().split()))
	ans = l[0][0]
	for i in range(1, n - 2):
		ans += l[i - 1][1]
		if l[i - 1][1] != l[i][0]:
			ans += l[i][0]
	ans += l[n - 3][1]
	if len(ans) != n:
		ans += l[n - 3][1]
	print(ans)


for _ in range(int(input())):
	n = int(input())
	lst = [*map(str, input().split())]
	s = '' + lst[0]
	for i in range(1, len(lst)):
		if s[-1] == lst[i][0]:
			s += lst[i][1]
		else:
			s += lst[i]
	if len(s) < n:
		s += s[-1] * (n - len(s))
	print(s)


t = int(input())
for i in range(t):
	n = int(input())
	b = input().split(' ')
	if n == 3:
		print(b[0] + 'a')
		continue
	s = [b[0][0]]
	flag = False
	for idx in range(len(b) - 1):
		prev = b[idx]
		curr = b[idx + 1]
		if prev[1] == curr[0]:
			s.append(prev[1])
		else:
			flag = True
			s.append(prev[1])
			s.append(curr[0])
	s.append(b[-1][1])
	if not flag:
		s.append('a')
	print(''.join(s))


def solve():
	n = int(input())
	arr = [s for s in input().split()]
	missing = None
	idx = -1
	for i in range(1, len(arr)):
		if arr[i][0] != arr[i - 1][1]:
			missing = '%s%s' % (arr[i - 1][1], arr[i][0])
			idx = i
	if not missing:
		missing = arr[-1][1] + 'a'
		arr.append(missing)
	s = arr[0][0]
	for i in range(len(arr)):
		if i == idx:
			s += missing[1]
		s += arr[i][1]
	print(s)
t = int(input())
for _ in range(t):
	solve()


import sys
int1 = lambda x: int(x) - 1
pDB = lambda *x: print(*x, end='\n', file=sys.stderr)
p2D = lambda x: print(*x, sep='\n', end='\n\n', file=sys.stderr)

def II():
	return int(sys.stdin.readline())

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

def LLI(rows_number):
	return [LI() for _ in range(rows_number)]

def LI1():
	return list(map(int1, sys.stdin.readline().split()))

def LLI1(rows_number):
	return [LI1() for _ in range(rows_number)]

def SI():
	return sys.stdin.readline().rstrip()
inf = 4294967295
md = 998244353

def solve():
	n = II()
	ss = SI().split()
	ans = ss[0][0]
	for i in range(n - 3):
		if ss[i][1] == ss[i + 1][0]:
			ans += ss[i][1]
		else:
			ans += ss[i][1] + ss[i + 1][0]
	ans += ss[-1][1]
	if len(ans) < n:
		ans += ans[-1]
	print(ans)
for testcase in range(II()):
	solve()


t = int(input())
for i in range(t):
	n = int(input())
	a = input().split()
	output = ''
	missing = 0
	for ind in range(n - 2):
		anow = a[ind]
		if ind == 0:
			aprev = anow
			output += anow
		elif anow[0] != aprev[1]:
			output += anow
			missing = 1
		else:
			output += anow[1]
		aprev = anow
	if missing == 0:
		output += 'a'
	print(output)


a = input()
i = int(a)
for x in range(i):
	j = int(input())
	l = input().split(' ')
	res = l[0][0]
	for y in l:
		if res[-1] != y[0]:
			res += y[0]
		res += y[1]
	if len(res) < j:
		res += 'a'
	print(res)


t = int(input())
for i in range(t):
	n = int(input())
	b = input().split()
	word = ''
	flag = True
	for el in b:
		if len(word) == 0:
			word = el
			continue
		if word[-1] == el[0]:
			word += el[1]
		else:
			flag = False
			word += el
	if flag:
		word += 'a'
	print(word)


for i in range(int(input())):
	n = int(input())
	l = input().split()
	f = False
	s = ''
	s += l[0][0]
	for i in range(1, len(l)):
		if l[i][0] == l[i - 1][1]:
			s += l[i][0]
		else:
			f = True
			s += l[i - 1][1] + l[i][0]
		if i == len(l) - 1:
			s += l[i][1]
	if len(l) == 1:
		s += l[0][1]
	if not f:
		s += 'a'
	print(s)


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

def get():
	return int(input())

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

def S():
	for test in range(int(input())):
		solve()
import math
import itertools as it
import bisect
import time
import collections as ct

def lower_bound(a, x):
	l = -1
	r = len(a)
	while l + 1 != r:
		mid = l + r >> 1
		if a[mid] < x:
			l = mid
		else:
			r = mid
	return r

def upper_bound(a, x):
	l = -1
	r = len(a)
	while l + 1 != r:
		mid = l + r >> 1
		if a[mid] <= x:
			l = mid
		else:
			r = mid
	return r

def solve():
	n = get()
	a = getstr()
	s = a[0]
	for i in range(1, n - 2):
		if a[i][0] == s[-1]:
			s += a[i][1]
		else:
			s += a[i]
	if len(s) != n:
		s += 'a'
	print(s)
S()


def op():
	n = int(input())
	a = input().split()
	ans = a[0]
	for i in range(1, n - 2):
		if a[i - 1][1] != a[i][0]:
			ans += a[i]
		else:
			ans += a[i][1]
	if len(ans) != n:
		ans += 'a'
	print(ans)
for i in range(int(input())):
	op()


import sys
input = sys.stdin.readline
for __ in range(int(input())):
	n = int(input())
	arr = list(input().split())
	answer = ''
	for x in arr:
		if answer and answer[-1] == x[0]:
			answer += x[1]
		else:
			answer += x
	if len(answer) == n:
		print(answer)
	else:
		print(answer + answer[-1])


t = int(input())
for i in range(t):
	s = ''
	find = 0
	n = int(input())
	bigram = input().split()
	for j in range(n - 3):
		s += bigram[j][0]
		if bigram[j][1] != bigram[j + 1][0]:
			s += bigram[j][1]
			find = 1
	s += bigram[n - 3]
	if find == 0:
		s += 'a'
	print(s)


for test in range(int(input())):
	n = int(input())
	arr = [x for x in input().split()]
	flag = False
	ans = ''
	for i in range(len(arr)):
		if i == 0:
			ans += arr[i][0]
		elif arr[i][0] == arr[i - 1][1]:
			ans += arr[i][0]
		else:
			flag = True
			ans += arr[i - 1][1] + arr[i][0]
	ans += arr[-1][1]
	if flag == False:
		ans += 'a'
	print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	bigrams = list(map(str, input().split(' ')))
	yesval = 'yes'
	word = ''
	length = 0
	for theta in range(n - 2):
		word = word + bigrams[theta][0]
	word = word + bigrams[n - 3][1]
	for delta in range(n - 3):
		if bigrams[delta][1] != bigrams[delta + 1][0]:
			pos = delta
			yesval = 'no'
			break
	if yesval == 'no':
		word = word[:pos + 1] + bigrams[pos][1] + word[pos + 1:]
	else:
		word = word + 'a'
	print(word)


t = int(input())
for i in range(t):
	le = int(input())
	l = input().split(' ')
	l1 = []
	s = l[0]

	def split(word):
		return [char for char in word]
	for i in range(1, len(l)):
		a = split(l[i])
		if s[-1] != a[0]:
			s = s + l[i]
		else:
			s = s + a[1]
	if len(s) >= le:
		print(s[0:le])
	else:
		v = le - len(s)
		for i in range(v):
			s = s + 'a'
		print(s)


for _ in range(int(input())):
	n = int(input())
	l = list(map(str, input().split()))
	s = '' + l[0]
	length = 1
	for i in range(1, len(l)):
		if s[length] == l[i][0]:
			s += l[i][1]
			length += 1
		else:
			s += l[i]
			length += 2
	nm = n - len(s)
	if n == 0:
		print(s)
	else:
		print(s + 'a' * nm)


t = int(input())
for i in range(t):
	n = int(input())
	arr = list(input().split())
	ans = [arr[0][0], arr[0][1]]
	found = False
	for j in range(1, len(arr)):
		if arr[j][0] == arr[j - 1][1]:
			ans.append(arr[j][1])
		else:
			found = True
			ans.append('' + arr[j][0] + arr[j][1])
	if not found:
		ans.append('a')
	print(''.join(ans))


import sys
import bisect
import math
from collections import deque
input = lambda : sys.stdin.readline().strip()
mod = 10 ** 9 + 7

def solve():
	n = int(input())
	a = input().split()
	for i in range(1, len(a)):
		if a[i][0] != a[i - 1][-1]:
			return ''.join((a[j][0] for j in range(i))) + a[i - 1][1] + ''.join((a[j][0] for j in range(i, len(a)))) + a[-1][1]
	return ''.join((x[0] for x in a)) + a[-1][1] * 2
t = 1
t = int(input())
for _ in range(t):
	print(solve())


for _ in range(int(input())):
	n = int(input())
	lst = input().split()
	a = [lst[0][0]]
	f = lst[0][0]
	for i in lst:
		if f != i[0]:
			a.append(i)
		else:
			a.append(i[1])
		f = i[1]
	ans = ''.join(a)
	if len(ans) < n:
		print(ans + 'a')
	else:
		print(ans)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(str, input().split()))
	z = ''
	z = z + str(a[0])
	m = 0
	if len(a) == 1:
		q = str(a[0])
		z = z + str(q[0])
		print(z)
	else:
		for j in range(len(a) - 1):
			x = str(a[j])
			y = str(a[j + 1])
			p = x[1]
			q = y[0]
			if p == q:
				z = z + str(y[1])
			else:
				z = z + str(a[j + 1])
			if len(z) == n:
				m = 1
				break
		if m == 1:
			print(z)
		else:
			z = z + str(y[1])
			print(z)


for _ in range(int(input())):
	n = int(input())
	a = list(map(str, input().split()))
	s = ''
	for i in range(1, n - 2):
		s += a[i][0] if a[i][0] == a[i - 1][1] else a[i - 1][1] + a[i][0]
	print(a[0][0] + s + a[n - 3][1] if len(s) == n - 2 else a[0][0] + s + a[n - 3][1] + a[n - 3][1])


t = int(input())
ans = []
for i in range(0, t):
	n = int(input())
	l = input()
	d = str(l)
	d = d + ' '
	w = str(d[0])
	z = []
	for j in range(0, int(len(d))):
		if str(d[j]) == ' ':
			continue
		else:
			z.append(str(d[j]))
	for k in range(1, int(len(z)) - 2, 2):
		if str(z[k]) == str(z[k + 1]):
			w = w + str(z[k])
		else:
			w = w + str(z[k]) + str(z[k + 1])
	w = w + str(z[int(len(z) - 1)])
	if n == 3:
		w = 'a' + w
	elif int(len(w)) != n:
		w = w + str(z[int(len(z) - 1)])
	ans.append(w)
for q in range(0, int(len(ans))):
	print(ans[q])


t = int(input())
for _ in range(t):
	n = int(input())
	a = input().split()
	b = [a[0]]
	fl = 0
	for i in range(n - 3):
		if a[i][1] != a[i + 1][0]:
			b.append(a[i][1] + a[i + 1][0])
			fl = 1
		b.append(a[i + 1])
	if not fl:
		b.append(a[n - 3][1] + 'a')
	s = ''
	for i in range(0, n - 1, 2):
		s += b[i]
	if n % 2 == 1:
		s += b[-1][1]
	print(s)


for _ in range(int(input())):
	n = int(input())
	s = input()
	s = s.replace('b b', 'b')
	s = s.replace('a a', 'a')
	s = s.replace(' ', '')
	while len(s) != n:
		s += 'a'
	print(s)


def main():
	T = int(input())
	for t in range(T):
		n = int(input())
		w = list(input().strip().split(' '))
		word = w[0]
		for l in w[1:]:
			if l[0] == word[-1]:
				word += l[1]
			else:
				word += l
		if len(word) != n:
			word += 'a'
		print(word)
main()