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

#from collections import deque, Counter, OrderedDict,defaultdict
#from heapq import nsmallest, nlargest, heapify,heappop ,heappush, heapreplace
#from math import log,sqrt,factorial,cos,tan,sin,radians
#from bisect import bisect,bisect_left,bisect_right,insort,insort_left,insort_right
#from decimal import *
#import threading
#from itertools import permutations
#Copy 2D list  m = [x[:] for x in mark] .. Avoid Using Deepcopy
from collections import deque,defaultdict,Counter,OrderedDict

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
#mod=998244353
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(max(n-r,1)))

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) : # Check Prime Number or not
    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('venv\CodeForces\input.txt', 'r')
    sys.stdout = open('venv\CodeForces\output.txt', 'w')

def main():
    t = int(input())

    for _ in range(t):
        n = int(input())
        a = list(map(int, input().split()))

        mx = max(a)
        ans = [ 'a' * (mx + 1) ] * (n + 1)

        for i, x in enumerate(a):
            who = 'a' if ans[i][x] == 'b' else 'b'
            ans[i + 1] = ans[i][:x] + who + ans[i][x + 1:]

        print('\n'.join(ans))

# region fastio
# template taken from https://github.com/cheran-senthil/PyRival/blob/master/templates/template.py

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):
    """Prints the values to a stream, or to sys.stdout by default."""
    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")

# endregion

if __name__ == "__main__":
    # read()
    main()
    # dmain()

# Comment Read()


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

#from collections import deque, Counter, OrderedDict,defaultdict
#from heapq import nsmallest, nlargest, heapify,heappop ,heappush, heapreplace
#from math import log,sqrt,factorial,cos,tan,sin,radians
#from bisect import bisect,bisect_left,bisect_right,insort,insort_left,insort_right
#from decimal import *
#import threading
#from itertools import permutations
#Copy 2D list  m = [x[:] for x in mark] .. Avoid Using Deepcopy
from collections import deque,defaultdict,Counter,OrderedDict

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
#mod=998244353
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(max(n-r,1)))

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) : # Check Prime Number or not
    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('venv\CodeForces\input.txt', 'r')
    sys.stdout = open('venv\CodeForces\output.txt', 'w')

def main():
    for i in range(int(input())):
        n = int(input())
        arr = deque(map(int,input().split()))
        strr = 'abcdefghijklmnopqrstuvwxyz'
        st2 = strr[::-1]
        strr = strr*8

        ans = [strr]
        for i in arr:
            s1 = ans[-1]
            s2 = s1[:i]+s1[i+1:]
            ans.append(s2)

        for ad in ans:
            print(ad)

# region fastio
# template taken from https://github.com/cheran-senthil/PyRival/blob/master/templates/template.py

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):
    """Prints the values to a stream, or to sys.stdout by default."""
    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")

# endregion

if __name__ == "__main__":
    # read()
    main()
    # dmain()

# Comment Read()


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

#from collections import deque, Counter, OrderedDict,defaultdict
#from heapq import nsmallest, nlargest, heapify,heappop ,heappush, heapreplace
#from math import log,sqrt,factorial,cos,tan,sin,radians
#from bisect import bisect,bisect_left,bisect_right,insort,insort_left,insort_right
#from decimal import *
#import threading
#from itertools import permutations
#Copy 2D list  m = [x[:] for x in mark] .. Avoid Using Deepcopy
from collections import deque,defaultdict,Counter,OrderedDict

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
#mod=998244353
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(max(n-r,1)))

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) : # Check Prime Number or not
    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('venv\CodeForces\input.txt', 'r')
    sys.stdout = open('venv\CodeForces\output.txt', 'w')

def main():
    for i in range(int(input())):
        n = int(input())
        arr = deque(map(int,input().split()))
        strr = 'abcdefghijklmnopqrstuvwxyz'
        st2 = strr[::-1]
        strr = strr+strr

        ans = [strr]
        for i in arr:
            s1 = ans[-1]
            s2 = s1[:i]+s1[i+1:]
            ans.append(s2)

        for ad in ans:
            print(ad)

# region fastio
# template taken from https://github.com/cheran-senthil/PyRival/blob/master/templates/template.py

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):
    """Prints the values to a stream, or to sys.stdout by default."""
    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")

# endregion

if __name__ == "__main__":
    # read()
    main()
    # dmain()

# Comment Read()


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

#from collections import deque, Counter, OrderedDict,defaultdict
#from heapq import nsmallest, nlargest, heapify,heappop ,heappush, heapreplace
#from math import log,sqrt,factorial,cos,tan,sin,radians
#from bisect import bisect,bisect_left,bisect_right,insort,insort_left,insort_right
#from decimal import *
#import threading
#from itertools import permutations
#Copy 2D list  m = [x[:] for x in mark] .. Avoid Using Deepcopy
from collections import deque,defaultdict,Counter,OrderedDict

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
#mod=998244353
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(max(n-r,1)))

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) : # Check Prime Number or not
    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('venv\CodeForces\input.txt', 'r')
    sys.stdout = open('venv\CodeForces\output.txt', 'w')

def main():
    for i in range(int(input())):
        n = int(input())
        arr = deque(map(int,input().split()))
        strr = 'abcdefghijklmnopqrstuvwxyz'
        st2 = strr[::-1]
        strr = strr+strr+strr+strr+strr

        ans = [strr]
        for i in arr:
            s1 = ans[-1]
            s2 = s1[:i]+s1[i+1:]
            ans.append(s2)

        for ad in ans:
            print(ad)

# region fastio
# template taken from https://github.com/cheran-senthil/PyRival/blob/master/templates/template.py

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):
    """Prints the values to a stream, or to sys.stdout by default."""
    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")

# endregion

if __name__ == "__main__":
    # read()
    main()
    # dmain()

# Comment Read()


# Fast I/O PyPy2
from __future__ import division, print_function

import os
import 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 solve(a, n):
    max_len = max(a)
    ans = ["a" * (max_len + 1)] * (n + 1)

    for i, x in enumerate(a):
        who = "a" if ans[i][x] == "b" else "b"
        ans[i + 1] = ans[i][:x] + who + ans[i][x + 1:]

    print('\n'.join(ans))

# region fastio

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):
    """Prints the values to a stream, or to sys.stdout by default."""
    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")

# endregion
if __name__ == "__main__":
    #sys.stdin = open('input.txt', "r")
    #sys.stdout = open('output.txt', 'w')
    t = int(input())
    for _ in range(t):
        n = int(input())
        a = [int(x) for x in input().split()]
        solve(a, n)


# Fast I/O PyPy2
from __future__ import division, print_function

import os
import 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 solve(a, string):
    common = [string[i] for i in range(1, 27)]
    j = 1
    for i in range(len(a) - 1):
        prev_zero = 0
        if a[i] != 0 and a[i] <= a[i + 1]:
            print(string[0:a[i]])
        elif a[i] == 0:
            if i > 0 and a[i - 1] != 0:
                if a[i + 1] != 0:
                    print(string[a[i - 1]:a[i + 1] + a[i - 1]])
                    prev_zero = i - 1
                else:
                    print(common[j])
                    j += 1
            else:
                print(common[j])
                j += 1
        else:
            if i > 0 and a[i - 1] == 0:
                print(string[a[prev_zero]:a[i] + a[prev_zero] + 1])
            else:
                print(string[0:a[i]])
                print(string[0:a[i] + 1])

    if sum(a) == 0:
        print(common[j])
        print(common[j + 1])
    else:
        if a[-1] == 0:
            print(common[j])
        else:
            print(string[0:a[-1]])

# region fastio

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):
    """Prints the values to a stream, or to sys.stdout by default."""
    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")

# endregion
try:
    if __name__ == "__main__":
        #sys.stdin = open('input.txt', "r")
        #sys.stdout = open('output.txt', 'w')
        t = int(input())
        for _ in range(t):
            string = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"
            n = int(input())
            a = [int(x) for x in input().split()]
            solve(a, string)
except:
    pass


# Fast I/O PyPy2
from __future__ import division, print_function

import os
import 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 solve(a, string):
    common = [string[i] for i in range(1, 27)]
    j = 1
    for i in range(len(a) - 1):
        if a[i] != 0 and a[i] <= a[i + 1]:
            print(string[0:a[i]])
        elif a[i] == 0:
            print(common[j])
            j += 1
        else:
            print(string[0:a[i]])
            print(string[0:a[i] + 1])
    if a[-1] == 0:
        print(common[j])
    else:
        print(string[0:a[-1]])

# region fastio

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):
    """Prints the values to a stream, or to sys.stdout by default."""
    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")

# endregion
try:
    if __name__ == "__main__":
        # sys.stdin = open('input.txt', "r")
        # sys.stdout = open('output.txt', 'w')
        t = int(input())
        for _ in range(t):
            string = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"
            n = int(input())
            a = [int(x) for x in input().split()]
            solve(a, string)
            # print()
except:
    pass


# Fast I/O PyPy2
from __future__ import division, print_function

