You are given two integers $n$ and $k$.

Your task is to construct such a string $s$ of length $n$ that for each $i$ from $1$ to $k$ there is at least one $i$-th letter of the Latin alphabet in this string (the first letter is 'a', the second is 'b' and so on) and there are no other letters except these. You have to maximize the minimal frequency of some letter (the frequency of a letter is the number of occurrences of this letter in a string). If there are several possible answers, you can print any.

You have to answer $t$ independent queries.


-----Input-----

The first line of the input contains one integer $t$ ($1 \le t \le 100$) — the number of queries.

The next $t$ lines are contain queries, one per line. The $i$-th line contains two integers $n_i$ and $k_i$ ($1 \le n_i \le 100, 1 \le k_i \le min(n_i, 26)$) — the length of the string in the $i$-th query and the number of characters in the $i$-th query.


-----Output-----

Print $t$ lines. In the $i$-th line print the answer to the $i$-th query: any string $s_i$ satisfying the conditions in the problem statement with constraints from the $i$-th query.


-----Example-----
Input
3
7 3
4 4
6 2

Output
cbcacab
abcd
baabab



-----Note-----

In the first example query the maximum possible minimal frequency is $2$, it can be easily seen that the better answer doesn't exist. Other examples of correct answers: "cbcabba", "ccbbaaa" (any permutation of given answers is also correct).

In the second example query any permutation of first four letters is acceptable (the maximum minimal frequency is $1$).

In the third example query any permutation of the given answer is acceptable (the maximum minimal frequency is $3$).

Difficulty: EASY
Tags: Implementation

Starter code:

Solutions:
t = int(input())
al = 'abcdefghijklmnopqrstuvwxyz'
for i in range(t):
	(n, k) = list(map(int, input().split()))
	l = n // k
	s = al[:k] * l
	s += al[:n % k]
	print(s)


for i in range(int(input())):
	(n, k) = map(int, input().split())
	t = n // k
	l = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
	s = ''
	v = ''
	flag = 0
	if n % k != 0:
		flag = 1
	for jj in range(k):
		if flag == 0:
			s = s + l[jj] * t
		else:
			s = s + l[jj] * t
			if jj == k - 1:
				s = s + l[jj] * (n % k)
	print(s)


n = int(input())
for i in range(n):
	str_ = input()
	str_ = str_.split(' ')
	a = int(str_[0])
	b = int(str_[1])
	for j in range(a):
		tmp = j % b
		ans = chr(ord('a') + tmp)
		print(ans, end='')
	print()


s = 'abcdefghijklmnopqrstuvwxyz'
for _ in range(int(input())):
	(n, k) = list(map(int, input().strip().split()))
	q = n // k
	rem = n % k
	print(s[:k] * q + s[:rem])


t = int(input())
s = [chr(x) for x in range(ord('a'), ord('z') + 1, 1)]
for i in range(t):
	(n, k) = [int(x) for x in input().split()]
	for j in range(n):
		print(s[j % k], end='')
	print()