import os
import 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 solve(a, string):
    common = [string[i] for i in range(1, 27)]
    j = 1
    for i in range(len(a) - 1):
        prev_zero = 0
        if a[i] != 0 and a[i] <= a[i + 1]:
            print(string[0:a[i]])
        elif a[i] == 0:
            if i > 0 and a[i - 1] != 0:
                if a[i + 1] != 0:
                    print(string[a[i - 1]:a[i + 1] + a[i - 1]])
                    prev_zero = i - 1
                else:
                    print(common[j])
                    j += 1
            else:
                print(common[j])
                j += 1
        else:
            if i > 0 and a[i - 1] == 0:
                print(string[a[prev_zero]:a[i] + a[prev_zero] + 1])
            else:
                print(string[0:a[i]])
                print(string[0:a[i] + 1])

    if sum(a) == 0:
        print(common[j])
        print(common[j + 1])
    else:
        if a[-1] == 0:
            print(common[j])
        else:
            print(string[0:a[-1]])

# region fastio

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):
    """Prints the values to a stream, or to sys.stdout by default."""
    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")

# endregion
try:
    if __name__ == "__main__":
        sys.stdin = open('input.txt', "r")
        sys.stdout = open('output.txt', 'w')
        t = int(input())
        for _ in range(t):
            string = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"
            n = int(input())
            a = [int(x) for x in input().split()]
            solve(a, string)
except:
    pass


# Fast I/O PyPy2
from __future__ import division, print_function

import os
import 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 solve(a, string):
    common = [string[i] for i in range(1, 27)]
    j = 1
    for i in range(len(a) - 1):
        prev_zero = 0
        if a[i] != 0 and a[i] <= a[i + 1]:
            print(string[0:a[i]])
        elif a[i] == 0:
            if i > 0 and a[i - 1] != 0:
                if a[i + 1] != 0:
                    print(string[a[i - 1]:a[i + 1] + a[i - 1]])
                    prev_zero = i - 1
                else:
                    print(common[j])
                    j += 1
            else:
                print(common[j])
                j += 1
        else:
            if i > 0 and a[i - 1] == 0:
                print(string[a[prev_zero]:a[i] + a[prev_zero] + 1])
            else:
                print(string[0:a[i]])
                print(string[0:a[i] + 1])

    if sum(a) == 0:
        print(common[j])
        print(common[j + 1])
    else:
        if a[-1] == 0:
            print(common[j])
        else:
            print(string[0:a[-1]])

# region fastio

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):
    """Prints the values to a stream, or to sys.stdout by default."""
    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")

# endregion
try:
    if __name__ == "__main__":
        # sys.stdin = open('input.txt', "r")
        # sys.stdout = open('output.txt', 'w')
        t = int(input())
        for _ in range(t):
            string = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"
            n = int(input())
            a = [int(x) for x in input().split()]
            solve(a, string)
            print()
except:
    pass


# template by 3xC and starkizard.
# contributors:

#####################################################################################
from __future__ import division, print_function

import sys
import os
from collections import Counter, deque, defaultdict
import itertools
import math
import io

"""Uncomment modules according to your need"""

# from bisect import bisect_left, bisect_right, insort
# from heapq import heappop, heapify, heappush
# from random import randint as rn
# from Queue import Queue as Q
# from copy import deepcopy
# from decimal import *
# import re
# import operator

#####################################################################################
# this enables you to write python3 code with PyPy2 (Python 2)
if sys.version_info[0] < 3:
    input = raw_input
    range = xrange

    filter = itertools.ifilter
    map = itertools.imap
    zip = itertools.izip

#####################################################################################

"""value of mod"""
MOD = 998244353
mod = 10**9 + 7

"""Uncomment next 4 lines if doing huge recursion"""
# import threading
# threading.stack_size(1<<27)
# sys.setrecursionlimit(10000

def prepare_factorial(mod=mod):
    """ returns two lists, factorial and inverse factorial modulo argument by default 10**9 +7 """
    # Comment code out when you don't need inverse factorial or vice versa
    fact = [1]
    for i in range(1, 200005):
        fact.append((fact[-1] * i) % mod)

    ifact = [0] * 200005
    ifact[200004] = pow(fact[200004], mod - 2, mod)
    for i in range(200004, 0, -1):
        ifact[i - 1] = (i * ifact[i]) % mod

    return fact, ifact

def modinv(n, p):
    """ returns N inverse modulo p """
    return pow(n, p - 2, p)

def ncr(n, r,  fact, ifact):
    """ takes 4 arguments: n , r and factorial and inverse factorial lists"""
    t = (fact[n] * (ifact[r]*ifact[n-r]) % MOD)% MOD
    return t

def get_n(Sum):
    """this function returns the maximum n for which Summation(n) <= Sum"""
    ans = (-1 + sqrt(1 + 8*Sum))//2
    return ans