for t in range(int(input())):
	(n, k) = map(int, input().split(' '))
	s = ''
	for i in range(k):
		s += chr(97 + i)
	s = s * (n // k)
	for i in range(n % k):
		s += chr(97 + i)
	print(s)


t = int(input())
p = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
ans = ''
for i in range(t):
	(n, k) = map(int, input().split())
	for l in range(n // k):
		for j in range(k):
			ans += p[j]
	for lm in range(n - n // k * k):
		ans += p[0]
	print(ans)
	ans = ''


from sys import stdin, stdout
for _ in range(int(input())):
	(n, k) = map(int, stdin.readline().split())
	w = []
	s = 97
	t = 0
	for i in range(n):
		w.append(chr(s + t % k))
		t += 1
	print(''.join(w))


t = int(input())
for z in range(t):
	[n, k] = [int(i) for i in input().split()]
	isOdd = n % 2 == 0
	minimalFreq = n // k
	s = []
	i = 0
	for i in range(k):
		s = s + [chr(i + 97)] * minimalFreq
	i = (i + 1) * minimalFreq
	while i < n:
		s = s + [chr(97)]
		i += 1
	print(''.join(s))


import string
n = int(input())
for q in range(n):
	[z, x] = map(int, input().split())
	a = list(string.ascii_lowercase)
	s = ''
	while z > 0:
		for i in range(min(x, z)):
			s = s + a[i]
			z = z - 1
	print(s)


a = int(input())
b = []
col = 'abcdefghijklmnopqrstuvwxyz'
for i in range(a):
	c = [int(x) for x in input().split()]
	b.append(c)
for i in b:
	x = i[0]
	y = i[1]
	print(col[:y] * (x // y) + col[:x % y])


t = int(input())
for i in range(t):
	(n, a) = list(map(int, input().split()))
	te = ''
	ans = ['y']
	c = 1
	while True:
		if c * a > n:
			break
		else:
			c += 1
	c -= 1
	for m in range(97, 97 + a):
		te += chr(m) * c
	for i in range(n - a * c):
		te += 'a'
	print(te)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	for i in range(n):
		print(chr(97 + i % k), end='')
	print()


k = int(input())
s = 'abcdefghijklmnopqrstuvwxyz'
for i in range(k):
	(m, n) = list(map(int, input().split()))
	if n > m:
		print(s[:m])
	else:
		print(s[:n] * (m // n) + s[:m % n])


class CodeforcesTask1092ASolution:

	def __init__(self):
		self.result = ''
		self.t = 0
		self.queries = []

	def read_input(self):
		self.t = int(input())
		for x in range(self.t):
			self.queries.append([int(y) for y in input().split(' ')])

	def process_task(self):
		results = []
		alphabet = 'abcdefghijklmnopqrstuvwxyz'
		for query in self.queries:
			r = alphabet[:query[1]] * (query[0] // query[1]) + alphabet[:query[0] % query[1]]
			results.append(r)
		self.result = '\n'.join(results)

	def get_result(self):
		return self.result
Solution = CodeforcesTask1092ASolution()
Solution.read_input()
Solution.process_task()
print(Solution.get_result())


t = int(input())
answer = []
for i in range(0, t):
	(n, k) = [int(x) for x in input().split()]
	s = ''
	for j in range(0, n):
		s += chr(97 + j % k)
	answer.append(s)
for x in answer:
	print(x)


for i in range(int(input())):
	(n, k) = map(int, input().split())
	ans = ''
	for j in range(n):
		ans += chr(j % k + 97)
	print(ans)


testcases = int(input())
alpha = 'abcdefghijklmnopqrstuvwxyz'
for i in range(testcases):
	(n, k) = map(int, input().split())
	s = ''
	while len(s) < n:
		s = s + alpha[0:k]
	print(s[0:n])


t = int(input())
while t > 0:
	(n, k) = map(int, input().split())
	a = int(n / k)
	s = 'abcdefghijklmnopqrstuvwxyz'
	(i, c) = (0, 0)
	p = ''
	while i < k:
		p += s[i] * a
		i += 1
	p += s[k - 1] * (n % k)
	print(p)
	t -= 1


queryCount = int(input())
alpha = 'abcdefghijklmnopqrstuvwxyz'
for i in range(queryCount):
	n_k = list(map(int, input().split()))
	n = n_k[0]
	k = n_k[1]
	ans = ''
	for j in range(n):
		ans = ans + alpha[j % k]
	print(ans)


import sys
t = int(input())
for i in range(t):
	(n, k) = map(int, sys.stdin.readline().split())
	s = ''
	for a in range(n):
		s += chr(ord('a') + a % k)
	print(s)


tc = int(input())
for _ in range(tc):
	(a, b) = map(int, input().split(' '))
	r = []
	for l in range(0, b):
		r.append(chr(ord('a') + l))
	maxi = a // b
	ans = ''
	for l in r:
		ans += l * maxi
	rem = a % b
	ans += l[0] * rem
	print(ans)


t = int(input())
for i in range(t):
	inp = input().split()
	n = int(inp[0])
	k = int(inp[1])
	string = ''
	if n == k:
		for i in range(k):
			string += chr(97 + i)
	elif n % k == 0 and n != k:
		for j in range(int(n / k)):
			for i in range(k):
				string += chr(97 + i)
	else:
		for i in range(k):
			string += chr(97 + i) * int(n / k)
		for i in range(n - len(string)):
			string += chr(97)
	print(string)


import string
N = int(input())
S = list(string.ascii_lowercase)
for i in range(N):
	A = []
	(n, k) = [int(i) for i in input().split()]
	count = 0
	while True:
		for l in range(k):
			A.append(S[l])
			count += 1
			if count == n:
				break
		if count == n:
			break
	print(*A, sep='', end='\n')


t = int(input())
char_dict = {i: j for (i, j) in zip(list(range(26)), 'abcdefghijklmnopqrstuvwxyz')}
for kdfjs in range(t):
	(n, k) = map(int, input().split())
	a = n // k
	b = n / k
	l = int((b - a) * k)
	s = ''
	for i in range(k):
		for j in range(a):
			s += char_dict[i]
		if i < l:
			s += char_dict[i]
	if len(s) < n:
		s += char_dict[l]
	print(s)


list1 = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	c = int(n / k)
	list2 = list1[:k]
	str1 = ''
	for i in list2:
		g = i * c
		str1 = str1 + g
	if len(str1) < n:
		f = 'a' * (n - len(str1))
		str1 = str1 + f
	print(str1)


n = int(input())
l = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
for i in range(0, n):
	p = input().rstrip().split(' ')
	a = int(p[0])
	b = int(p[1])
	c = a // b
	d = a % b
	q = []
	e = d + c
	flag = 0
	T = a - d
	while T != 0:
		for j in range(0, len(l)):
			for k in range(0, c):
				q.append(l[j])
				T -= 1
				if T == 0:
					flag = 1
					break
			if flag == 1:
				break
	flag = 0
	while d != 0:
		j = 0
		while j < len(l):
			q.append(l[j])
			d -= 1
			if d == 0:
				flag = 1
				break
			j += 1
	C = ''.join(q)
	print(C)


T = int(input())
alpha = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
for t in range(T):
	l = []
	s = []
	(n, k) = map(int, input().split())
	for i in range(k):
		l.append(alpha[i])
	l = l * (n // k)
	s = l
	for i in range(n % k):
		s.append(alpha[i])
	print(*s, sep='', end='\n')


N = int(input())
List = list('abcdefghijklmnopqrstuvwxyz')
for i in range(N):
	X = list(map(int, input().split()))
	Tedad = int(X[0] / X[1])
	for j in range(X[1]):
		if j == X[1] - 1:
			print(List[j] * X[0])
		else:
			print(List[j] * Tedad, end='')
			X[0] -= Tedad


from string import ascii_lowercase as ascii
xx = int(input())
for _ in range(xx):
	(n, k) = map(int, input().split())
	alphabet = ascii[0:k]
	koff = n // k
	result = alphabet * koff
	id = 0
	while len(result) < n:
		if id == k - 1:
			id = 0
		result += alphabet[id]
		id += 1
	print(result)


nn = int(input())
v = ' abcdefghijklmnopqrstuvwxyz'
for i in range(nn):
	(n, k) = [int(i) for i in input().split()]
	c = 1
	p = 1
	while c <= n:
		if p > k:
			p = 1
		print(v[p], end='')
		p += 1
		c += 1
	print()


n = int(input())
s = list('abcdefghijklmnopqrstuvwxyz')
for i in range(n):
	(a, b) = map(int, input().split())
	k = a // b
	c = a % b
	for j in range(b):
		print(s[j] * k, end='')
	for j in range(c):
		print(s[j], end='')
	print('')


def calculate(length, variety):
	alphabet = 'abcdefghijklmnopqrstuvwxyz'
	output = ''
	for i in range(0, length):
		output = output + alphabet[i % variety]
	return output

def load():
	t = int(input())
	for i in range(t):
		(length, variety) = map(int, input().split())
		print(calculate(length, variety))
load()


def qwe(n, k):
	a = [chr(i) for i in range(97, 97 + int(k))]
	s = a * int(n)
	s = s[:int(n)]
	print(''.join([str(i) for i in s]))
	return 0
t = int(input())
for i in range(t):
	(n, k) = input().split()
	qwe(n, k)


t = int(input())
for i in range(t):
	(n, k) = input().split(' ')
	n = int(n)
	k = int(k)
	res = []
	y = 97
	for i in range(n):
		res.append(y + i % k)
	print(''.join([chr(e) for e in res]))


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	start = ord('a')
	for i in range(a):
		print(chr(start + i % b), end='')
	print()


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	m = n // k
	l = 97
	for i in range(m):
		l = 97
		for j in range(k):
			print(chr(l), end='')
			l += 1
			n -= 1
	l = 97
	while n != 0:
		print(chr(l), end='')
		n -= 1
		l += 1
	print()


r = int(input())
n = list()
k = list()
count = 0
for i in range(r):
	(a, b) = map(int, input().split())
	n.append(a)
	k.append(b)
for x in range(r):
	while count < n[x]:
		for j in range(k[x]):
			print(chr(j + 97), end='')
			count += 1
			if count == n[x]:
				break
	count = 0
	print()


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	print(''.join(map(lambda i: chr(ord('a') + i % k), range(n))))


n = int(input())
for i in range(n):
	(a, b) = list(map(int, input().split()))
	c = 0
	st = []
	for j in range(a):
		s = c + ord('a')
		st.append(chr(s))
		c = (c + 1) % b
	for k in range(len(st)):
		print(st[k], end='')
	print('\n')
	a = []


T = int(input())
while True:
	s = ''
	if T == 0:
		break
	T = T - 1
	(a, b) = map(int, input().split())
	for i in range(b):
		for j in range(a // b):
			s += chr(ord('a') + i)
	for i in range(a % b):
		s += 'a'
	print(s)


l = 'abcdefghijklmnopqrstuvwxyz'
a = int(input())
for i in range(a):
	(n, m) = map(int, input().split())
	for i in range(n):
		print(l[i % m], end='')
	print()


count = int(input())
flag = 0
while flag < count:
	out = ''
	inp = input().split()
	strlen = int(inp[0])
	letter = int(inp[1])
	minfre = int(strlen / letter)
	i = 0
	while i < strlen:
		j = 0
		while j < letter:
			out += chr(ord('a') + j)
			if i == strlen - 1:
				i += 1
				break
			j += 1
			i += 1
	print(out)
	flag += 1


t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	l = []
	for i in range(m):
		l.append(chr(97 + i))
	p = n // m
	q = n % m
	print(''.join(map(str, p * l + l[:q])))


q = int(input())
for i in range(q):
	(n, k) = map(int, input().split())
	t = ''
	for j in range(n):
		t += chr(j % k + ord('a'))
	print(t)


case = int(input())
for i in range(case):
	line = input().split(' ')
	length = int(line[0])
	k = int(line[1])
	string = ''
	a = 97
	temp = 0
	for i in range(length):
		if temp % k == 0:
			a = 97
		string += chr(a)
		a += 1
		temp += 1
	print(string)


def A():
	alphabet = 'abcdefghijklmnopqrstuvwxyz'
	t = int(input())
	s = []
	for i in range(t):
		nk = input().split()
		(n, k) = (int(nk[0]), int(nk[1]))
		s_i = ''
		for i in range(n):
			s_i += alphabet[i % k]
		s.append(s_i)
	for s_i in s:
		print(s_i)
A()


t = int(input())
while t > 0:
	(n, k) = map(int, input().split())
	list1 = []
	arr = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
	i = 0
	if k >= n:
		while i < n:
			list1.append(arr[i])
			i += 1
		string = ''.join(list1)
	else:
		list2 = []
		for i in range(k):
			list2.append(arr[i])
		stringg = ''.join(list2)
		for i in range(0, n, k):
			list1.append(stringg)
		st = ''.join(list1)
		val = len(st) - n
		list2 = []
		for i in range(len(st) - val):
			list2.append(st[i])
		string = ''.join(list2)
	print(string)
	t -= 1


q = int(input())
for qq in range(q):
	s = ''
	(n, k) = map(int, input().split())
	c = 0
	for i in range(n):
		s += chr(97 + c % k)
		c += 1
	print(s)


from bisect import bisect_left as bs
log = lambda *x: print(*x)

def cin(*fn, def_fn=str):
	(i, r) = (0, [])
	if fn:
		def_fn = fn[0]
	for c in input().split(' '):
		r += [(fn[i] if len(fn) > i else def_fn)(c)]
		i += 1
	return r
INF = 6 << 20
az = '-abcdefghijklmnopqrstuvwxyz'

def solve(n, k, s='', l=1):
	for i in range(n):
		s += az[l]
		l = (l + 1) % (k + 1)
		l += l == 0
	return s
(q,) = cin(int)
for i in range(q):
	(n, k) = cin(int)
	log(solve(n, k))


from bisect import bisect_right as br
from bisect import bisect_left as bl
from collections import defaultdict
from itertools import combinations
import sys
import math
MAX = sys.maxsize
MAXN = 10 ** 6 + 10
MOD = 998244353

def isprime(n):
	n = abs(int(n))
	if n < 2:
		return False
	if n == 2:
		return True
	if not n & 1:
		return False
	for x in range(3, int(n ** 0.5) + 1, 2):
		if n % x == 0:
			return False
	return True

def mhd(a, b, x, y):
	return abs(a - x) + abs(b - y)

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

def charIN():
	return sys.stdin.readline().strip().split()
t = [(-1, -1)] * 1000010

def create(a):
	nonlocal t, n
	for i in range(n, 2 * n):
		t[i] = (a[i - n], i - n)
	for i in range(n - 1, 0, -1):
		x = [t[2 * i], t[2 * i + 1]]
		x.sort(key=lambda x: x[0])
		t[i] = x[1]

def update(idx, value):
	nonlocal t, n
	idx = idx + n
	t[idx] = value
	while idx > 1:
		idx = idx // 2
		x = [t[2 * idx], t[2 * idx + 1]]
		x.sort(key=lambda x: x[0])
		t[idx] = x[1]

def dis(a, b, k):
	ans = 0
	for i in range(k):
		ans += abs(a[i] - b[i])
	return ans

def cal(n, k):
	res = 1
	c = [0] * (k + 1)
	c[0] = 1
	for i in range(1, n + 1):
		for j in range(min(i, k), 0, -1):
			c[j] = (c[j] + c[j - 1]) % MOD
	return c[k]
for _ in range(int(input())):
	(n, k) = numIN()
	s = ''
	for i in range(1, k + 1):
		s += chr(i + 96)
	for i in range(k, n):
		s += s[i - k]
	print(s)


import string
t = int(input())
s1 = list(string.ascii_lowercase)
while t > 0:
	s = ''
	(n, k) = map(int, input().split())
	while len(s) < n:
		for i in range(0, k):
			if len(s) == n:
				break
			s += s1[i]
	print(s)
	t -= 1


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	g = n // k
	for h in range(n - k * g):
		print(chr(ord('a')), end='')
	for y in range(k):
		for x in range(g):
			print(chr(ord('a') + k - y - 1), end='')
	print('')


import sys
import math
import collections
import bisect
import string

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

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

def get_string():
	return sys.stdin.readline().strip()
for t in range(int(input())):
	(n, k) = get_ints()
	lower = string.ascii_lowercase[:k]
	comp = n // k
	ans = lower * comp
	rem = n % k
	for i in range(rem):
		ans += lower[i]
	print(ans)


l = list('abcdefghijklmnopqrstuvwxyz')
n = int(input())
for _ in range(n):
	(le, ch) = map(int, input().split())
	f = le // ch
	lp = []
	while f != 0:
		for i in range(ch):
			lp.append(l[i])
		f -= 1
	if le % ch != 0:
		for i in range(le % ch):
			lp.append(l[i])
	print(*lp, sep='')


a = 'abcdefghijklmnopqrstuvwxyz'
for i in range(int(input())):
	(n, k) = map(int, input().split())
	b = n // k * a[0:k]
	c = a[0:n % k]
	if n % k == 0:
		print(b)
	else:
		print(b + c)


t = int(input())
while t:
	t -= 1
	(n, k) = [int(x) for x in input().split()]
	s = ''
	while len(s) != n:
		i = 0
		while i < k:
			if len(s) == n:
				break
			s += chr(97 + i)
			i += 1
	print(s)


t = int(input())
for i in range(t):
	(l, n) = map(int, input().split())
	alp = [97 + i for i in range(n)]
	while l != 0:
		for i in alp:
			if l <= 0:
				break
			print(chr(i), end='')
			l -= 1
	print()


t = int(input())
f = 'abcdefghijklmnopqrstuvwxyz'
for i in range(t):
	(n, k) = list(map(int, input().split()))
	g = f[:k]
	s = ''
	for j in range(n):
		s += g[j % k]
	print(s)


N = int(input())
S = 'abcdefghijklmnopqrstuvwxyz'
for _ in range(N):
	(a, b) = map(int, input().split())
	s = ''
	for i in range(a):
		s = s + S[i % b]
	print(s)


alpha = '0abcdefghijklmnopqrstuvwxyz'
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().strip().split())
	string = ''
	t = n // k
	if n % k != 0:
		string = n % k * 'a'
	for i in range(1, k + 1):
		string += t * alpha[i]
	print(string)


t = int(input())
for i in range(t):
	(n, k) = [int(i) for i in input().split()]
	x = 'abcdefghijklmnopqrstuvwxyz'
	if n % k == 0:
		y = x[:k] * (n // k)
		print(y)
	else:
		y = x[:k] * (n // k + 1)
		print(y[:n])


for _ in range(int(input())):
	(n, k) = map(int, input().strip().split())
	ans = []
	for i in range(k):
		ans.append(chr(i + ord('a')))
	temp = []
	for i in range(n - k):
		temp += ans
	ans += temp
	print(''.join(ans[:n]))


alph = 'abcdefghijklmnopqrstuvwxyz'
for i in range(int(input())):
	(n, k) = list(map(int, input().split()))
	s = alph[:k]
	print(s * (n // k) + alph[:n % k])


def solve():
	(n, k) = map(int, input().split())
	for i in range(n):
		print(chr(ord('a') + i % k), end='')
	print('')
t = eval(input())
while t:
	solve()
	t -= 1


T = int(input())
for t in range(T):
	(n, k) = list(map(int, input().split()))
	a = 'abcdefghijklmnopqrstuvwxyz'
	s = []
	j = 0
	for i in range(n):
		s.append(a[j])
		j = (j + 1) % k
	print(''.join(s))


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	a = ''.join((chr(97 + i) for i in range(k)))
	print(a * (n // k) + a[0:n % k])


import string
alphabet = string.ascii_lowercase
for _ in range(int(input())):
	(n, k) = [int(i) for i in input().split()]
	result = alphabet[:k] * (n // k) + alphabet[0:n % k]
	print(result)


n = int(input())
ans = []
for i in range(n):
	s = ''
	(leng, rang) = map(int, input().split())
	for i in range(leng):
		s += chr(97 + i % rang)
	ans.append(s)
print('\n'.join(ans))


def main():
	(n, k) = map(int, input().split())
	res = ''
	for i in range(n):
		res += chr(ord('a') + i % k)
	print(res)
t = int(input())
for _ in range(t):
	main()


t = int(input())
for i in range(t):
	a = input().split()
	n = int(a[0])
	k = int(a[1])
	s = ''
	x = 96
	z = 1
	for i in range(n):
		s += chr(x + z)
		z += 1
		if z > k:
			z = 1
	print(s)


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	c = n // k
	s = n
	for i in range(k):
		print(chr(97 + i) * c, end='')
		s -= c
	if s > 0:
		print(chr(97 + k - 1) * s, end='')
	print()


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	c = n // k
	s = ''
	for i in range(k):
		s += chr(97 + i) * c
	s += chr(97 + i) * (n % k)
	print(s)


num = int(input())
alph = 'abcdefghijklmnopqrstuvwxyz'
while num:
	a = []
	r = []
	(n, k) = map(int, input().split())
	f = int(n / k)
	for i in range(k):
		a.append(alph[i])
	for i in range(len(a)):
		for j in range(f):
			r.append(a[i])
	while len(r) != n:
		r.append(a[k - 1])
	print(''.join(r))
	num -= 1


t = int(input())
s = 'abcdefghijklmnopqrstuvwxyz'
for i in range(t):
	(n, k) = map(int, input().split())
	m = n // k
	r = n % k
	print(s[:k] * m + s[0] * r)


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	s = []
	s = list((chr(i + 97) * (a // b) for i in range(b)))
	if a / b != round(a / b):
		s.append(chr(b + 96) * (a % b))
	print(''.join(s))


t = int(input())
alphabets = 'abcdefghijklmnopqrstuvwxyz'
fin = []
output = ''
while t:
	s = input()
	s = s.split(' ')
	fin.append(int(s[0]))
	fin.append(int(s[1]))
	lis = alphabets[:fin[1]]
	lis = list(lis)
	for i in range(fin[0]):
		output += lis[i % fin[1]]
	print(output)
	fin = []
	output = ''
	t = t - 1


MOD = 10 ** 9 + 7
I = lambda : list(map(int, input().split()))
(t,) = I()
while t:
	t -= 1
	(n, k) = I()
	s = ''.join([chr(i) for i in range(97, 97 + k)])
	print(s * (n // k) + s[:n % k])


tc = int(input())
if tc >= 1 and tc <= 100:
	string = 'abcdefghijklmnopqrstuvwxyz'
	for i in range(tc):
		Str = ''
		(n1, n2) = map(int, input().split())
		if (n1 >= 1 and n1 <= 100) and (n2 >= 1 and n2 <= min(n1, 26)):
			if n1 == n2:
				Str += string[0:n2]
			else:
				n3 = int(n1 / n2)
				for i in range(n3):
					Str += string[0:n2]
				if n1 % n2 != 0:
					n4 = n1 % n2
					Str += string[0:n4]
			print(Str)


n = int(input())
for i in range(n):
	y = []
	z = list(map(int, input().split()))
	x = z[0] // z[1]
	for j in range(z[1]):
		for k in range(x):
			y.append(chr(97 + j))
	while len(y) < z[0]:
		y.append(y[-1])
	for j in y:
		print(j, end='')
	print()


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	for i in range(n):
		print(chr(ord('a') + i % k), end='')
	print()


t = int(input())
l = 'abcdefghijklmnopqrstuvwxyz'
for i in range(t):
	(n, k) = map(int, input().split())
	print(l[:k] * (n // k), end='')
	print(l[:n % k])


import random
a = 'abcdefghijklmnopqrstuvwxyz'
t = int(input())
for i in range(t):
	s = ''
	(n, k) = (int(i) for i in input().split())
	freq = n // k
	for i in range(k):
		s += freq * a[i]
	while len(s) != n:
		s += random.choice(s[:k])
	print(s)


al = 'abcdefghijklmnopqrstuvwxyz'
al = list(al)
for t in range(int(input())):
	(a, b) = [int(x) for x in input().rstrip().split()]
	m = a // b
	s = al[0:b] * m
	l = a - b * m
	for i in range(0, l):
		s.append(al[i])
	for i in s:
		print(i, end='')
	print('\r')


abc = list(' abcdefghijklmnopqrstuvwxyz')
for i in range(int(input())):
	(n, k) = map(int, input().split())
	(kol, ost) = (0, 0)
	kol = n // k
	ost = n - k * kol
	s = ''
	for i in range(k):
		if i + 1 < k:
			for l in range(kol):
				s += abc[i + 1]
		else:
			for l in range(kol + ost):
				s += abc[i + 1]
	print(s)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = ''
	i = 97
	j = 0
	l = 1
	while j < n:
		s = s + chr(i)
		i += 1
		j += 1
		if l == k:
			l = 1
			i = 97
		else:
			l = l + 1
	print(s)


a = int(input())
b = []
c = 0
d = []
e = 0
f = 'abcdefghijklmnopqrstuvwxyz'
g = ''
for i in range(a):
	(n, k) = map(int, input().split())
	for i in range(n):
		if k > 1:
			g += f[e]
			e += 1
			if e == k:
				e = 0
		else:
			g += f[0]
	e = 0
	d.append(g)
	g = ''
for i in d:
	print(i)


t = int(input())
s = 'abcdefghijklmnopqrstuvwxyz'
for j in range(t):
	nm = input().split()
	n = int(nm[0])
	k = int(nm[1])
	if n == k:
		print(s[:k])
	elif n > k:
		t = n % k
		h = n // k
		m = s[:k]
		d = '' + s[:k] * h + s[:t]
		print(d)


string = 'abcdefghijklmnopqrstuvwxyz'
t = int(input())
for items in range(t):
	(n, k) = map(int, input().split())
	print((string[:k] * n)[:n])


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	st = 'abcdefghijklmnopqrstuvwxyz'
	r = st[:k]
	r = r * (n // k)
	r = r + st[:n % k]
	print(r)


for tt in range(int(input())):
	(n, k) = map(int, input().split())
	d = {1: 'a', 2: 'b', 3: 'c', 4: 'd', 5: 'e', 6: 'f', 7: 'g', 8: 'h', 9: 'i', 10: 'j', 11: 'k', 12: 'l', 13: 'm', 14: 'n', 15: 'o', 16: 'p', 17: 'q', 18: 'r', 19: 's', 20: 't', 21: 'u', 22: 'v', 23: 'w', 24: 'x', 25: 'y', 26: 'z'}
	num = n // k
	x = n % k
	i = 0
	s = ''
	if x == 0:
		for i in range(1, k + 1):
			s += d[i] * num
		print(s)
	else:
		for i in range(1, k + 1):
			if i != k:
				s += d[i] * num
			else:
				s += d[i] * num
				s += d[i] * x
		print(s)


for _ in range(int(input())):
	(n, k) = [int(i) for i in input().split()]
	res = ''
	for i in range(k - 1):
		for _ in range(n // k):
			res += chr(97 + i)
	res += chr(97 + k - 1) * (n - n // k * (k - 1))
	print(res)


import atexit, io, sys, collections, math, heapq, fractions, copy, os, functools
import sys
import random
import collections
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

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

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

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

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

class IOWrapper(IOBase):

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

def f(n, k):
	r = []
	i = 0
	for _ in range(n):
		r.append(chr(ord('a') + i))
		i += 1
		i %= k
	return ''.join(r)
for u in range(int(input())):
	(n, k) = map(int, input().split())
	print(f(n, k))


for _ in range(int(input())):
	(N, K) = map(int, input().strip().split())
	occurrences = N // K * K
	ans = []
	for i in range(occurrences):
		ans.append(chr(97 + i % K))
	for i in range(N - occurrences):
		ans.append(chr(97 + i % K))
	print(*ans, sep='')


import string
st = string.ascii_lowercase
T = int(input())
for i in range(T):
	(n, k) = [int(i) for i in input().split(' ')]
	rem = n % k
	pool = st[:k]
	res = pool * int(n / k) + pool[:n % k]
	print(res)


def main():
	n = int(input())
	for i in range(n):
		(p, q) = list(map(int, input().split()))
		x = ''.join(list(map(chr, range(97, 97 + q))) * (p // q) + list(map(chr, range(97, 97 + p % q))))
		print(x)
main()


a = 'abcdefghijklmnopqrstuvwxyz'
for j in range(int(input())):
	(n, k) = input().split()
	n = int(n)
	k = int(k)
	l = n // k
	s = ''
	s = s + a[0:k] * l
	n = n - l * k
	while n != 0:
		s += a[k - 1]
		k -= 1
		n -= 1
	print(s)


from sys import stdin
n1 = int(stdin.readline().strip())
s = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
for i in range(n1):
	(n, m) = list(map(int, stdin.readline().strip().split()))
	x = 0
	s1 = ''
	for j in range(n):
		s1 += s[x]
		x += 1
		if (j + 1) % m == 0:
			x = 0
	print(s1)


t = int(input())
string = 'abcdefghijklmnopqrstuvwxyz'

def func():
	(n, k) = map(int, input().split())
	count = 0
	new = ''
	while count < n:
		for x in range(k):
			if count < n:
				new = new + string[x]
				count = count + 1
	return new
list1 = []
for i in range(t):
	list1.append(func())
for j in range(t):
	print(list1[j])


s = 'abcdefghijklmnopqrstuvwxyz'
for _ in ' ' * int(input()):
	(n, k) = map(int, input().split())
	for i in range(n):
		print(s[i % k], end='')
	print()


alpha = 'abcdefghijklmnopqrstuvwxyz'
for _ in range(int(input())):
	(n, k) = tuple(map(int, input().split()))
	s = alpha[:k] * (n // k) + 'a' * (n % k)
	print(s)


import string
a = string.ascii_lowercase
b = ''
t = int(input())
for i in range(0, t):
	(n, k) = map(int, input().split())
	s = n // k
	for i in range(0, s):
		for j in range(0, k):
			b = b + a[j]
	for i in range(0, n - k * s):
		b = b + 'a'
	b = b + '\n'
print(b)


s = 'abcdefghijklmnopqrstuvwxyz'
for i in range(int(input())):
	(n, k) = [int(x) for x in input().split()]
	use = s[:k]
	ln = len(use)
	ans = use * (n // ln) + use[:n % ln]
	print(ans)


from string import ascii_lowercase
t = int(input())
for tt in range(t):
	(n, k) = input().strip().split(' ')
	(n, k) = (int(n), int(k))
	s = ''
	j = 0
	for i in range(n):
		s += ascii_lowercase[j % k]
		j += 1
	print(s)


t = int(input())
for z in range(t):
	(n, k) = map(int, input().split())
	f = n // k
	s = ''
	j = 97
	for i in range(n):
		s = s + chr(j)
		j += 1
		if j >= k + 97:
			j = 97
	print(s)


T = int(input())
for t in range(T):
	(N, K) = map(int, input().split())
	s = ''
	f = N // K
	for x in range(K):
		s += f * chr(ord('a') + x)
	d = N - len(s)
	for x in range(d):
		s += chr(ord('a') + x)
	print(s)


x = int(input())
for i in range(x):
	(l, r) = map(int, input().split())
	string = ''
	cnt = 1
	while l != 0:
		need = l // r
		l -= need
		r -= 1
		string += chr(cnt + 96) * need
		cnt += 1
	print(string)


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	s = ''
	q = 97
	j = 0
	while True:
		if a == 0:
			print(s)
			break
		s += chr(q)
		j += 1
		q += 1
		if j == b:
			j = 0
			q = 97
		a -= 1


st = 'abcdefghijklmnopqrstuvwxyz'
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	d = st[:k]
	ans = ''
	for i in range(101):
		ans += d
	print(ans[:n])


t = int(input())
NK = [list(map(int, input().split())) for i in range(t)]
for i in range(t):
	(n, k) = NK[i]
	for j in range(n):
		print(chr(97 + j % k), end='')
	print()


a = int(input())
A = []
for i in range(a):
	(k, n) = map(int, input().split())
	s = ''
	for j in range(k):
		s += chr(ord('a') + j % n)
	A.append(s)
for a in A:
	print(a)


gi = lambda : list(map(int, input().split()))
alph = 'abcdefghijklmnopqrstuvwxyz'
for k in range(gi()[0]):
	(n, j) = gi()
	ans = alph[:j] * (n // j + 1)
	ans = ans[:n]
	print(ans)


t = int(input())
alph = 'abcdefghijklmnopqrstuvwxyz'
a = []
for i in range(0, t):
	(n, k) = map(int, input().split())
	s = ''
	j = 0
	while j < k:
		s += alph[j]
		j += 1
	if n % k > 0:
		count = n // k
	else:
		count = n // k - 1
	ch = alph[k - 1]
	y = 0
	for j in range(k, n):
		if count > 0:
			s += ch
			count -= 1
		else:
			s += alph[y]
			y += 1
			if y == k - 1:
				y = 0
	a.append(s)
for i in range(0, t):
	print(a[i])


t = int(input())
for i in range(t):
	m = 0
	s1 = ''
	(ln, lk) = ([], [])
	l = list(map(int, input().split()))
	n = l[0]
	k = l[1]
	for j in range(k):
		lk.append(j)
	for k in range(n):
		ln.append(k)
	while len(lk) < len(ln):
		lk.append(lk[m])
		m += 1
	for x in lk:
		s1 += chr(97 + x)
	print(s1)


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	letters = [chr(97 + i) for i in range(k)]
	r = ''
	i = 0
	while len(r) != n:
		r += letters[i % k]
		i += 1
	print(r)


for i in range(int(input())):
	(n, k) = map(int, input().split())
	s = ''
	x = 0
	for i in range(0, n):
		s = s + chr(x + 97)
		x += 1
		x = x % k
	print(s)


import sys
from collections import deque
import math
input_ = lambda : sys.stdin.readline().strip('\r\n')
ii = lambda : int(input_())
il = lambda : list(map(int, input_().split()))
ilf = lambda : list(map(float, input_().split()))
ip = lambda : input_()
fi = lambda : float(input_())
li = lambda : list(input_())
pr = lambda x: print(x)
f = lambda : sys.stdout.flush()
for _ in range(ii()):
	(n, k) = il()
	a = []
	for i in range(n):
		a.append(chr(97 + i % k))
	print(''.join(a))


import sys
input = sys.stdin.readline
t = int(input())
alph = [chr(i + 97) for i in range(26)]
for _ in range(t):
	(n, k) = map(int, input().split())
	s = [alph[i % k] for i in range(n)]
	print(''.join(s))


t = int(input())
for _ in range(t):
	lst = [int(x) for x in input().split()]
	counter = 0
	s = ''
	x = 97
	while counter < lst[0]:
		s += chr(x)
		x += 1
		counter += 1
		if x == 97 + lst[1]:
			x = 97
	print(s)


def retarray():
	return list(map(int, input().split()))
import string
t = int(input())
for _ in range(t):
	(n, k) = retarray()
	(i, op) = (0, '')
	while i < n:
		j = 0
		while i < n and j < k:
			op = op + string.ascii_lowercase[j]
			j += 1
			i += 1
	print(op)


n = int(input())
for i in range(n):
	(l, ch) = map(int, input().split())
	for j in range(l):
		print(chr(j % ch + ord('a')), end='')
	print()


t = int(input())
for i in range(0, t):
	(n, m) = map(int, input().split())
	x = 'abcdefghijklmnopqrstuvwxyz'
	t = x[0:m]
	if n % m == 0:
		print(t * (n // m))
	else:
		print(t * (n // m) + x[0:n % m])


s = ''
for i in range(ord('a'), ord('z') + 1):
	s += chr(i)
for _ in range(int(input())):
	(n, k) = list(map(int, input().split()))
	print(s[:k] * (n // k) + s[:n % k])


from string import ascii_lowercase as let

def main():
	t = int(input())
	for i in range(t):
		(n, k) = list(map(int, input().split()))
		ll = let[:k]
		s = ll * (n // len(ll))
		s += ll[:n - len(s)]
		print(s)
main()


import string
cases = int(input())
for _ in range(cases):
	lst = [int(x) for x in input().split()]
	word = ''
	count = 0
	letter = string.ascii_lowercase[:lst[1]]
	while len(word) < lst[0]:
		i = letter[count % len(letter)]
		word = word + i
		count += 1
	print(word)


t = input()
t = int(t)
letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
for i in range(t):
	(n, k) = input().split()
	n = int(n)
	k = int(k)
	kletters = letters[:k]
	multiple = n // k
	remainder = n % k
	remletters = letters[:remainder]
	for letter in kletters * multiple:
		print(letter, end='')
	for letter in remletters:
		print(letter, end='')
	print()


t = int(input())
for i in range(t):
	data = [int(x) for x in input().split()]
	if data[1] > 26:
		data[1] = 26
	count = 1
	for j in range(0, data[0] // data[1]):
		for k in range(0, data[1]):
			if count != data[0]:
				print(chr(k + 97), end='')
				count += 1
			else:
				print(chr(k + 97))
	for j in range(0, data[0] % data[1]):
		if count != data[0]:
			print(chr(j + 97), end='')
			count += 1
		else:
			print(chr(j + 97))


for o in range(int(input())):
	(n, k) = list(map(int, input().split()))
	a = []
	(l, s) = (0, 0)
	while s < n:
		a.append(chr(l + 97))
		l += 1
		s += 1
		if l == k:
			l = 0
	r = ''.join(a)
	print(r)


from math import gcd, sqrt, ceil

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

def si():
	return input()

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

def li():
	return list(mi())
abc = 'abcdefghijklmnopqrstuvwxyz'
t = ii()
while t:
	t -= 1
	(n, m) = mi()
	c = ceil(n / m)
	c = int(c)
	if c == 0:
		c = 1
	a = []
	for i in range(c):
		for j in range(m):
			a.append(abc[j])
	for i in range(n):
		print(a[i], end='')
	print()


m = int(input())
for i in range(m):
	(n, k) = map(int, input().split())
	s = []
	for j in range(k):
		s.append(chr(ord('a') + j))
	s = ''.join(s)
	if n % k == 0:
		print(s * int(n / k))
	else:
		x = n - k * int(n / k)
		y = s[:x]
		print(s * int(n / k) + y)


n = int(input())
a = []
for i in range(n):
	a.append(list(map(int, input().split())))
s = ''
for i in range(26):
	s += chr(ord('a') + i)
for i in a:
	l = i[0]
	k = i[1]
	print(l // k * s[:k] + l % k * 'a')


t = int(input())
for q in range(t):
	answer = []
	(n, k) = map(int, input().split())
	q1 = 0
	while q1 < n:
		answer.append(chr(ord('a') + q1 % k))
		q1 += 1
	print(*answer, sep='')


alphabet = 'a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z'
alphabet = alphabet.split(',')
iterations = int(input())
data = []
for i in range(iterations):
	data.append(list(map(int, input().split())))
for i in range(iterations):
	n = data[i][0]
	k = data[i][1]
	answer = []
	for j in range(k):
		for m in range(int(n / k)):
			answer.append(alphabet[j])
	for j in range(n - len(answer)):
		answer.append(alphabet[j])
	print(''.join(answer))


t = int(input())
for i in range(t):
	s = []
	ln = input().split()
	n = int(ln[0])
	k = int(ln[1])
	for i in range(k):
		for j in range(n // k):
			s.append(chr(97 + i))
	for i in range(n - n // k * k):
		s.append('a')
	print(''.join((x for x in s)))


def uni_srt(n, k):
	alf = ['', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
	cur_alf = alf[1:k + 1]
	ostatok = int(n % k)
	frequency = int(n / k)
	if k == n:
		return ''.join(cur_alf)
	elif ostatok == 0:
		s = []
		i = 0
		while i != k:
			s.append(cur_alf[i] * frequency)
			i = i + 1
		return ''.join(s)
	else:
		s = []
		i = 0
		j = 0
		while i != k:
			s.append(cur_alf[i] * frequency)
			i = i + 1
		while j != ostatok:
			s.append(cur_alf[j])
			j = j + 1
		return ''.join(s)
N = int(input())
for i in range(N):
	(n, k) = list(map(int, input().split()))
	s = uni_srt(n, k)
	print(s)


t = int(input())
ans = []
al = 'abcdefghijklmnopqrstuvwxyz'
for i in range(t):
	(n, k) = map(int, input().split())
	c = n // k
	cc = n % k
	a = ''
	for i in range(k):
		a += al[i] * c
		if cc != 0:
			cc -= 1
			a += al[i]
	ans.append(a)
for i in ans:
	print(i)


alphabet = 'abcdefghijklmnopqrstuvwxyz'
t = int(input())
for i in range(t):
	(x, y) = list(map(int, input().split()))
	k = x // y
	s = ''
	for i in range(k):
		s += alphabet[:y]
	k = x % y
	if k != 0:
		s += alphabet[:k]
	print(s)


n = int(input())
s = 'abcdefghijklmnopqrstuvwxyz'
for i in range(n):
	(a, b) = map(int, input().split())
	d = a // b
	c = a % b
	h = s[:b] * d
	h += s[:c]
	print(h)


t = int(input())
s = 'abcdefghijklmnopqrstuvwxyz'
for i in range(t):
	(n, k) = map(int, input().split())
	c = 1
	while c:
		if n >= k:
			print(s[:k], end='')
			n -= k
		else:
			print(s[:n], end='')
			c = 0
	print('')


T = int(input())
for i in range(T):
	ch = 'a'
	str = ''
	(n, k) = map(int, input().split())
	rem = n % k
	for j in range(k):
		m = n // k
		while m:
			str += ch
			m -= 1
		ch = chr(ord(ch) + 1)
	for j in range(rem):
		str += str[0]
	print(str)


import string
t = int(input())
for _ in range(t):
	(x, y) = map(int, input().split(' '))
	arr = list(string.ascii_lowercase)
	a = []
	for i in range(y):
		for _ in range(int(x / y)):
			a.append(arr[i])
	if not x % y == 0:
		for j in range(int(x % y)):
			a.append(arr[0])
	print(''.join(a))


t = int(input())
for i in range(t):
	w = ''
	(n, k) = map(int, input().split())
	for i in range(97, 97 + k):
		w += chr(i) * (n // k)
	r = n % k
	for i in range(97, 97 + r):
		w += chr(i)
	print(w)


read = lambda : map(int, input().split())
alphabet = 'abcdefghijklmnopqrstuvwxyz'
t = int(input())
while t > 0:
	t -= 1
	(n, k) = read()
	x = (alphabet[:k] * ((n + k - 1) // k))[:n]
	print(x)


import string
ref = string.ascii_lowercase
q = int(input())
count = 0
ans = []
while count < q:
	(n, k) = input().split()
	pair = int(n) // int(k)
	f = ref[:int(k)] * pair
	if int(n) % int(k) != 0:
		ex = int(n) % int(k)
		f += ref[:ex]
	ans.append(f)
	count += 1
for y in ans:
	print(y)


a = 'abcdefghijklmnopqrstuvwxyz'
t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	times = n // k
	mod = n % k
	s = a[:k] * times + a[:mod]
	print(s)


t = int(input())
alp = list('abcdefghijklmnopqrstuvwxyz')
for i in range(t):
	(n, k) = tuple(map(int, input().split()))
	j = 0
	s = ''
	while len(s) != n:
		s += alp[j]
		if j == k - 1:
			j = -1
		j += 1
	print(s)


from string import ascii_lowercase
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	ans = ''
	alpha = [0] + [i for i in ascii_lowercase]
	start = 1
	for i in range(1, n + 1):
		ans += alpha[start]
		start += 1
		if i % k == 0:
			start = 1
	print(ans)


alpha = 'abcdefghijklmnopqrstuvwxyz'
t = int(input())
for test in range(t):
	(n, k) = list(map(int, input().split()))
	print(alpha[0:k] * (n // k) + alpha[:n % k])


n = int(input())
for i in range(0, n):
	u = input().rstrip().split(' ')
	N = int(u[0])
	K = int(u[1])
	l = []
	U = 0
	for i in range(0, K):
		t = chr(i + 97)
		l.append(t)
	l.reverse()
	while N:
		print(l[U], end='')
		U += 1
		if U >= len(l):
			U = 0
		N -= 1
	print()


for t in range(int(input())):
	(n, k) = map(int, input().split())
	rem = n % k
	cnt = n // k
	s = 'abcdefghijklmnopqrstuvwxyz'
	sen = s[0:k]
	senRem = s[0:rem]
	print(sen * cnt + senRem)