def sieve(n):
    """ returns a list of prime numbers till 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):
    """ returns a list of all divisors till n """
    divisors = []
    #rdivisors=[]
    for i in range(start, int(math.sqrt(n) + 1)):
        if n % i == 0:
            if n / i == i:
                divisors.append(i)
            else:
                divisors.extend([i, n // i])
    return divisors

def divn(N):
    """ returns the number of divisors """
    divs_number = 1
    factorCounter=1
    tempList=[]

    while N%2==0:
        factorCounter+=1
        N=N//2
    tempList.append(factorCounter)

    i=3

    while i*i<=N:
        factorCounter=1
        while N%i==0:
            factorCounter+=1
            N=N//i
        if factorCounter!=1:
            tempList.append(factorCounter)
        i+=1

    if N>2:
        factorCounter=2
        tempList.append(factorCounter)

    divisorCount=1
    for i in tempList:
        divisorCount*=i
    return(divisorCount)

def lrfind(d, x, default=-1):
    """ Takes 2 arguments an iterable and an element. returns a tuple (firstoccurence,lastoccurence) -1 if not found """
    left = right = -1
    for i in range(len(d)):
        if d[i] == x:
            if left == -1: left = i
            right = i
    if left == -1:
        return default, default
    else:
        return left, right

def gcd(x, y): # math.gcd is slower
    """ returns greatest common divisor of x and y """
    while y:
        x, y = y, x % y
    return x

def check_sorted(a):
    ''' returns True/False '''
    for i in range(len(a)-1):
        if a[i]>a[i+1]:
            return False
    return True
def ceil(n, k=1): return n // k + (n % k != 0) #returns math.ceil but protecting against floating inconsistencies
def input(): return sys.stdin.readline().strip()
def ii(): return int(input()) #inputs integer
def mi(): return map(int, input().split()) # inputting space seperated variables for example x,y,z
def li(): return list(map(int, input().split())) #inputting a space seperated list of integers
def lw(): return input().split() #inputting a space seperated list of strings
def lcm(a, b): return abs(a * b) // gcd(a, b) #returns LCM of two arguments
def prr(a, sep=' ', end='\n'): print(sep.join(map(str, a)), end=end) #For printing an iterable with seperator sep as optional second argument (default : " "), ending character (default: "\n") as optional third
def dd(): return defaultdict(int) #returns a dictionary with values defaulted to 0
def ddl(): return defaultdict(list) #returns a dictionary with values defaulted to []
def write(s): return sys.stdout.write(s)

###################################################################

def main():
    #CODE GOES HERE:
    for t in range(ii()):
        n=ii()
        a=li()
        s=""
        maxl=max(a)
        for i in range(maxl):
            s+=chr(97+(i%26))
        print(s)
        for i in range(n):
            t=""
            for j in range(maxl):
                if j<a[i]:
                    t+=s[j]
                else:
                    c=(ord(s[j])+1)
                    if c>ord('z'):
                        c-=26
                    t+=chr(c)
            s=t
            print(s)

""" -------- Python 2 and 3 footer by Pajenegod and c1729 ---------"""

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')
# sys.stdin = open('input.txt', 'r')
# sys.stdout = open('output.txt', 'w')

""" main function"""

if __name__ == '__main__':
    main()
    # threading.Thread(target=main).start()


# template by 3xC and starkizard.
# contributors:

#####################################################################################
from __future__ import division, print_function

import sys
import os
from collections import Counter, deque, defaultdict
import itertools
import math
import io

"""Uncomment modules according to your need"""

# from bisect import bisect_left, bisect_right, insort
# from heapq import heappop, heapify, heappush
# from random import randint as rn
# from Queue import Queue as Q
# from copy import deepcopy
# from decimal import *
# import re
# import operator

#####################################################################################
# this enables you to write python3 code with PyPy2 (Python 2)
if sys.version_info[0] < 3:
    input = raw_input
    range = xrange

    filter = itertools.ifilter
    map = itertools.imap
    zip = itertools.izip

#####################################################################################

"""value of mod"""
MOD = 998244353
mod = 10**9 + 7

"""Uncomment next 4 lines if doing huge recursion"""
# import threading
# threading.stack_size(1<<27)
# sys.setrecursionlimit(10000

def prepare_factorial(mod=mod):
    """ returns two lists, factorial and inverse factorial modulo argument by default 10**9 +7 """
    # Comment code out when you don't need inverse factorial or vice versa
    fact = [1]
    for i in range(1, 200005):
        fact.append((fact[-1] * i) % mod)

    ifact = [0] * 200005
    ifact[200004] = pow(fact[200004], mod - 2, mod)
    for i in range(200004, 0, -1):
        ifact[i - 1] = (i * ifact[i]) % mod

    return fact, ifact

def modinv(n, p):
    """ returns N inverse modulo p """
    return pow(n, p - 2, p)

def ncr(n, r,  fact, ifact):
    """ takes 4 arguments: n , r and factorial and inverse factorial lists"""
    t = (fact[n] * (ifact[r]*ifact[n-r]) % MOD)% MOD
    return t

def get_n(Sum):
    """this function returns the maximum n for which Summation(n) <= Sum"""
    ans = (-1 + sqrt(1 + 8*Sum))//2
    return ans

def sieve(n):
    """ returns a list of prime numbers till 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):
    """ returns a list of all divisors till n """
    divisors = []
    #rdivisors=[]
    for i in range(start, int(math.sqrt(n) + 1)):
        if n % i == 0:
            if n / i == i:
                divisors.append(i)
            else:
                divisors.extend([i, n // i])
    return divisors

def divn(N):
    """ returns the number of divisors """
    divs_number = 1
    factorCounter=1
    tempList=[]

    while N%2==0:
        factorCounter+=1
        N=N//2
    tempList.append(factorCounter)

    i=3

    while i*i<=N:
        factorCounter=1
        while N%i==0:
            factorCounter+=1
            N=N//i
        if factorCounter!=1:
            tempList.append(factorCounter)
        i+=1

    if N>2:
        factorCounter=2
        tempList.append(factorCounter)

    divisorCount=1
    for i in tempList:
        divisorCount*=i
    return(divisorCount)

def lrfind(d, x, default=-1):
    """ Takes 2 arguments an iterable and an element. returns a tuple (firstoccurence,lastoccurence) -1 if not found """
    left = right = -1
    for i in range(len(d)):
        if d[i] == x:
            if left == -1: left = i
            right = i
    if left == -1:
        return default, default
    else:
        return left, right

def gcd(x, y): # math.gcd is slower
    """ returns greatest common divisor of x and y """
    while y:
        x, y = y, x % y
    return x

def check_sorted(a):
    ''' returns True/False '''
    for i in range(len(a)-1):
        if a[i]>a[i+1]:
            return False
    return True
def ceil(n, k=1): return n // k + (n % k != 0) #returns math.ceil but protecting against floating inconsistencies
def input(): return sys.stdin.readline().strip()
def ii(): return int(input()) #inputs integer
def mi(): return map(int, input().split()) # inputting space seperated variables for example x,y,z
def li(): return list(map(int, input().split())) #inputting a space seperated list of integers
def lw(): return input().split() #inputting a space seperated list of strings
def lcm(a, b): return abs(a * b) // gcd(a, b) #returns LCM of two arguments
def prr(a, sep=' ', end='\n'): print(sep.join(map(str, a)), end=end) #For printing an iterable with seperator sep as optional second argument (default : " "), ending character (default: "\n") as optional third
def dd(): return defaultdict(int) #returns a dictionary with values defaulted to 0
def ddl(): return defaultdict(list) #returns a dictionary with values defaulted to []
def write(s): return sys.stdout.write(s)

###################################################################

def main():
    #CODE GOES HERE:
    for t in range(ii()):
        n=ii()
        a=li()
        s=""
        maxl=max(a)
        if maxl==0:
            s="a"
            maxl=1
        else:
            for i in range(maxl):
                s+=chr(97+(i%26))
        print(s)
        for i in range(n):
            t=""
            for j in range(maxl):
                if j<a[i]:
                    t+=s[j]
                else:
                    c=(ord(s[j])+1)
                    if c>ord('z'):
                        c-=26
                    t+=chr(c)
            s=t
            print(s)

""" -------- Python 2 and 3 footer by Pajenegod and c1729 ---------"""

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')
# sys.stdin = open('input.txt', 'r')
# sys.stdout = open('output.txt', 'w')

""" main function"""

if __name__ == '__main__':
    main()
    # threading.Thread(target=main).start()


T = input()
for t in range(T) :
  N = input()
  arr = map(int,raw_input().split())

  ans = []
  word = [0] * 52

  for n in range(N) :
    ans.append(tuple(word))
    word[arr[n]] += 1
  ans.append(tuple(word))

  for n in range(N+1) :
    w = ans[n]
    res = ''.join(chr(ord('a') + x%26) for x in w)
    print res


alpha = 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz'
T = input()
for t in range(T) :
  N = input()
  arr = map(int,raw_input().split())

  print alpha[:arr[0]]
  for n in range(1,N) :
    print alpha[:max(arr[n], arr[n-1])]
  print alpha[:arr[-1]]


alpha = 'abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz'
alt = 'bcdefghijklmnopqrstuvwxyz'
T = input()
for t in range(T) :
  N = input()
  arr = map(int,raw_input().split())

  for n in range(N) :
    if arr[n] == 0 : print alt[n % len(alt)]
    elif n == 0 : print alpha[:arr[0]]
    else : print alpha[:max(arr[n], arr[n-1])]

  if arr[-1] == 0 : print alt[N % len(alt)]
  else : print alpha[:arr[-1]]


#!/usr/bin/env python
from __future__ import division, print_function

import os
import 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

import random
import collections
import math
import itertools
import bisect

def real_main():
    for _ in range(read_int()):
        _ = read_int()
        nums = read_int_array()
        out = ['a'*nums[0], 'a'*nums[0]] if nums[0] else ['a', 'b']
        for x in nums[1:]:
            if not x:
                out.append('b' if out[-1][0] == 'a' else 'a')
            elif x <= len(out[-1]):
                out.append(out[-1][:x])
            else:
                if len(out[-2]) > len(out[-1]):
                    out[-1] += 'b' if out[-2][len(out[-1])] == 'a' else 'a'
                out[-1] += 'a'*(x - len(out[-1]))
                out.append(out[-1])

        for s in out:
            print(s)

def solve():
    pass

def main():
    if False and 'PYCHARM_HOSTED' in os.environ:
        main_pycharm()
    else:
        real_main()

from copy import deepcopy
def main_pycharm():
    solution = solve

    test_inputs = None
    test_outputs = None
    judge = None
    slow_solution = None
    if solution is not None:
        if test_outputs is not None:
            test_with_answers(solution, test_inputs, test_outputs)
        if judge is not None:
            test_with_judge(solution, test_inputs, judge)
        if slow_solution is not None:
            test_with_slow_solution(solution, test_inputs, slow_solution)

def test_with_answers(solution, inputs, answers):
    total, wrong = 0, 0
    for args, test_ans in zip(inputs, answers):
        ans = solution(*deepcopy(args))
        if ans != test_ans:
            print('WRONG! ans=%s, test_ans=%s, args=%s' % (ans, test_ans, args))
            wrong += 1
        else:
            print('GOOD')
        total += 1
    print('ALL %d TESTS PASSED' % total if not wrong else '%d out of %d tests are WRONG' % (wrong, total))

def test_with_judge(solution, inputs_gen, judge):
    total, wrong = 0, 0
    for args in inputs_gen:
        ans = solution(*deepcopy(args))
        if not judge(deepcopy(ans), *deepcopy(args)):
            print('WRONG! ans=%s, args=%s' % (ans, args))
            wrong += 1
        total += 1
    print('ALL %d TESTS PASSED' % total if not wrong else '%d out of %d tests are WRONG' % (wrong, total))

def test_with_slow_solution(solution, inputs_gen, solution_slow):
    total, wrong = 0, 0
    for args in inputs_gen:
        ans = solution(*deepcopy(args))
        slow = solution_slow(*deepcopy(args))
        if ans != slow:
            print('WRONG! ans=%s, slow=%s, args=%s' % (ans, slow, args))
            wrong += 1
        total += 1
    print('ALL %d TESTS PASSED' % total if not wrong else '%d out of %d tests are WRONG' % (wrong, total))

def generate_nums(n, min, max, check_if_good=None):
    while True:
        nums = [random.randint(min, max) for _ in range(n)]
        if check_if_good is None or check_if_good(nums):
            return nums

# This mergesort can be like 7 times faster than build in sort
# (for stupid reasons)
def mergesort(A, key=lambda x: x, reverse=False):
    C = A
    A = list(range(len(A)))
    B = list(A)

    n = len(A)
    for i in range(0, n - 1, 2):
        if key(C[A[i]]) > key(C[A[i ^ 1]]):
            A[i], A[i ^ 1] = A[i ^ 1], A[i]

    width = 2
    while width < n:
        for i in range(0, n, 2 * width):
            R1, R2 = min(i + width, n), min(i + 2 * width, n)
            j, k = R1, i
            while i < R1 and j < R2:
                if key(C[A[i]]) > key(C[A[j]]):
                    B[k] = A[j]
                    j += 1
                else:
                    B[k] = A[i]
                    i += 1
                k += 1
            while i < R1:
                B[k] = A[i]
                k += 1
                i += 1
            while k < R2:
                B[k] = A[k]
                k += 1
        A, B = B, A
        width *= 2

    if reverse:
        A.reverse()
    return A

def mergesort_simple(A, reverse=False):
    C = A
    A = list(range(len(A)))
    B = list(A)

    n = len(A)
    for i in range(0, n - 1, 2):
        if C[A[i]] > C[A[i ^ 1]]:
            A[i], A[i ^ 1] = A[i ^ 1], A[i]

    width = 2
    while width < n:
        for i in range(0, n, 2 * width):
            R1, R2 = min(i + width, n), min(i + 2 * width, n)
            j, k = R1, i
            while i < R1 and j < R2:
                if C[A[i]] > C[A[j]]:
                    B[k] = A[j]
                    j += 1
                else:
                    B[k] = A[i]
                    i += 1
                k += 1
            while i < R1:
                B[k] = A[i]
                k += 1
                i += 1
            while k < R2:
                B[k] = A[k]
                k += 1
        A, B = B, A
        width *= 2

    if reverse:
        A.reverse()
    return A

# region fastio

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):
    """Prints the values to a stream, or to sys.stdout by default."""
    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")

def read():
    return input()

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

def read_array(sep=None, maxsplit=-1):
    return input().split(sep, maxsplit)

def read_int_array():
    return [int(a) for a in read_array()]

# endregion

if __name__ == "__main__":
    main()


import math
from collections import deque
from sys import stdin, stdout
from string import ascii_letters
input = stdin.readline
#print = stdout.write
letters = ascii_letters[:26]

for _ in range(int(input())):
    n = int(input())
    last = -1
    for i in map(int, input().split()):
        print('a' * i)


import math
from collections import deque
from sys import stdin, stdout
from string import ascii_letters
input = stdin.readline
#print = stdout.write
letters = ascii_letters[:26]
ind = 0
bf = 0

for _ in range(int(input())):
    n = int(input())
    arr = list(map(int, input().split()))
    mx = max(arr) + 1
    print('a' * mx)
    last = list('a' * mx)
    ind = (ind + 1) % 20
    for i in range(0, n):
        last[arr[i]] = letters[ind]
        ind = (ind + 1) % 20
        print(''.join(last))


import math
from collections import deque
from sys import stdin, stdout
from string import ascii_letters
input = stdin.readline
#print = stdout.write
letters = ascii_letters[:26]
def prnt(txt):
    if not len(txt):
        return
    print(txt)

for _ in range(int(input())):
    n = int(input())
    arr = list(map(int, input().split()))
    prnt('a' * arr[0])
    for i in range(0, n):
        if i == n - 1:
            prnt('a' * arr[i])
            continue
        prnt('a' * max(arr[i], arr[i + 1]))


import math
from collections import deque
from sys import stdin, stdout
from string import ascii_letters
input = stdin.readline
#print = stdout.write
letters = ascii_letters[:26]

for _ in range(int(input())):
    n = int(input())
    ind = 0
    arr = list(map(int, input().split()))
    mx = max(arr) + 1
    print('a' * mx)
    last = list('a' * mx)
    ind = (ind + 1) % 26
    for i in range(0, n):
        last[arr[i]] = letters[ind]
        ind = (ind + 1) % 26
        print(''.join(last))


import math
from collections import deque
from sys import stdin, stdout
from string import ascii_letters
input = stdin.readline
#print = stdout.write
letters = ascii_letters[:26]
ind = 0
bf = 0

for _ in range(int(input())):
    n = int(input())
    arr = list(map(int, input().split()))
    print(letters[ind] * max(1, arr[0]))
    for i in range(0, n):
        if arr[i] == 0:
            ind = (ind + 1) % 20
            print(letters[ind])
            continue
        if i == n - 1:
            print(letters[ind] * arr[i])
            continue
        print(letters[ind] * max(arr[i], arr[i + 1]))


import math
from collections import deque
from sys import stdin, stdout
from string import ascii_letters
input = stdin.readline
#print = stdout.write
letters = ascii_letters[:26]

for _ in range(int(input())):
    n = int(input())
    ind = 0
    arr = list(map(int, input().split()))
    mx = max(arr) + 50
    print('a' * mx)
    last = list('a' * mx)
    ind = (ind + 1) % 26
    for i in range(0, n):
        last[arr[i]] = letters[ind]
        ind = (ind + 1) % 26
        print(''.join(last))


import math
from collections import deque
from sys import stdin, stdout
from string import ascii_letters
input = stdin.readline
#print = stdout.write
letters = ascii_letters[:26]
ind = 0
bf = 0

for _ in range(int(input())):
    n = int(input())
    arr = list(map(int, input().split()))
    mx = max(1, max(arr) + 1)
    print('a' * mx)
    last = 'a' * mx
    ind = (ind + 1) % 20
    for i in range(0, n):
        last = last[:arr[i]] + letters[ind] * (mx - arr[i])
        ind = (ind + 1) % 20
        print(last)


import math
from collections import deque
from sys import stdin, stdout
from string import ascii_letters
input = stdin.readline
#print = stdout.write
letters = ascii_letters[:26]

for _ in range(int(input())):
    n = int(input())
    ind = 0
    arr = list(map(int, input().split()))
    mx = 100
    print('a' * mx)
    last = list('a' * mx)
    ind = (ind + 1) % 26
    for i in range(0, n):
        last[arr[i]] = letters[ind]
        ind = (ind + 1) % 26
        print(''.join(last))


import math
from collections import deque
from sys import stdin, stdout
from string import ascii_letters
input = stdin.readline
#print = stdout.write
letters = ascii_letters[:26]
ind = 0
bf = 0

for _ in range(int(input())):
    n = int(input())
    arr = list(map(int, input().split()))
    mx = max(1, max(arr) + 1)
    print('a' * mx)
    last = list('a' * mx)
    ind = (ind + 1) % 26
    for i in range(0, n):
        last[arr[i]] = letters[ind]
        ind = (ind + 1) % 26
        print(''.join(last))


import math
from collections import deque
from sys import stdin, stdout
from string import ascii_letters
input = stdin.readline
#print = stdout.write
letters = ascii_letters[:26]

for _ in range(int(input())):
    n = int(input())
    ind = 0
    arr = list(map(int, input().split()))
    mx = max(arr) + 100
    print('a' * mx)
    last = list('a' * mx)
    ind = (ind + 1) % 26
    for i in range(0, n):
        last[arr[i]] = letters[ind]
        ind = (ind + 1) % 26
        print(''.join(last))


import math
from collections import deque
from sys import stdin, stdout
from string import ascii_letters
input = stdin.readline
#print = stdout.write
letters = ascii_letters[:26]

for _ in range(int(input())):
    n = int(input())
    arr = list(map(int, input().split()))
    print('a' * arr[0])
    for i in range(0, n):
        if i == n - 1:
            print('a' * arr[i])
            continue
        print('a' * max(arr[i], arr[i + 1]))


import math
from collections import deque
from sys import stdin, stdout
from string import ascii_letters
input = stdin.readline
#print = stdout.write
letters = ascii_letters[:26]

for _ in range(int(input())):
    n = int(input())
    ind = 0
    arr = list(map(int, input().split()))
    mx = max(arr) + 1
    print('a' * mx)
    last = list(letters[ind] * mx)
    ind = (ind + 1) % 26
    for i in range(0, n):
        last[arr[i]] = letters[ind]
        ind = (ind + 1) % 26
        print(''.join(last))


import math
from collections import deque
from sys import stdin, stdout
from string import ascii_letters
input = stdin.readline
#print = stdout.write
letters = ascii_letters[:26]
ind = 0
bf = 0

for _ in range(int(input())):
    n = int(input())
    arr = list(map(int, input().split()))
    mx = max(arr) + 1
    print('a' * mx)
    last = list('a' * mx)
    ind = (ind + 1) % 26
    for i in range(0, n):
        last[arr[i]] = letters[ind]
        ind = (ind + 1) % 26
        print(''.join(last))


import math
from collections import deque
from sys import stdin, stdout
from string import ascii_letters
input = stdin.readline
#print = stdout.write
letters = ascii_letters[:26]
bf = 0

def prnt(txt):
    global bf
    if not len(txt):
        if bf:
            print('b')
        else:
            print('c')
        bf = (bf + 1) % 2
        return
    print(txt)

for _ in range(int(input())):
    n = int(input())
    arr = list(map(int, input().split()))
    prnt('a' * arr[0])
    for i in range(0, n):
        if i == n - 1:
            prnt('a' * arr[i])
            continue
        prnt('a' * max(arr[i], arr[i + 1]))


import math
from collections import deque
from sys import stdin, stdout
from string import ascii_letters
input = stdin.readline
#print = stdout.write
letters = ascii_letters[:26]
ind = 0
bf = 0

for _ in range(int(input())):
    n = int(input())
    arr = list(map(int, input().split()))
    mx = max(1, max(arr) + 1)
    print('a' * mx)
    last = 'a' * mx
    ind = (ind + 1) % 26
    for i in range(0, n):
        last = last[:arr[i]] + letters[ind] * (mx - arr[i])
        ind = (ind + 1) % 26
        print(last)


import math
from collections import deque
from sys import stdin, stdout
from string import ascii_letters
input = stdin.readline
#print = stdout.write
letters = ascii_letters[:26]
ind = 0
bf = 0

for _ in range(int(input())):
    n = int(input())
    arr = list(map(int, input().split()))
    mx = max(1, max(arr))
    print('a' * mx)
    last = 'a' * mx
    ind = (ind + 1) % 20
    for i in range(0, n):
        last = last[:arr[i]] + letters[ind] * (mx - arr[i])
        ind = (ind + 1) % 20
        print(last)


import math
from collections import deque
from sys import stdin, stdout
from string import ascii_letters
input = stdin.readline
#print = stdout.write
letters = ascii_letters[:26]
ind = 0
bf = 0

for _ in range(int(input())):
    n = int(input())
    arr = list(map(int, input().split()))
    mx = max(arr) + 10
    print('a' * mx)
    last = 'a' * mx
    ind = (ind + 1) % 20
    for i in range(0, n):
        last = last[:arr[i]] + letters[ind] * (mx - arr[i])
        ind = (ind + 1) % 20
        print(last)


import math
from collections import deque
from sys import stdin, stdout
from string import ascii_letters
input = stdin.readline
#print = stdout.write
letters = ascii_letters[:26]

for _ in range(int(input())):
    n = int(input())
    last = -1
    for i in map(int, input().split()):
        if last == -1:
            print('a' * i)
            last = 0
        print('a' * i)


import math
from collections import deque
from sys import stdin, stdout
from string import ascii_letters
input = stdin.readline
#print = stdout.write
letters = ascii_letters[:26]

for _ in range(int(input())):
    n = int(input())
    ind = 0
    arr = list(map(int, input().split()))
    mx = max(arr) + 1
    print(letters[ind] * mx)
    last = list(letters[ind] * mx)
    ind = (ind + 1) % 26
    for i in range(n):
        last[arr[i]] = letters[(letters.index(last[arr[i]]) + 1) % 26]
        print(''.join(last))


import math
from collections import deque
from sys import stdin, stdout
from string import ascii_letters
input = stdin.readline
#print = stdout.write
letters = ascii_letters[:26]

for _ in range(int(input())):
    n = int(input())
    ind = 0
    arr = list(map(int, input().split()))
    mx = max(arr) + 1
    print('a' * mx)
    last = list('a' * mx)
    ind = (ind + 1) % 27
    for i in range(0, n):
        last[arr[i]] = letters[ind]
        ind = (ind + 1) % 27
        print(''.join(last))


import math
from collections import deque
from sys import stdin, stdout
from string import ascii_letters
input = stdin.readline
#print = stdout.write
letters = ascii_letters[:26]
ind = 0
bf = 0

for _ in range(int(input())):
    n = int(input())
    arr = list(map(int, input().split()))
    print(letters[ind] * max(1, arr[0]))
    if arr[0] == 0:
        ind = (ind + 1) % 20
    for i in range(0, n):
        if arr[i] == 0:
            ind = (ind + 1) % 20
            print(letters[ind])
            continue
        if i == n - 1:
            print(letters[ind] * arr[i])
            continue
        print(letters[ind] * max(arr[i], arr[i + 1]))


import math
from collections import deque
from sys import stdin, stdout
from string import ascii_letters
input = stdin.readline
#print = stdout.write
letters = ascii_letters[:26]

for _ in range(int(input())):
    n = int(input())
    ind = 0
    arr = list(map(int, input().split()))
    mx = max(arr) + 1
    print(letters[ind] * mx)
    last = list(letters[ind] * mx)
    ind = (ind + 1) % 26
    for i in range(0, n):
        last[arr[i]] = letters[ind]
        ind = (ind + 1) % 26
        print(''.join(last))


a='abcde'*40
for itr in range(int(input())):
    n=int(input())
    arr=list(map(int,input().split()))
    ans=[a[:200]]
    for i in arr:
        ans.append((ans[-1][:i]+'z'+a)[:200])
    for ijk in ans:
        print(ijk)


for itr in range(int(input())):
    n=int(input())
    arr=list(map(int,input().split()))
    ans=['a'*200]
    flag=0
    for i in arr:
        if flag:
            ans.append((ans[-1][:i]+'x'+ans[0])[:199])
            flag=0
        else:
            flag=1
            ans.append((ans[-1][:i]+'y'+ans[0])[:199])
    for i in ans:
        print(i)


for itr in range(int(input())):
    n=int(input())
    arr=list(map(int,input().split()))
    ans=['a'*200]
    flag=0
    for i in arr:
        if ans[-1][i]=='y':
            ans.append((ans[-1][:i]+'x'+ans[0])[:199])
            flag=0
        else:
            flag=1
            ans.append((ans[-1][:i]+'y'+ans[0])[:199])
    for i in ans:
        print(i)


a='abcde'*40
for itr in range(int(input())):
    n=int(input())
    arr=list(map(int,input().split()))
    ans=[a[:200]]
    for i in arr:
        ans.append((ans[-1][:i]+'zyxlkfuiyopr'+a)[:200])
    for ijk in ans:
        print(ijk)


a='abcde'*40
b='mncjy'*40
for itr in range(int(input())):
    flag=0
    n=int(input())
    arr=list(map(int,input().split()))
    ans=[a[:200]]
    for i in arr:
        if i!=0:
            ans.append((ans[-1][:i]+'zyxlkfuiyopr'+a)[:200])
        elif flag==0:
            ans.append(b)
            flag=1
        else:
            ans.append(a)
            flag=0
    for ijk in ans:
        print(ijk)


t = int(input())
for _ in range(t):
    n = int(input())
    arr = [int(p) for p in input().split()]
    temp = list('a'*200)
    words = [''.join(temp)]
    for i in range(len(arr)):
        temp = list(words[-1])
        if temp[arr[i]] == 'a':
            temp[arr[i]] = 'b'
        else:
            temp[arr[i]] = 'a'
        words.append(''.join(temp))
    for i in words:
        print(i)


t = int(input())
for _ in range(t):
    n = int(input())
    arr = [int(p) for p in input().split()]
    m = max(arr)
    final = [0]*(n+1)
    for i in range(len(arr)):
       final[i] = max(final[i], arr[i])
       final[i+1] = max(final[i+1], arr[i])
    words = []
    for i in range(len(final)):
        if i % 2 == 0:
            temp = 'a'*final[i] + 'r'*(m - final[i])
        else:
            temp = 'a'*final[i] + 'p'*(m - final[i])
        words.append(temp)
    for i in words:
        print(i)


t = int(input())
for _ in range(t):
    n = int(input())
    arr = [int(p) for p in input().split()]
    m = max(arr)
    if m == 0:
        m = 1
    final = [0]*(n+1)
    for i in range(len(arr)):
       final[i] = max(final[i], arr[i])
       final[i+1] = max(final[i+1], arr[i])
    words = []
    for i in range(len(final)):
        if i % 2 == 0:
            temp = 'a'*final[i] + 'r'*(m - final[i])
        else:
            temp = 'a'*final[i] + 'p'*(m - final[i])
        words.append(temp)
    for i in words:
        print(i)


t = int(input())
for _ in range(t):
    n = int(input())
    arr = [int(p) for p in input().split()]
    m = max(arr)
    final = [0]*(n+1)
    for i in range(len(arr)):
       final[i] = max(final[i], arr[i])
       final[i+1] = max(final[i+1], arr[i])
    words = []
    for i in range(len(final)):
        if i % 2 == 0:
            temp = 'a'*final[i] + '$'*(m - final[i])
        else:
            temp = 'a'*final[i] + '&'*(m - final[i])
        words.append(temp)
    for i in words:
        print(i)


t = int(input())
for _ in range(t):
    n = int(input())
    arr = [int(p) for p in input().split()]
    temp = list('a'*200)
    print(temp)
    words = [''.join(temp)]
    for i in range(len(arr)):
        temp = list(words[-1])
        if temp[arr[i]] == 'a':
            temp[arr[i]] = 'b'
        else:
            temp[arr[i]] = 'a'
        words.append(''.join(temp))
    for i in words:
        print(i)


t = int(input())
for jack in range(t):
    n = int(input())
    a = list(map(int,input().split()))
    u = max(a)+1
    last = 'a'*a[0] + 'z'*(u-a[0])
    print(last)
    for i in range(n):
        v = chr(ord('a') + (ord(last[a[i]]) - ord('a') +1)%26)
        last = last[:a[i]] + v*(u-a[i])
        print(last)


t = int(input())
for jack in range(t):
    n = int(input())
    a = list(map(int,input().split()))
    u = max(a)+1
    last = 'a'*a[0] + 'z'*(u-a[0])
    print(last)
    k = 1
    for i in range(n):
        v = chr(ord('a') + (k%25) + 1)
        last = last[:a[i]] + v*(u-a[i])
        print(last)
        k += 1


t = int(input())
for jack in range(t):
    n = int(input())
    a = list(map(int,input().split()))
    print('a'*a[0]+'z')
    for i in range(n-1):
        print('a'*max(a[i],a[i+1]) + chr(ord('a')+(i%25)+1))
    print('a'*a[-1])


t = int(input())
for jack in range(t):
    n = int(input())
    a = list(map(int,input().split()))
    u = max(a)+1
    last = 'a'*a[0] + 'z'*(u-a[0])
    print(last)
    for i in range(n):
        v = chr(ord('a') + (ord(last[a[i]])+1)%26)
        last = last[:a[i]] + v*(u-a[i])
        print(last)


t = int(input())
for jack in range(t):
    n = int(input())
    a = list(map(int,input().split()))
    print('a'*a[0]+'z')
    for i in range(n-1):
        print('a'*max(a[i],a[i+1]) + chr(ord('a')+(i%25)+1))
    print('a'*a[-1] + chr(ord('a')+((n-1)%25)+1))


from string import ascii_lowercase as alph
import sys
def input():return sys.stdin.readline().rstrip()
for _ in range(int(input())):
    n=int(input())
    s=list(map(int,input().split()))
    symb=0
    p='a'*51
    print(p)
    for i in s:
        symb=(symb+1)%26
        ans=list('a'*51)
        ans[i]=alph[symb]
        print(''.join(ans))
        p=ans


for s in[*open(0)][2::2]:
    a=['a']*51;f='ab';print(''.join(a))
    for i in s.split():i=int(i);a[i]=f[1-f.index(a[i])];print(''.join(a))


#include<bits/stdc++.h>
using namespace std;
const int maxn = 400040;
struct edge{
	int u, v;
};
int n, d, k;
int halfd = 0;
int tot = 0;
int deg[maxn];
int dep[maxn];

vector<edge> ans;

queue<int> q;

inline void pre(){
	//cout<<q.size()<<endl;
	int u = q.front();
	q.pop();
	//cout<<q.front();
	int v = -1;
	if(!q.empty()){v = q.front();q.pop();}
	else v = u;
	dep[u] = dep[v] = 0;
	//cout<<u<<" "<<v<<endl;
	int tu = u;
	for(register int i = 1; i <= halfd; i ++){
		deg[tu]++;
		if(tu != u && deg[tu] < k && dep[tu] < halfd)q.push(tu);
		++tot;
		deg[tot]++;
		dep[tot] = dep[tu] + 1;
		ans.push_back((edge){tu, tot});
		tu = tot;
	}
	int tv = v;
	for(register int i = 1; i <= halfd; i ++){
		deg[tv]++;
		if(tv != v && deg[tv] < k && dep[tv] < halfd)q.push(tv);
		++tot;
		deg[tot]++;
		dep[tot] = dep[tv] + 1;
		ans.push_back((edge){tv, tot});
		tv = tot;
	}
	if(u != v){
		if(deg[u] != k){
			q.push(u);
			q.push(v);
		}
	}else{
		if(deg[u] != k){
			q.push(u);
		}
	}
}

inline void creat(){
	while(!q.empty()){
		int u = q.front();
		q.pop();
		if(dep[u] == halfd)continue;
		while(deg[u] < k){
			++tot;
			deg[u]++;
			deg[tot]++;
			dep[tot] = dep[u] + 1;
			q.push(tot);
			ans.push_back((edge){u, tot});
			if(tot == n)return ;
		}
	}
}

int main(){
	scanf("%d%d%d", &n, &d, &k);
	if(k == 1){//spj
		if(d >= 2){
			printf("NO\n");
			return 0;
		}
		if(n > 2){
			printf("NO\n");
			return 0;
		}
		printf("YES\n");
		if(n == 2){
			printf("1 2\n");
		}else if(n == 1){
			printf("1\n");
		}
		return 0;
	}
	halfd = d / 2;
	if(d & 1){
		tot = 2;
		deg[1] = deg[2] = 1;
		q.push(1);
		q.push(2);
		//printf("1 2\n");
		ans.push_back((edge){1, 2});
		pre();
	}else{
		tot = 1;
		deg[1] = 0;
		q.push(1);
		pre();
	}

	creat();
	if(tot != n){
		printf("NO\n");
		return 0;
	}else{
		printf("YES\n");
	}
	for(register int i = 0; i < (int)ans.size(); i ++){
		edge now = ans[i];
		printf("%d %d\n",now.u, now.v);
	}

	return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int maxn = 400040;
struct edge{
	int u, v;
};
int n, d, k;
int halfd = 0;
int tot = 0;
int deg[maxn];
int dep[maxn];

vector<edge> ans;

queue<int> q;

inline void pre(){
	//cout<<q.size()<<endl;
	int u = q.front();
	q.pop();
	//cout<<q.front();
	int v = -1;
	if(!q.empty()){v = q.front();q.pop();}
	else v = u;
	dep[u] = dep[v] = 0;
	//cout<<u<<" "<<v<<endl;
	int tu = u;
	for(register int i = 1; i <= halfd; i ++){
		deg[tu]++;
		if(tu != u && deg[tu] < k && dep[tu] < halfd)q.push(tu);
		++tot;
		deg[tot]++;
		dep[tot] = dep[tu] + 1;
		ans.push_back((edge){tu, tot});
		tu = tot;
	}
	int tv = v;
	for(register int i = 1; i <= halfd; i ++){
		deg[tv]++;
		if(tv != v && deg[tv] < k && dep[tv] < halfd)q.push(tv);
		++tot;
		deg[tot]++;
		dep[tot] = dep[tv] + 1;
		ans.push_back((edge){tv, tot});
		tv = tot;
	}
	if(u != v){
		if(deg[u] != k){
			q.push(u);
			q.push(v);
		}
	}else{
		if(deg[u] != k){
			q.push(u);
		}
	}
}

inline void creat(){
	while(!q.empty()){
		int u = q.front();
		q.pop();
		if(dep[u] == halfd)continue;
		while(deg[u] < k){
			++tot;
			deg[u]++;
			deg[tot]++;
			dep[tot] = dep[u] + 1;
			q.push(tot);
			ans.push_back((edge){u, tot});
			if(tot == n)return ;
		}
	}
}

int main(){
	scanf("%d%d%d", &n, &d, &k);
	if(k == 1){//spj
		if(d >= 2){
			printf("NO\n");
			return 0;
		}
		if(n > 2){
			printf("NO\n");
			return 0;
		}
		printf("YES\n");
		if(n == 2){
			printf("1 2\n");
		}else if(n == 1){
			printf("1\n");
		}
		return 0;
	}
	halfd = d / 2;
	if(d & 1){
		tot = 2;
		deg[1] = deg[2] = 1;
		q.push(1);
		q.push(2);
		//printf("1 2\n");
		ans.push_back((edge){1, 2});
		pre();
	}else{
		tot = 1;
		deg[1] = 0;
		q.push(1);
		pre();
	}
	//cout<<tot<<endl;
	if(tot == n){
		printf("YES\n");
		for(register int i = 0; i < (int)ans.size(); i ++){
			edge now = ans[i];
			printf("%d %d\n",now.u, now.v);
		}
		return 0;
	}

	creat();
	if(tot != n){
		printf("NO\n");
		return 0;
	}else{
		printf("YES\n");
	}
	for(register int i = 0; i < (int)ans.size(); i ++){
		edge now = ans[i];
		printf("%d %d\n",now.u, now.v);
	}

	return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int maxn = 400040;
struct edge{
	int u, v;
};
int n, d, k;
int halfd = 0;
int tot = 0;
int deg[maxn];
int dep[maxn];

vector<edge> ans;

queue<int> q;

inline void pre(){
	//cout<<q.size()<<endl;
	int u = q.front();
	q.pop();
	//cout<<q.front();
	int v = -1;
	if(!q.empty()){v = q.front();q.pop();}
	else v = u;
	dep[u] = dep[v] = 0;
	//cout<<u<<" "<<v<<endl;
	int tu = u;
	for(register int i = 1; i <= halfd; i ++){
		deg[tu]++;
		if(tu != u && deg[tu] < k && dep[tu] < halfd)q.push(tu);
		++tot;
		deg[tot]++;
		dep[tot] = dep[tu] + 1;
		ans.push_back((edge){tu, tot});
		tu = tot;
	}
	int tv = v;
	for(register int i = 1; i <= halfd; i ++){
		deg[tv]++;
		if(tv != v && deg[tv] < k && dep[tv] < halfd)q.push(tv);
		++tot;
		deg[tot]++;
		dep[tot] = dep[tv] + 1;
		ans.push_back((edge){tv, tot});
		tv = tot;
	}
	if(u != v){
		if(deg[u] != k){
			q.push(u);
			q.push(v);
		}
	}else{
		if(deg[u] != k){
			q.push(u);
		}
	}
}

inline void creat(){
	while(!q.empty()){
		int u = q.front();
		q.pop();
		if(dep[u] == halfd)continue;
		while(deg[u] < k){
			++tot;
			//cout<<tot<<endl;
			deg[u]++;
			deg[tot]++;
			dep[tot] = dep[u] + 1;
			q.push(tot);
			ans.push_back((edge){u, tot});
			if(tot >= n)return ;
		}
	}
}

int main(){
	scanf("%d%d%d", &n, &d, &k);
	if(n == 1){
		if(d >= 1){
			printf("NO\n");
			return 0;
		}
	}
	if(k == 1){//spj
		if(d >= 2){
			printf("NO\n");
			return 0;
		}
		if(n > 2){
			printf("NO\n");
			return 0;
		}
		printf("YES\n");
		if(n == 2){
			printf("1 2\n");
		}else if(n == 1){
			printf("1\n");
		}
		return 0;
	}
	halfd = d / 2;
	if(d & 1){
		tot = 2;
		deg[1] = deg[2] = 1;
		q.push(1);
		q.push(2);
		//printf("1 2\n");
		ans.push_back((edge){1, 2});
		pre();
	}else{
		tot = 1;
		deg[1] = 0;
		q.push(1);
		pre();
	}
	//cout<<tot<<endl;
	if(tot == n){
		printf("YES\n");
		for(register int i = 0; i < (int)ans.size(); i ++){
			edge now = ans[i];
			printf("%d %d\n",now.u, now.v);
		}
		return 0;
	}

	creat();
	if(tot != n){
		printf("NO\n");
		return 0;
	}else{
		printf("YES\n");
	}
	for(register int i = 0; i < (int)ans.size(); i ++){
		edge now = ans[i];
		printf("%d %d\n",now.u, now.v);
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int maxn = 400040;
struct edge{
	int u, v;
};
int n, d, k;
int halfd = 0;
int tot = 0;
int deg[maxn];
int dep[maxn];

vector<edge> ans;

queue<int> q;

inline void pre(){
	//cout<<q.size()<<endl;
	int u = q.front();
	q.pop();
	//cout<<q.front();
	int v = -1;
	if(!q.empty()){v = q.front();q.pop();}
	else v = u;
	dep[u] = dep[v] = 0;
	//cout<<u<<" "<<v<<endl;
	int tu = u;
	for(register int i = 1; i <= halfd; i ++){
		deg[tu]++;
		if(tu != u && deg[tu] < k && dep[tu] < halfd)q.push(tu);
		++tot;
		deg[tot]++;
		dep[tot] = dep[tu] + 1;
		ans.push_back((edge){tu, tot});
		tu = tot;
	}
	int tv = v;
	for(register int i = 1; i <= halfd; i ++){
		deg[tv]++;
		if(tv != v && deg[tv] < k && dep[tv] < halfd)q.push(tv);
		++tot;
		deg[tot]++;
		dep[tot] = dep[tv] + 1;
		ans.push_back((edge){tv, tot});
		tv = tot;
	}
	if(u != v){
		if(deg[u] != k){
			q.push(u);
			q.push(v);
		}
	}else{
		if(deg[u] != k){
			q.push(u);
		}
	}
}

inline void creat(){
	while(!q.empty()){
		int u = q.front();
		q.pop();
		if(dep[u] == halfd)continue;
		while(deg[u] < k){
			++tot;
			deg[u]++;
			deg[tot]++;
			dep[tot] = dep[u] + 1;
			q.push(tot);
			ans.push_back((edge){u, tot});
			if(tot == n)return ;
		}
	}
}

int main(){
	scanf("%d%d%d", &n, &d, &k);
	if(n == 1){
		if(d >= 1){
			printf("NO\n");
			return 0;
		}
	}
	if(k == 1){//spj
		if(d >= 2){
			printf("NO\n");
			return 0;
		}
		if(n > 2){
			printf("NO\n");
			return 0;
		}
		printf("YES\n");
		if(n == 2){
			printf("1 2\n");
		}else if(n == 1){
			printf("1\n");
		}
		return 0;
	}
	halfd = d / 2;
	if(d & 1){
		tot = 2;
		deg[1] = deg[2] = 1;
		q.push(1);
		q.push(2);
		//printf("1 2\n");
		ans.push_back((edge){1, 2});
		pre();
	}else{
		tot = 1;
		deg[1] = 0;
		q.push(1);
		pre();
	}
	//cout<<tot<<endl;
	if(tot == n){
		printf("YES\n");
		for(register int i = 0; i < (int)ans.size(); i ++){
			edge now = ans[i];
			printf("%d %d\n",now.u, now.v);
		}
		return 0;
	}

	creat();
	if(tot != n){
		printf("NO\n");
		return 0;
	}else{
		printf("YES\n");
	}
	for(register int i = 0; i < (int)ans.size(); i ++){
		edge now = ans[i];
		printf("%d %d\n",now.u, now.v);
	}

	return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int maxn = 400040;
struct edge{
	int u, v;
};
int n, d, k;
int halfd = 0;
int tot = 0;
int deg[maxn];
int dep[maxn];

vector<edge> ans;

queue<int> q;

inline void pre(){
	//cout<<q.size()<<endl;
	int u = q.front();
	q.pop();
	//cout<<q.front();
	int v = -1;
	if(!q.empty()){v = q.front();q.pop();}
	else v = u;
	dep[u] = dep[v] = 0;
	//cout<<u<<" "<<v<<endl;
	int tu = u;
	for(register int i = 1; i <= halfd; i ++){
		deg[tu]++;
		if(tu != u && deg[tu] < k && dep[tu] < halfd)q.push(tu);
		++tot;
		deg[tot]++;
		dep[tot] = dep[tu] + 1;
		ans.push_back((edge){tu, tot});
		tu = tot;
	}
	int tv = v;
	for(register int i = 1; i <= halfd; i ++){
		deg[tv]++;
		if(tv != v && deg[tv] < k && dep[tv] < halfd)q.push(tv);
		++tot;
		deg[tot]++;
		dep[tot] = dep[tv] + 1;
		ans.push_back((edge){tv, tot});
		tv = tot;
	}
	if(u != v){
		if(deg[u] != k){
			q.push(u);
			q.push(v);
		}
	}else{
		if(deg[u] != k){
			q.push(u);
		}
	}
}

inline void creat(){
	while(!q.empty()){
		int u = q.front();
		q.pop();
		if(dep[u] == halfd)continue;
		while(deg[u] < k){
			++tot;
			//cout<<tot<<endl;
			deg[u]++;
			deg[tot]++;
			dep[tot] = dep[u] + 1;
			q.push(tot);
			ans.push_back((edge){u, tot});
			if(tot >= n)return ;
		}
	}
}

int main(){
	scanf("%d%d%d", &n, &d, &k);
	if(n == 1){
		if(d >= 1){
			printf("NO\n");
			return 0;
		}
	}
	if(k == 1){//spj
		if(d >= 2){
			printf("NO\n");
			return 0;
		}
		if(n > 2){
			printf("NO\n");
			return 0;
		}
		printf("YES\n");
		if(n == 2){
			printf("1 2\n");
		}else if(n == 1){
			printf("1\n");
		}
		return 0;
	}
	halfd = d / 2;
	if(d & 1){
		tot = 2;
		deg[1] = deg[2] = 1;
		q.push(1);
		q.push(2);
		//printf("1 2\n");
		ans.push_back((edge){1, 2});
		pre();
	}else{
		tot = 1;
		deg[1] = 0;
		q.push(1);
		pre();
	}
	//cout<<tot<<endl;
	if(tot == n){
		printf("YES\n");
		for(register int i = 0; i < (int)ans.size(); i ++){
			edge now = ans[i];
			printf("%d %d\n",now.u, now.v);
		}
		return 0;
	}

	creat();
	if(tot != n){
		printf("NO\n");
		return 0;
	}else{
		printf("YES\n");
	}
	for(register int i = 0; i < (int)ans.size(); i ++){
		edge now = ans[i];
		printf("%d %d\n",now.u, now.v);
	}

	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int n,d,k;
const int LM=400003;
//정점의 개수, 트리의 지름, 트리의 차수
int p[LM];
int h[LM],cnt[LM];
queue<int> q; //비용, 정점
int main(){
    int i,j;
    scanf("%d %d %d",&n,&d,&k);
    for(i=1;i<=d;i++){
        p[i+1]=i;
        h[i]=min(n-i,i-1);
    }
    cnt[1]=cnt[d+1]=1;
    for(i=2;i<=d;i++){
        q.push(i);
        cnt[i]=2;
    }
    i=d+2;
    while(!q.empty() && i<=n){
        while(cnt[q.front()]==k) q.pop();
        p[i]=q.front();
        cnt[q.front()]++;
        cnt[i]++;
        h[i]=h[q.front()]-1;
        if(h[i]) q.push(i);
        i++;
    }
    if(i==n+1){
        puts("YES");
        for(i=1;i<=n;i++){
            if(p[i]) printf("%d %d\n",i,p[i]);
        }
    }
    else puts("NO");
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
int n,d,k,con[400003];
deque<pii> q;
vector<pii> ans,temp;
int main(){
    int i,j;
    scanf("%d %d %d",&n,&d,&k);
    for(i=0;i<d;i++){
        ans.push_back(pii(i,i+1));
        ++con[i],++con[i+1];
        temp.push_back(pii(max(i,d-i),i));
    }
    sort(temp.begin(),temp.end());
    for(pii i : temp) q.push_back(i);
    for(i=d+1;i<n;i++){
        while(!q.empty() && con[q.front().second]==k) q.pop_front();
        if(q.front().first>=d){printf("NO"); return 0;}
        ++con[q.front().second],++con[i];
        q.push_back(pii(q.front().first+1,i));
        ans.push_back(pii(i,q.front().second));
    }
    for(pii i : ans) printf("%d %d\n",i.first+1,i.second+1);
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
#endif

	int n, d, k;
	cin >> n >> d >> k;

	if (d >= n) {
		cout << "NO" << endl;
		return 0;
	}

	vector<int> deg(n);
	vector<pair<int, int>> ans;
	set<pair<int, int>> q;

	for (int i = 0; i < d; ++i) {
		++deg[i];
		++deg[i + 1];
		if (deg[i] > k || deg[i + 1] > k) {
			cout << "NO" << endl;
			return 0;
		}
		ans.push_back(make_pair(i, i + 1));
	}
	for (int i = 1; i < d; ++i)
		q.insert(make_pair(max(i, d - i), i));

	for (int i = d + 1; i < n; ++i) {
		while (!q.empty() && deg[q.begin()->second] == k)
			q.erase(q.begin());
		if (q.empty() || q.begin()->first == d) {
			cout << "NO" << endl;
			return 0;
		}
		++deg[i];
		++deg[q.begin()->second];
		ans.push_back(make_pair(i, q.begin()->second));
		q.insert(make_pair(q.begin()->first + 1, i));
	}

	assert(int(ans.size()) == n - 1);
	cout << "YES" << endl;
	vector<int> p(n);
	for (int i = 0; i < n; i++)
	    p[i] = i;
	random_shuffle(p.begin(), p.end());
	for (int i = 0; i < n - 1; ++i)
	    if (rand() % 2)
		    cout << p[ans[i].first] + 1 << " " << p[ans[i].second] + 1 << endl;
		else
		    cout << p[ans[i].second] + 1 << " " << p[ans[i].first] + 1 << endl;

	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int n,d,k;
const int LM=400003;
//정점의 개수, 트리의 지름, 트리의 차수
int p[LM];
int h[LM],cnt[LM];
queue<int> q; //비용, 정점
int main(){
    int i,j;
    scanf("%d %d %d",&n,&d,&k);
    for(i=1;i<=d;i++){
        p[i+1]=i;
        h[i]=min(n-i,i-1);
    }
    cnt[1]=cnt[d+1]=1;
    for(i=2;i<=d;i++){
        q.push(i);
        cnt[i]=2;
    }
    i=d+2;
    while(!q.empty() && i<=n){
        while(cnt[q.front()]==k+1) q.pop();
        p[i]=q.front();
        cnt[q.front()]++;
        cnt[i]++;
        h[i]=h[q.front()]-1;
        if(h[i]) q.push(i);
        i++;
    }
    if(i==n+1){
        puts("YES");
        for(i=1;i<=n;i++){
            if(p[i]) printf("%d %d\n",i,p[i]);
        }
    }
    else puts("NO");
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int n,d,k;
const int LM=400003;
//정점의 개수, 트리의 지름, 트리의 차수
int p[LM];
int h[LM],cnt[LM];
queue<int> q; //비용, 정점
int main(){
    int i,j;
    scanf("%d %d %d",&n,&d,&k);
    for(i=1;i<=d;i++){
        p[i+1]=i;
        h[i]=min(n-i,i-1);
    }
    cnt[1]=cnt[d+1]=1;
    for(i=2;i<=d;i++){
        q.push(i);
        cnt[i]=2;
    }
    i=d+2;
    while(!q.empty() && i<=n){
        while(cnt[q.front()]>=k) q.pop();
        p[i]=q.front();
        cnt[q.front()]++;
        cnt[i]++;
        h[i]=h[q.front()]-1;
        if(h[i]) q.push(i);
        i++;
    }
    if(i==n+1){
        puts("YES");
        for(i=1;i<=n;i++){
            if(p[i]) printf("%d %d\n",i,p[i]);
        }
    }
    else puts("NO");
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
#define X first
#define Y second
int n,d,k;
const int LM=400003;
//정점의 개수, 트리의 지름, 트리의 차수
int p[LM];
int h[LM],cnt[LM];
priority_queue<pii, vector<pii>, less<pii> > q; //비용, 정점
int main(){
    int i,j;
    scanf("%d %d %d",&n,&d,&k);
    for(i=1;i<=d;i++){
        p[i+1]=i;
        h[i]=min(d-i,i-1);
    }
    cnt[1]=cnt[d+1]=1;
    for(i=2;i<=d;i++){
        q.push(pii(h[i],i));
        cnt[i]=2;
    }
    i=d+2;
    while(!q.empty() && i<=n){
        while(cnt[q.top().Y]==k+1) q.pop();
        p[i]=q.top().Y;
        cnt[q.top().Y]++;
        cnt[i]++;
        h[i]=h[q.top().Y]-1;
        if(h[i]) q.push(pii(h[i], i));
        i++;
    }
    if(i==n+1){
        puts("YES");
        for(i=1;i<=n;i++){
            if(p[i]) printf("%d %d\n",i,p[i]);
        }
    }
    else puts("NO");
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
int n,d,k,con[400003];
deque<pii> q;
vector<pii> ans,temp;
int main(){
    int i,j;
    scanf("%d %d %d",&n,&d,&k);
    for(i=0;i<d;i++){
        ans.push_back(pii(i,i+1));
        ++con[i],++con[i+1];
        temp.push_back(pii(max(i,d-i),i));
    }
    sort(temp.begin(),temp.end());
    for(pii i : temp) q.push_back(i);
    for(i=d+1;i<n;i++){
        while(!q.empty() && con[q.front().second]==k) q.pop_front();
        if(q.front().first>=d){printf("NO"); return 0;}
        ++con[q.front().second],++con[i];
        q.push_back(pii(q.front().first+1,i));
        ans.push_back(pii(i,q.front().second));
    }
    puts("YES");
    for(pii i : ans) printf("%d %d\n",i.first+1,i.second+1);
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int n,d,k,flag;
const int LM=400003;
//정점의 개수, 트리의 지름, 트리의 차수
int p[LM];
int h[LM],cnt[LM];
queue<int> q; //비용, 정점
int am(int a, int b){return abs(a-b);}
int main(){
    int i,j;
    scanf("%d %d %d",&n,&d,&k);
    for(i=1;i<=d/2+1;i++){
        h[i]=i-1;
    }
    if(d&1) {
        h[i]=h[i-1];i++;
    }
    for(;i<=d+1;i++){
        h[i]=h[i-1]-1;
    }
    for(i=2;i<=d;i++) {
        q.push(i);
        p[i]=i-1;
    }
    p[d+1]=d;
    for(i=2;i<=d;i++) cnt[i]=2;
    cnt[1]=cnt[d+1]=1;
    i=d+2;
    while(!q.empty() && i<=n){
        while(!q.empty() && cnt[q.front()]>=k){q.pop();flag=1;}
        if(q.empty()) break;
        p[i]=q.front();
        cnt[q.front()]++;
        cnt[i]++;
        h[i]=h[q.front()]-1;
        if(h[i]) q.push(i);
        i++;
    }
    ///차수 학인을 하는 것을 해야 함
    if(i==n+1 && flag){
        puts("YES");
        for(i=1;i<=n;i++){
            if(p[i]) printf("%d %d\n",i,p[i]);
        }
    }
    else puts("NO");
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int n,d,k;
const int LM=400003;
//정점의 개수, 트리의 지름, 트리의 차수
int p[LM];
int h[LM],cnt[LM];
queue<int> q; //비용, 정점
int main(){
    int i,j;
    scanf("%d %d %d",&n,&d,&k);
    for(i=1;i<=d;i++){
        p[i+1]=i;
        h[i]=min(abs(n/2-i),abs(i-n/2));
    }
    cnt[1]=cnt[d+1]=1;
    for(i=2;i<=d;i++){
        q.push(i);
        cnt[i]=2;
    }
    i=d+2;
    while(!q.empty() && i<=n){
        while(!q.empty() && cnt[q.front()]>=k) q.pop();
        if(q.empty()) break;
        p[i]=q.front();
        cnt[q.front()]++;
        cnt[i]++;
        h[i]=h[q.front()]+1;
        if(h[i]<d) q.push(i);
        i++;
    }
    if(i==n+1){
        puts("YES");
        for(i=1;i<=n;i++){
            if(p[i]) printf("%d %d\n",i,p[i]);
        }
    }
    else puts("NO");
    return 0;
}


# include <bits/stdc++.h>
using namespace std;

const int MAXN=400000+5;
int n,d,k,cnt,ban;
typedef pair<int,int> P;
vector<P> V;

void dfs(int u,int step,int e){
	if(cnt>=n||step>=ban) return;
	for(int i=1;i<=e;i++){
		V.push_back(make_pair(u,cnt+1));cnt+=1;
		dfs(cnt,step+1,k-1);
	}
}

int main(){
	scanf("%d%d%d",&n,&d,&k);
	for(int i=1;i<=d;i++){
		V.push_back(make_pair(i,i+1));
	}
	if(d&1){
		int e=k-2;cnt=d+1;ban=d/2;
		for(int i=(d+1)/2+1;i<=d+1;i++)
			e+=(i==(d+1)),dfs(i,i-((d+1)/2+1),e);
		e=k-2;
		for(int i=(d+1)/2;i>0;i--)
			e+=(i==1),dfs(i,(d+1)/2-i,e);
	}
	else {
		int e=k-2;cnt=d+1;ban=d/2;
		for(int i=(d+1)/2+1;i<=d+1;i++)
			e+=(i==d+1),dfs(i,i-(d+1)/2-1,e);
		e=k-2;
		for(int i=(d+1)/2;i>0;i--)
			e+=(i==1),dfs(i,(d+1)/2-i+1,e);
	}
	if(cnt<n||n<=d) printf("NO\n");
	else {
		printf("YES\n");
		for(int i=0;i<n-1;i++){
			printf("%d %d\n",V[i].first,V[i].second);
		}
	}
	return 0;
}