For the given integer $n$ ($n > 2$) let's write down all the strings of length $n$ which contain $n-2$ letters 'a' and two letters 'b' in lexicographical (alphabetical) order.

Recall that the string $s$ of length $n$ is lexicographically less than string $t$ of length $n$, if there exists such $i$ ($1 \le i \le n$), that $s_i < t_i$, and for any $j$ ($1 \le j < i$) $s_j = t_j$. The lexicographic comparison of strings is implemented by the operator < in modern programming languages.

For example, if $n=5$ the strings are (the order does matter):  aaabb  aabab  aabba  abaab  ababa  abbaa  baaab  baaba  babaa  bbaaa 

It is easy to show that such a list of strings will contain exactly $\frac{n \cdot (n-1)}{2}$ strings.

You are given $n$ ($n > 2$) and $k$ ($1 \le k \le \frac{n \cdot (n-1)}{2}$). Print the $k$-th string from the list.


-----Input-----

The input contains one or more test cases.

The first line contains one integer $t$ ($1 \le t \le 10^4$) — the number of test cases in the test. Then $t$ test cases follow.

Each test case is written on the the separate line containing two integers $n$ and $k$ ($3 \le n \le 10^5, 1 \le k \le \min(2\cdot10^9, \frac{n \cdot (n-1)}{2})$.

The sum of values $n$ over all test cases in the test doesn't exceed $10^5$.


-----Output-----

For each test case print the $k$-th string from the list of all described above strings of length $n$. Strings in the list are sorted lexicographically (alphabetically).


-----Example-----
Input
7
5 1
5 2
5 8
5 10
3 1
3 2
20 100

Output
aaabb
aabab
baaba
bbaaa
abb
bab
aaaaabaaaaabaaaaaaaa

Source: codeforces | Difficulty: EASY
Tags: Sorting

Combinatorics

Implementation

Complete search

Mathematics


Solutions:
import math

def fn(a):
	res = (math.sqrt(1 + 8 * a) - 1) / 2
	return res

def rev(n):
	return n * (n + 1) / 2

def change(s, i, j):
	return s[:i] + 'b' + s[i + 1:j] + 'b' + s[j + 1:]
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	perm = math.ceil(fn(k))
	first_ind = n - 1 - perm
	temp = int(k - rev(perm))
	sec_ind = first_ind + (1 - temp)
	res = 'a' * n
	print(change(res, first_ind, sec_ind))


t = int(input())
while t > 0:
	line = input()
	n = int(line.split(' ')[0])
	k = int(line.split(' ')[1])
	i = 1
	p = i
	while k > p:
		i += 1
		p += i
	if k == p:
		print('a' * (n - i - 1) + 'bb' + 'a' * (i - 1))
	else:
		diff = p % k
		print('a' * (n - i - 1) + 'b' + 'a' * diff + 'b' + 'a' * (i - 1 - diff))
	t -= 1


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	check = [1 for i in range(n - 1)]
	extra = 2
	for i in range(1, n - 1):
		check[i] = check[i - 1] + extra
		extra += 1
	l = 0
	r = n - 1
	ans = -1
	while l <= r:
		mid = l + (r - l) // 2
		if check[mid] >= k:
			ans = mid + 1
			r = mid - 1
		else:
			l = mid + 1
	if k == 1:
		print((n - 2) * 'a' + 'bb')
	else:
		diff = k - check[ans - 2]
		between = ans - diff
		final = (n - 1 - ans) * 'a' + 'b' + between * 'a' + 'b' + (diff - 1) * 'a'
		print(final)


import math
t = int(input())
for i in range(t):
	(n, k) = [int(x) for x in input().split()]
	l = math.floor((1 + math.sqrt(1 + 8 * (k - 1))) / 2)
	t = 1 + l * (l - 1) // 2
	bpos1 = -l - 1
	bpos2 = -(k - t) - 1
	ans = ['a'] * n
	ans[bpos1] = 'b'
	ans[bpos2] = 'b'
	print(''.join(ans))


from sys import stdin, stdout
import math

def main():
	t = int(input())
	while t:
		(n, k) = map(int, input().split())
		x = 1
		(j1, j2) = (n - 2, n - 1)
		while 1:
			if x * (x + 1) // 2 >= k:
				break
			x += 1
		if x * (x + 1) == 2 * k:
			j1 = j1 - (x - 1)
			j2 = j2 - (x - 1)
		else:
			j1 = j1 - (x - 1)
			j2 = j2 - (x - 1) + (x * (x + 1) // 2 - k)
		s = ''
		for i in range(n):
			if i == j1 or i == j2:
				s += 'b'
			else:
				s += 'a'
		print(s)
		t -= 1
main()


from sys import stdin, stdout
for _ in range(int(input())):
	(a, b) = map(int, stdin.readline().split())
	result = ['a' for x in range(a)]
	n = 2
	times = a - 2
	while b > n * (n - 1) // 2:
		n += 1
		times -= 1
	n -= 1
	s = n * (n - 1) // 2
	total_left = b - s
	second = a - total_left
	result[times] = 'b'
	result[second] = 'b'
	print(''.join(result))


from math import sqrt
t = int(input())
for tc in range(t):
	(n, k) = map(int, input().split())
	b_pos = int(0.5 + sqrt(1 + 8 * (k - 1)) / 2)
	large = b_pos + 1
	small = int(k - (b_pos - 1) * b_pos / 2)
	a = ['a' for i in range(n)]
	a[large - 1] = 'b'
	a[small - 1] = 'b'
	print(''.join(a)[::-1])


for i in range(int(input())):
	(n, k) = map(int, input().split())
	ans = ['a'] * n
	now = 0
	for i in range(1, n):
		now += i
		if now >= k:
			break
	now -= i
	ans[-i - 1] = 'b'
	ans[-(k - now)] = 'b'
	print(*ans, sep='')


testCases = int(input())
for i1 in range(testCases):
	parameter = list(map(int, input().split()))
	n = parameter[0]
	k = parameter[1]
	result = ['a'] * n
	temp = 1
	while temp * (temp - 1) / 2 < k:
		temp += 1
	output = 1
	if temp != 2:
		output = k - int((temp - 1) * (temp - 2) / 2)
	result[-temp] = 'b'
	result[-output] = 'b'
	for i in result:
		print(i, end='')
	print('')


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	x = 0
	for i in range(int(k ** 0.5), k + 1):
		if i * (i - 1) < k * 2 <= i * (i + 1):
			x = i
			break
	l = ['a' for _ in range(n)]
	l[n - x - 1] = 'b'
	y = k - x * (x - 1) // 2
	l[n - y] = 'b'
	print(''.join(l))


t = int(input())
for i in range(t):
	(a, k) = map(int, input().strip().split())
	s = list('a' * a)
	for i in range(a - 2, -1, -1):
		if k <= a - i - 1:
			s[i] = 'b'
			s[a - k] = 'b'
			print(''.join(s))
			break
		k -= a - i - 1


for _ in range(int(input())):
	(a, k) = list(map(int, input().split()))
	fr = 0
	mod = a * (a - 1) // 2
	pos1 = 1
	while k - pos1 > 0:
		k -= pos1
		pos1 += 1
	c = ['a' for p in range(a)]
	c[-pos1 - 1] = 'b'
	c[-k] = 'b'
	print(*c, sep='')


import sys
from bisect import bisect_left
which = []
MAX = int(2000000000.0) + 10
to_append = 1
cnt = 0
while True:
	which.append(to_append + cnt)
	to_append = which[-1]
	cnt += 1
	if which[-1] > MAX:
		break
t = int(input())
print_last = ''
for _ in range(t):
	to_ret = ''
	(n, k) = map(int, input().split(' '))
	which_idx = bisect_left(which, k)
	if which[which_idx] != k:
		which_idx = which_idx - 1
	first_b = which_idx + 1
	second_b = k - which[which_idx]
	for i in range(n - first_b - 1):
		print_last += 'a'
	for i in range(first_b + 1)[::-1]:
		if i == first_b:
			print_last += 'b'
		elif i == second_b:
			print_last += 'b'
		else:
			print_last += 'a'
	print_last += '\n'
print(print_last)


t = int(input())
for p in range(t):
	(n, x) = map(int, input().split())
	i = 1
	ans = ['a'] * n
	while i * (i + 1) / 2 < x:
		i += 1
	ans[n - i - 1] = 'b'
	x = x - i * (i - 1) // 2
	ans[n - x] = 'b'
	print(''.join(ans))


import math
a = int(input())
answer = ''
for x in range(a):
	b = [int(x) for x in input().split()]
	stelle = int(0.5 + math.sqrt(0.25 + 2 * (b[1] - 1)))
	stelle2 = b[1] - stelle * (stelle - 1) // 2 - 1
	answer = 'a' * (b[0] - stelle - 1) + 'b' + (stelle - stelle2 - 1) * 'a' + 'b' + stelle2 * 'a'
	print(answer)


num_de_casos = int(input())
for i in range(num_de_casos):
	(tamanho, posicao) = map(int, input().split())
	for j in range(tamanho - 2, -1, -1):
		if posicao <= tamanho - j - 1:
			palavra = list('a' * tamanho)
			palavra[j] = 'b'
			palavra[tamanho - posicao] = 'b'
			print(''.join(palavra))
			break
		else:
			posicao = posicao - (tamanho - j - 1)


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	(q, q1) = ((-1 + (1 + 8 * k) ** 0.5) / 2, (-1 + (1 + 8 * k) ** 0.5) // 2)
	if q != q1:
		l = [-(int(q1) + 2), -int(k - q1 * (q1 + 1) // 2)]
	else:
		l = [-(int(q1) + 1), -int(q1)]
	res = ''
	for i in range(-n, 0, 1):
		if i == l[0] or i == l[1]:
			res += 'b'
		else:
			res += 'a'
	print(res)


import math
T = int(input())
for _ in range(T):
	(N, M) = map(int, input().split())
	x = 1
	i = 1
	while x < M:
		i = i + 1
		x += i
	j = x - M
	for k in range(N - 1 - i):
		print('a', end='')
	print('b', end='')
	for k in range(j):
		print('a', end='')
	print('b', end='')
	for k in range(N - 1 - i + 2 + j, N):
		print('a', end='')
	print()


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	count = 0
	save = 0
	pos = 0
	for i in range(1, n + 1):
		u = (i + 1) * i // 2
		if u > k:
			save = i
			pos = k - i * (i - 1) // 2
			for u in range(n, n - save - 1, -1):
				count += 1
				if count == pos:
					l = (n - save, u)
					break
			break
		elif u == k:
			l = (n - i, n - i + 1)
			break
	a = ['a'] * n
	a[l[0] - 1] = 'b'
	a[l[1] - 1] = 'b'
	print(''.join(a))


t = int(input())
while t > 0:
	t = t - 1
	(n, k) = map(int, input().split())
	ar = []
	for i in range(n - 2):
		ar.append('a')
	ar.append('b')
	ar.append('b')
	c = 1
	flag = 0
	if k == 1:
		for i in ar:
			print(i, end='')
		print()
		continue
	for i in range(n - 2, 0, -1):
		temp = ar[i]
		ar[i] = ar[i - 1]
		ar[i - 1] = temp
		c += 1
		if c == k:
			flag = 1
			break
		d = n - 1 - i
		if c + d < k:
			c += d
			continue
		for j in range(n - 1, i, -1):
			temp = ar[j]
			ar[j] = ar[j - 1]
			ar[j - 1] = temp
			c += 1
			if c == k:
				flag = 1
				break
		if flag == 1:
			break
	for i in ar:
		print(i, end='')
	print()


import math
t = int(input())
for i in range(t):
	(l, k) = map(int, input().split())
	s = []
	c = 2 * k
	n = math.ceil((-1 + math.sqrt(1 + 4 * c)) / 2)
	b1 = l - n - 1
	l1 = n * (n + 1) // 2
	d = l1 - k + 1
	b2 = b1 + d
	for j in range(l):
		if j == b1 or j == b2:
			s.append('b')
		else:
			s.append('a')
	st = ''.join(s)
	print(st)


for i in range(int(input())):
	(n, k) = list(map(int, input().split()))
	p = 0
	k -= 1
	if k == 0:
		print((n - 2) * 'a' + 'bb')
	else:
		for s in range(1, 1000000000):
			k -= s + 1
			if k <= 0:
				break
		a = k
		b = s
		t = (n - 2 - b) * 'a' + 'b' + 'a' * (-1 * a) + 'b' + 'a' * (b + a)
		print(t)


import math

def main():
	t = int(input())
	for _ in range(t):
		(n, k) = list(map(int, input().split()))
		r = math.ceil(max(quad(1, 1, -2 * k)))
		b1 = n - r
		h = int(r * (r + 1) / 2)
		b2 = b1 + h - k + 1
		st = ['a'] * n
		st[b1 - 1] = 'b'
		st[b2 - 1] = 'b'
		print(''.join(st))

def quad(a, b, c):
	temp = math.sqrt(b * b - 4 * a * c)
	return ((-b + temp) / (2 * a), (-b - temp) / (2 * a))
main()


def beautiful(n, k):
	zeroes = 0
	i = 2
	s = 1
	while s < k:
		if s + i >= k and k != 1:
			zeroes += 1
			break
		elif k == 1:
			break
		else:
			s += i
			i += 1
			zeroes += 1
	if k != 1:
		ans = 'a' * (n - zeroes - 2) + 'b' + 'a' * (zeroes - (k - s) + 1) + 'b' + (k - s - 1) * 'a'
	else:
		ans = 'a' * (n - 2) + 'bb'
	return ans
t = int(input())
array = []
for i in range(t):
	array.append(list(map(int, input().split(' '))))
for x in array:
	print(beautiful(*x))


import math

def checkk(k):
	c = 0
	for i in range(2, k // 2):
		if i * (i - 1) / 2 >= k:
			c = i - 1
			break
	return c

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

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

def li():
	return list(mi())
for _ in range(ii()):
	(n, b) = mi()
	a = ['a'] * n
	j = 1
	c = 1
	if b == 1:
		a[n - 1] = 'b'
		a[n - 2] = 'b'
		for i in range(n):
			if i == n - 1:
				print(a[i])
				continue
			print(a[i], end='')
		continue
	for i in range(2, n):
		if c < b:
			j += 1
			c += i
	a[n - j - 1] = 'b'
	res = int(j * (j - 1) / 2)
	a[n - j + (c - b)] = 'b'
	for i in range(n):
		if i == n - 1:
			print(a[i])
			continue
		print(a[i], end='')


from math import *
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	a = ['a'] * n
	p = floor((1 + sqrt(8 * k + 1)) / 2)
	d = k - p * (p - 1) // 2
	(i, j) = (n - p - (d > 0), [n - p + 1, n - d][d > 0])
	(a[i], a[j]) = 'bb'
	print(''.join(a))


t = int(input())
for i in range(t):
	(n, q) = map(int, input().split())
	count = 0
	for j in range(n - 2, -1, -1):
		if count + n - 1 - j < q:
			count += n - 1 - j
			continue
		else:
			c = n - (q - count)
			s = 'a' * j + 'b' + 'a' * (c - j - 1) + 'b' + 'a' * (n - c - 1)
			print(s)
			break


def main():
	test = int(input())
	for t in range(test):
		l = [int(i) for i in input().split(' ')]
		n = l[0]
		k = l[1]
		i = 1
		while i < n + 1:
			s = i * (i - 1) // 2
			if s >= k:
				break
			i += 1
		temp = (i - 1) * (i - 2) // 2
		string = (n - i) * 'a' + 'b' + (i - k + temp - 1) * 'a' + 'b' + (k - temp - 1) * 'a'
		print(string)
main()


import math
for i in range(int(input())):
	(n, k) = map(int, input().split())
	j = (-1 + math.sqrt(8 * k)) // 2
	first = n - j - 2
	second = n - (k - j * (j + 1) // 2)
	for j in range(0, n):
		if j == first or j == second:
			print('b', end='')
		else:
			print('a', end='')
	print()


def func(le, key):
	if key == 2:
		return le * (le - 1) // 2
	return le

def solve(n, k):
	ans = ['a'] * n
	key = 2
	for i in range(n):
		le = n - i - 1
		if func(le, key) >= k:
			continue
		ans[i] = 'b'
		k -= func(le, key)
		key -= 1
		if not key:
			break
	return ''.join(ans)
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	print(solve(n, k))


for i in range(int(input())):
	(n, k) = map(int, input().split())
	s = 0
	c = 0
	while s < k:
		c += 1
		s += c
	l = ['a'] * n
	(l[n - c - 1], l[n - (k - (s - c))]) = ('b', 'b')
	print(''.join(l))


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	count = 0
	for i in range(1, k + 1):
		count += i
		if count >= k:
			break
	s = 'a' * (n - i - 1) + 'b' + 'a' * (count - k) + 'b' + 'a' * (i - 1 - count + k)
	print(s)


t = int(input())

def f(n, k):
	ans = ''
	p = 2
	while k > p - 1:
		k = k - (p - 1)
		p += 1
	f1 = n - p
	s2 = n - k
	if f1 > s2:
		ver = 0
		ver = s2
		s2 = f1
		f1 = ver
	ans += 'a' * f1
	ans += 'b'
	ans += 'a' * (s2 - f1 - 1)
	ans += 'b'
	ans += 'a' * (n - s2 - 1)
	return ans
for i in range(t):
	(n, k) = map(int, input().split())
	print(f(n, k))


def frst_indx(n, k):
	(begin, end) = (0, 0)
	for i in range(n * (n - 1)):
		if begin <= k <= end:
			break
		else:
			(begin, end) = (end + 1, end + i)
	return i - 1
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	fi = frst_indx(n, k)
	si = k - (1 + (fi - 1) * fi // 2)
	print(''.join((['a', 'b'][i == fi or i == si] for i in range(n)))[::-1])


from math import *

def getAnswer(n, m):
	m -= 1
	answer = ['a'] * n
	count = ((1 + 8 * m) ** (1 / 2) - 1) // 2
	count = floor(count)
	answer[n - count - 2] = 'b'
	summa = m - (count * count + count) // 2
	answer[n - 1 - summa] = 'b'
	return answer
kt = int(input())
for t in range(kt):
	(n, m) = map(int, input().split())
	print(''.join(getAnswer(n, m)))


p = int(input())
for i in range(p):
	(n, m) = map(int, input().split(' '))
	if m == 1:
		print('a' * (n - 2) + 'bb')
	else:
		k = 2
		while k * (k - 1) < 2 * m:
			k += 1
		print('a' * (n - k) + 'b' + 'a' * (k - 1 - (m - (k - 1) * (k - 2) // 2)) + 'b' + 'a' * (m - (k - 1) * (k - 2) // 2 - 1))


t = int(input())
l = []
for i in range(t):
	l.append(list(map(int, input().split())))
for ll in l:
	s = ''
	i = 1
	while i * (i + 1) < 2 * ll[1]:
		i += 1
	j = i * (i + 1) // 2 - ll[1]
	print('a' * (ll[0] - 1 - i) + 'b' + 'a' * j + 'b' + 'a' * (i - j - 1))


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	r = ['a'] * n
	x = n * (n - 1) // 2
	i = n - 1
	a = x
	while i >= 1:
		a -= i
		b = a + 1
		c = a + i
		if b <= k <= c:
			g = k - b
			r[-i - 1] = 'b'
			r[n - g - 1] = 'b'
			print(''.join(r))
			break
		i -= 1


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	s = ['a'] * n
	for i in range(n - 2, -1, -1):
		if k <= n - i - 1:
			s[n - k] = 'b'
			s[i] = 'b'
			print(*s, sep='')
			break
		else:
			k -= n - i - 1


def main():
	T = int(input())
	for _ in range(T):
		(N, K) = map(int, input().split())
		if K == 1:
			print('a' * (N - 2) + 'b' * 2)
		else:
			ini = ['a'] * N
			start = 1
			summ = 1
			while summ < K:
				start += 1
				summ += start
			(ini[-(start + 1)], ini[-(K - (summ - start))]) = ('b', 'b')
			print(''.join(ini))
main()


for _ in range(int(input())):
	(m, n) = map(int, input().split())
	j = 1
	i = 1
	if n == 2 or n == 3:
		a = 1
	else:
		a = 0
	while j < n:
		i += 1
		j += i
		if j < n:
			a = j
	s = 'a' * m
	i = m - i - 1
	s = s[:i] + 'b' + s[i + 1:]
	i = m - (n - a - 1) - 1
	s = s[:i] + 'b' + s[i + 1:]
	print(s)


t = int(input())
answers = []
for i in range(t):
	(n, k) = map(int, input().split(' '))
	diap = 0
	pos = 0
	for g in range(n):
		if g * (g - 1) // 2 < k <= (g + 1) * g // 2:
			diap = g + 1
			pos = k - g * (g - 1) // 2
	answer = list('a' * n)
	answer[-diap] = 'b'
	answer[-pos] = 'b'
	answers.append(''.join(answer))
print('\n'.join(answers))


MOD = 1000000007
MOD2 = 998244353
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
let = 'abcdefghijklmnopqrstuvwxyz'
for _ in range(ii()):
	(n, k) = f()
	tem = n
	ans = [''] * n
	x = 0
	for i in range(1, tem + 1):
		if k > i:
			k -= i
		else:
			x = i
			break
	ans[x] = 'b'
	ans[k - 1] = 'b'
	for i in range(tem):
		if ans[i] == '':
			ans[i] = 'a'
	print(''.join(ans)[::-1])


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	g = 1
	c = 1
	a = 2
	while True:
		if k <= c:
			break
		else:
			c += a
			a += 1
			g += 1
	r = k % (g * (g - 1) // 2 + 1)
	p1 = n - 1 - g
	p2 = n - 1 - r
	string = 'a' * p1 + 'b' + 'a' * (p2 - p1 - 1) + 'b' + 'a' * (n - 1 - p2)
	print(string)


for _ in range(int(input())):
	i = 1
	(a, b) = map(int, input().split())
	z = 1
	while z < b:
		i += 1
		z += i
	f = i - 1
	s = z - b
	q = 'a' * (a - 2 - f) + 'b' + 'a' * (z - b) + 'b'
	q = q + 'a' * (a - len(q))
	print(q)


t = int(input())
for i in range(t):
	(n, k) = [int(x) for x in input().split()]
	count = 1
	b_one = 1
	while True:
		if k <= b_one:
			b_prev = b_one - count
			break
		count += 1
		b_one += count
	b_ind1 = count
	b_ind2 = k - b_prev - 1
	ans = ''
	for j in range(n - 1, -1, -1):
		if j == b_ind1 or j == b_ind2:
			ans += 'b'
		else:
			ans += 'a'
	print(ans)


for i in range(int(input())):
	(n, k) = map(int, input().split())
	k = n * (n - 1) // 2 - k + 1
	s = ['a'] * n
	p1 = p2 = 0
	(c, sum) = (n - 1, 0)
	while True:
		sum += c
		c -= 1
		if sum >= k:
			sum -= c + 1
			p2 = p1 + k - sum
			break
		p1 += 1
	s[p1] = s[p2] = 'b'
	print(''.join(s))


import math
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	r = math.sqrt(1 + 8 * k)
	t = (r - 1) / 2
	g = math.ceil(t)
	t = g * (g - 1) / 2 + 1
	num = int(g - 1 - (k - t))
	s = ''
	for i in range(n - g - 1):
		s += 'a'
	s += 'b'
	for i in range(num):
		s += 'a'
	s += 'b'
	for i in range(g - num - 1):
		s += 'a'
	print(s)


import math
t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	x = (1 + math.sqrt(1 + 4 * 2 * k)) / 2
	x -= 1
	x = int(math.ceil(x))
	begining = int(x * (x - 1) / 2 + 1)
	diff = k - begining
	ans = ''
	for j in range(diff):
		ans += 'a'
	ans = 'b' + ans
	for j in range(x - (diff + 1)):
		ans = 'a' + ans
	ans = 'b' + ans
	for j in range(n - (x + 1)):
		ans = 'a' + ans
	print(ans)


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	ans = ['a'] * n
	for i in range(1, n * (n - 1) // 2 + 1):
		if k <= i * (i + 1) // 2:
			ans[n - i - 1] = 'b'
			k -= (i - 1) * i // 2
			ans[n - k] = 'b'
			break
	print(''.join(ans))


for _ in range(int(input())):
	li = list(map(int, input().split()))
	n = li[0]
	k = li[1]
	k -= 1
	p1 = 0
	p2 = 0
	arr = []
	for i in reversed(range(n - 1)):
		if k < n - 1 - i:
			p1 = i
			p2 = n - 1 - k
			break
		k -= n - 1 - i
	for i in range(n):
		if p1 == i or p2 == i:
			arr.append('b')
		else:
			arr.append('a')
	print(''.join(arr))


from bisect import *
t = int(input())

def solve(n, k):
	(lo, hi) = (1, n * (n - 1) // 2 + 1)
	while lo < hi:
		mid = (lo + hi) // 2
		if k > mid * (mid + 1) // 2:
			lo = mid + 1
		else:
			hi = mid
	first = lo
	k -= lo * (lo - 1) // 2 + 1
	res = ['a'] * n
	res[-first - 1] = 'b'
	res[-k - 1] = 'b'
	return ''.join(res)
for test in range(1, t + 1):
	(n, k) = map(int, input().split())
	print(solve(n, k))


t = int(input())
for i in range(t):
	(n, k) = [int(x) for x in input().split()]
	p = 2
	func = 1
	while func < k:
		func += p
		p += 1
	shift = k - (func - p + 1)
	str = 'a' * (n - p) + 'b' + 'a' * (p - 1 - shift) + 'b' + 'a' * (shift - 1)
	print(str)


N = int(input())
for _ in range(N):
	data = input()
	split = data.split()
	n = int(split[0])
	k = int(split[1])
	s = ['a'] * n
	for i in range(1, n + 1):
		if k <= i * (i + 1) / 2:
			pozb1 = n - i - 1
			rest = k - i * (i - 1) / 2
			pozb2 = n - rest
			break
	for i in range(n):
		if i == pozb1:
			s[i] = 'b'
		elif i == pozb2:
			s[i] = 'b'
	print(''.join(s))


from bisect import bisect_left
i = 1
l = [1]
s = 1
for i in range(2, 200002):
	s += i
	l.append(s)

def BinarySearch(x):
	i = bisect_left(l, x)
	if i:
		return i - 1
	else:
		return -1
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	s = 'a' * (n - 2) + 'b' * 2
	r = BinarySearch(m)
	if r + 1 == 0:
		print(s)
	else:
		s1 = ''
		o = n - (r + 2) - 1
		p = n - (m - l[r] - 1) - 1
		for i in range(n):
			if i == o or i == p:
				s1 += 'b'
			else:
				s1 += 'a'
		print(s1)


for pratyush in range(int(input())):
	(n, k) = list(map(int, input().split()))
	(s, f, i) = ('a' * n, k, 1)
	while f > 0:
		f -= i
		i += 1
	i -= 1
	x = n - 1 - i
	y = x + abs(f) + 1
	s = s[:x] + 'b' + s[x + 1:]
	s = s[:y] + 'b' + s[y + 1:]
	print(s)


def main():
	t = int(input(''))
	for i in range(t):
		nums = input('').split()
		n = int(nums[0])
		k = int(nums[1])
		s = []
		for i2 in range(n):
			s.append('a')
		b1Pos = 1
		while True:
			if b1Pos * (b1Pos + 1) / 2 >= k:
				break
			b1Pos = b1Pos + 1
		s[len(s) - 1 - b1Pos] = 'b'
		kInb1Pos = k - (b1Pos - 1) * b1Pos / 2
		b2Pos = int(kInb1Pos)
		if b2Pos == 0:
			s[len(s) - b1Pos] = 'b'
		else:
			s[len(s) - b2Pos] = 'b'
		for i3 in range(len(s)):
			print(s[i3], end='')
		print()
main()


from __future__ import division, print_function
import os
import sys
from io import BytesIO, IOBase
from math import sqrt, floor, factorial, gcd, log
from collections import deque, Counter, defaultdict
from itertools import permutations, combinations
from math import gcd
from bisect import bisect

def k_string(n, k):
	a = []
	for i in range(n - 2, -1, -1):
		if k <= n - i - 1:
			for j in range(n):
				if j == i or j == n - k:
					a.append('b')
				else:
					a.append('a')
			break
		k = k - (n - i - 1)
	return a

def solution():
	for i in range(int(input())):
		(n, k) = map(int, input().split())
		a = k_string(n, k)
		print(''.join(a))
solution()
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

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

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

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

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

class IOWrapper(IOBase):

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

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


def get_kbase(n, k):
	bmax = n
	bmin = 0
	while bmax - bmin > 1:
		bmid = (bmax + bmin) // 2
		newk = bmid * (bmid + 1) // 2
		if k <= newk:
			bmax = bmid
		else:
			bmin = bmid
	return bmax

def solve(i, n, k):
	kbase = get_kbase(n, k)
	left = kbase + 1
	right = k - kbase * (kbase - 1) // 2
	s = 'a' * (n - left) + 'b' + 'a' * (left - right - 1) + 'b' + 'a' * (right - 1)
	print(s)
t = int(input())
for i in range(t):
	(n, k) = [int(a) for a in input().split()]
	solve(i + 1, n, k)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	x = 0
	s = 0
	y = 1
	st = (n - 2) * 'a'
	st += 2 * 'b'
	l = list(st)
	for i in range(2, n + 1):
		s += y
		if s >= k:
			s = s - y
			x = i
			z = n - (k - s)
			break
		y += 1
	temp = l[n - 2]
	l[n - 2] = l[n - x]
	l[n - x] = temp
	x = x - 1
	temp = l[n - 1]
	l[n - 1] = l[z]
	l[z] = temp
	for i in l:
		print(i, end='')
	print()


from bisect import bisect_left as bl, bisect_right as br, insort
import sys
import heapq
from collections import defaultdict as dd, deque

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

def mdata():
	return map(int, data().split())
mod = 998244353
for i in range(int(data())):
	(n, k) = mdata()
	s1 = 'a' * (n - 2)
	cnt1 = int((1 + (1 + 8 * k) ** 0.5) // 2)
	cnt2 = k - cnt1 * (cnt1 - 1) // 2
	if cnt2 == 0:
		cnt2 = cnt1 - 1
	else:
		cnt1 += 1
	print(s1[:n - cnt1] + 'b' + s1[:cnt1 - cnt2 - 1] + 'b' + s1[:cnt2 - 1])


from sys import stdin, stdout
import math
from itertools import permutations, combinations
from collections import defaultdict
from bisect import bisect_left

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

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

def I():
	return int(stdin.readline())
P = 1000000007
arr = [1]
lis = [0]
for i in range(1, 100001):
	arr.append(arr[i - 1] + i)
	lis.append(i)
for t in range(I()):
	(n, k) = In()
	st = 'a' * (n - 2) + 'bb'
	if k == 1:
		print(st)
	else:
		i = bisect_left(arr, k)
		if arr[i] == k:
			x = lis[i]
			s1 = 'a' * (n - x - 2) + 'b' + 'a' * x + 'b'
			print(s1)
		else:
			x = lis[i - 1]
			p = k - arr[i - 1]
			s1 = 'a' * (n - x - 2) + 'b' + 'a' * (x - p) + 'b' + 'a' * p
			print(s1)


times = int(input())
for round in range(times):
	numbers = input()
	n = int(numbers.split()[0])
	k = int(numbers.split()[1])
	result = []
	i = 0
	j = 0
	while j < k:
		i += 1
		j += i
	a = i + 1
	b = k - j + i
	ans = 'a' * (n - a) + 'b' + 'a' * (a - b - 1) + 'b' + 'a' * (b - 1)
	print(ans)


t = int(input())
while t > 0:
	t -= 1
	(n, k) = map(int, input().split())
	s = 1
	v1 = n
	v2 = k
	i = 1
	if k == 1:
		print('a' * (n - 2) + 'bb')
	else:
		while v2 > s + i + 1:
			s += i + 1
			i += 1
		temp = 'a' * (n - i - 2)
		temp += 'b'
		temp += 'a' * (i + 1 - (k - s))
		temp += 'b'
		temp += 'a' * (k - s - 1)
		print(temp)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	lst = []
	for i in range(n - 2):
		lst.append('a')
	lst.append('b')
	lst.append('b')
	cnt = 1
	while cnt * (cnt + 1) // 2 < k:
		cnt += 1
	res = cnt * (cnt - 1) // 2
	lst = lst[::-1]
	lst[1] = 'a'
	lst[0] = 'a'
	lst[cnt] = 'b'
	res2 = k - res
	lst[res2 - 1] = 'b'
	print(''.join(lst[::-1]))


n = int(input())
m = []
for i in range(n):
	y = str(input())
	z = y.split(' ')
	(a, b) = (int(z[0]), int(z[1]))
	x = ['a'] * (a - 2) + ['b'] * 2
	if b != 1:
		j = 1
		k = 2
		l = 1
		while True:
			if j + k < b:
				j += k
				k += 1
				l += 1
			else:
				break
		(x[a - l - 2], x[a - 2]) = (x[a - 2], x[a - l - 2])
		(x[a - b + j], x[a - 1]) = (x[a - 1], x[a - b + j])
	m.append(''.join(x))
for i in m:
	print(i)


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	j = 1
	while k > j:
		k = k - j
		j = j + 1
	j = n - j - 1
	for x in range(j):
		print('a', end='')
	print('b', end='')
	k = n - k
	for x in range(j + 1, n):
		if x == k:
			print('b', end='')
		else:
			print('a', end='')
	print()


import sys
import math
t = int(sys.stdin.readline())
ans_arr = []
for x in range(t):
	[n, k] = [int(i) for i in sys.stdin.readline().split()]
	low = int(math.sqrt(2 * k)) + 1
	if low * (low - 1) > 2 * k:
		low -= 1
	num = (low - 1) * low // 2
	pos = k - num
	if pos == 0:
		pos = low - 1
	else:
		low += 1
	arr = ['a'] * n
	arr[n - pos] = 'b'
	arr[n - low] = 'b'
	s = ''
	for d in range(n):
		s += arr[d]
	ans_arr.append(s)
print('\n'.join(ans_arr))


import math
DEBUG = False
if DEBUG:
	import sys
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def solve():
	(n, k) = map(int, input().split())
	a = math.sqrt(0.25 + 2 * k) - 0.5
	a = math.ceil(a)
	if a * (a + 1) == 2 * k:
		return 'a' * (n - a - 1) + 'bb' + 'a' * (a - 1)
	tmp = 'a' * (n - a - 1) + 'b' + 'a' * (a - k + a * (a - 1) // 2) + 'b' + 'a' * (k - a * (a - 1) // 2 - 1)
	return tmp
t = int(input())
for _ in range(t):
	print(solve())


import sys
sys.setrecursionlimit(10 ** 6)
R = lambda : map(int, input().split())
t = int(input())

def solve(n, k):
	temp = n * (n - 1) // 2 - n + 1
	if n == 2:
		return 'bb'
	ans = ''
	while k <= temp:
		if n == 2:
			return ans + 'bb'
		ans = ans + 'a'
		n -= 1
		temp = n * (n - 1) // 2 - n + 1
	ans += 'b' + 'a' * (n - 2 - (k - temp) + 1) + 'b' + 'a' * (k - temp - 1)
	return ans
for _ in range(t):
	(n, k) = R()
	print(solve(n, k))


import math
from collections import defaultdict
ml = lambda : map(int, input().split())
ll = lambda : list(map(int, input().split()))
ii = lambda : int(input())
ip = lambda : input()
t = ii()
for _ in range(t):
	(x, y) = ml()
	lol = ['a'] * x
	p = 1
	k = 0
	while k < y:
		k += p
		p += 1
	lol[x - p] = 'b'
	k -= p - 1
	lol[x - (y - k)] = 'b'
	print(''.join(lol))


def r(t=int):
	return list(map(t, input().split()))

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

def cd(it):
	ret_val = dict()
	for v in it:
		ret_val[v] = ret_val.get(v, 0) + 1
	return ret_val
for _ in range(ri()):
	(a, b) = r()
	s = 0
	i = 0
	while s < b:
		i += 1
		s += i
	ans = ['a'] * a
	ans[i] = 'b'
	ans[i + b - s - 1] = 'b'
	print(''.join(reversed(ans)))


for i in range(int(input())):
	(n, k) = map(int, input().split())
	first_b = None
	for i in range(2, n + 1):
		if i * (i - 1) / 2 >= k:
			first_b = i
			break
	rem = k - (i - 1) * (i - 2) / 2
	for i in range(n):
		if i == n - first_b:
			print('b', end='')
		elif i == n - rem:
			print('b', end='')
		else:
			print('a', end='')
	print('')


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	num = ['a'] * n
	for j in range(n - 2, -1, -1):
		if k <= n - j - 1:
			num[j] = 'b'
			num[n - k] = 'b'
			print(''.join(num))
			break
		else:
			k -= n - j - 1


def T(x):
	return x * (x + 1) // 2
t = int(input())
for test in range(t):
	(n, k) = [int(x) for x in input().split(' ')]
	r = 1
	while k > T(r):
		r += 1
	s = (n - r - 1) * 'a' + 'b' + (r - (k - T(r - 1))) * 'a' + 'b' + (r - 1 - (r - (k - T(r - 1)))) * 'a'
	print(s)


from math import floor, sqrt
for i in range(int(input())):
	(n, k) = map(int, input().split())
	k -= 1
	check = floor((-1 + sqrt(1 + 8 * k)) / 2)
	cont = check * (check + 1) // 2
	res = ['a' for _ in range(n)]
	res[check + 1] = 'b'
	res[k - cont] = 'b'
	print(''.join(reversed(res)))


t = int(input())
for z in range(t):
	(n, k) = map(int, input().split())
	leftb = 0
	rightb = 0
	kcopy = k
	prevk = k
	i = n - 2
	while k > 0:
		prevk = k
		k -= n - 1 - i
		i -= 1
	leftb = i + 1
	rightb = n - prevk
	str = 'a' * leftb + 'b' + 'a' * (rightb - leftb - 1) + 'b' + 'a' * (n - 1 - rightb)
	print(str)


t = int(input())

def fun(k):
	i = 1
	while i * (i + 1) / 2 < k:
		i += 1
	return i
for i in range(0, t):
	s = input().split()
	n = int(s[0])
	k = int(s[1])
	ind = fun(k)
	b2 = ind - 1
	ind -= 1
	ind = ind * (ind + 1) / 2
	b1 = k - ind - 1
	print('a' * int(n - b2 - 2), end='')
	print('b', end='')
	print('a' * int(b2 - b1), end='')
	print('b', end='')
	print('a' * int(b1))


nums = [0] * 63251
for i in range(1, 63251):
	nums[i] = int(i * (i + 1) / 2)

def binserch(nums, m):
	(l, r) = (0, len(nums) - 1)
	ans = 450
	while l <= r:
		mid = l + (r - l) // 2
		if nums[mid] >= m:
			r = mid - 1
			ans = mid
		else:
			l = mid + 1
	return ans
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	a = binserch(nums, k)
	lst = list(range(nums[a - 1] + 1, nums[a] + 1))
	sums = binserch(lst, k)
	s = ['a'] * n
	s[-a - 1] = 'b'
	s[-sums - 1] = 'b'
	print(''.join((i for i in s)))


t = int(input())
for i in range(t):
	(a, b) = [int(x) for x in input().split()]
	c = 1
	while b - c > 0:
		b -= c
		c += 1
	for j in range(a):
		if j == a - (c + 1) or j == a - b:
			print('b', end='')
		else:
			print('a', end='')
	print('')


def binary(target):
	(l, r) = (1, 10 ** 9 + 1)
	r1 = 1
	while l <= r:
		mid = (l + r) // 2
		cur = mid * (mid + 1) // 2
		if cur <= target:
			r1 = mid
			l = mid + 1
		else:
			r = mid - 1
	return r1
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	closest = binary(k)
	result = ['a'] * n
	offset = k - closest * (closest + 1) // 2
	l = n - closest - 1
	r = n - closest
	if offset > 0:
		l -= 1
		r = n
		offset -= 1
		while offset >= 0:
			r -= 1
			offset -= 1
	result[l] = 'b'
	result[r] = 'b'
	print(''.join(result))


import math
t = int(input())
for i in range(t):
	(n, k) = list(map(int, input().split()))
	tmp = 0
	i = 1
	while tmp < k:
		tmp += i
		i += 1
	print('a' * (n - i) + 'b' + 'a' * (tmp - k) + 'b' + 'a' * (n - (n - i) - (tmp - k) - 2))


arr = []
arr.append(2)
len = 1
while len <= 100000.0:
	arr.append(len * (len + 1) / 2)
	len += 1

def binarySearchCount(key):
	left = 0
	right = len
	mid = 0
	while left < right:
		mid = (right + left) // 2
		if arr[mid] == key:
			while mid + 1 < len and arr[mid + 1] == key:
				mid += 1
			break
		elif arr[mid] > key:
			right = mid
		else:
			left = mid + 1
	while mid > -1 and arr[mid] > key:
		mid -= 1
	return mid
t = int(input())
while t > 0:
	(n, k) = map(int, input().split())
	temp = binarySearchCount(k)
	if int(k - arr[temp]) == 0:
		temp2 = temp - 1
	else:
		temp2 = int(k - arr[temp]) - 1
		temp += 1
	out = []
	for i in range(n):
		if i == temp or i == temp2:
			out.append('b')
		else:
			out.append('a')
	for i in range(n):
		print(out[n - 1 - i], end='')
	print()
	t -= 1


i = 1
summer = 1
a = []
while i < 2 * 10 ** 9:
	a.append(i)
	i = i + summer
	summer = summer + 1

def binarySearch(a, x):
	l = 0
	r = len(a) - 1
	if a[r] <= x:
		return (r, x - a[r])
	while l <= r:
		mid = l + (r - l) // 2
		if a[mid] <= x and a[mid + 1] > x:
			return (mid, x - a[mid])
		elif a[mid] < x:
			l = mid + 1
		else:
			r = mid - 1
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	(x1, x2) = binarySearch(a, k)
	x1 = n - 2 - x1
	x2 = n - 1 - x2
	li = []
	for i in range(n):
		if i == x1 or i == x2:
			li.append('b')
		else:
			li.append('a')
	String = ''.join(li)
	print(String)


t = int(input())
ss = []
for _ in range(t):
	(n, k) = list(map(int, input().split()))
	i = 1
	s = 1
	while s < k:
		i += 1
		s += i
	pos_1 = n - i - 1
	pos_2 = s - k + pos_1 + 1
	st = ['a' for _ in range(n)]
	st[pos_1] = 'b'
	st[pos_2] = 'b'
	print(''.join((_ for _ in st)))


import math
t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	builder = ['a'] * n
	g = math.floor((1 + math.sqrt(8 * k - 7)) / 2)
	builder[n - g - 1] = 'b'
	K = int(g * (g - 1) / 2)
	builder[n - k + K] = 'b'
	print(''.join(builder))


t = int(input())
for _ in range(t):
	(tam, posi) = list(map(int, input().split()))
	k = posi
	retorno = ['a'] * tam
	for i in range(1, posi + 1):
		k -= i
		if k < 0:
			k += i
			retorno[-i - 1] = 'b'
			retorno[-k] = 'b'
			break
		elif k == 0:
			retorno[-i] = 'b'
			retorno[-i - 1] = 'b'
			break
	print(''.join(retorno))


import sys
t = int(input())
g = sys.stdin.readlines()
for i in range(t):
	(n, k) = map(int, g[i].split())
	a = [0] * n
	a[0] = 1
	first = -1
	second = -1
	for i in range(1, n):
		a[i] = a[i - 1] + i
	for i in range(n):
		if k < a[i]:
			first = n - i - 1
			k %= a[i - 1]
			break
	second = n - k - 1
	answer = ['a'] * n
	answer[first] = 'b'
	answer[second] = 'b'
	print(*answer, sep='')


for _ in range(int(input())):
	ans = ''
	(n, k) = map(int, input().split())
	i = 1
	while i * (i + 1) < 2 * k:
		i += 1
	leftmost = n - 1 - i
	mid = i * (i + 1) // 2 - k
	print('a' * leftmost + 'b' + 'a' * mid + 'b' + 'a' * (i - 1 - mid))


t = int(input())
while t > 0:
	(n, k) = input().split()
	n = int(n)
	k = int(k)
	l = 0
	r = n
	first = n - 2
	second = n - 1
	while l < r:
		mid = l + (r - l) // 2
		if k < mid * (mid + 1) // 2 and k > mid * (mid - 1) // 2:
			first = n - mid
			second = n - k + mid * (mid - 1) // 2 + 1
			break
		elif k > mid * (mid + 1) // 2:
			l = mid + 1
		else:
			r = mid
	if l == r:
		first = n - l
		second = n - k + l * (l - 1) // 2 + 1
	s = ''
	for i in range(n):
		if i == first - 1 or i == second - 1:
			s = s + 'b'
		else:
			s = s + 'a'
	print(s)
	t -= 1


from math import *
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	d = (sqrt(8 * k + 1) - 1) / 2
	if ceil(d) == floor(d):
		d = floor(d) - 1
		s = 'a' * d + 'bb'
		N = len(s)
		s += 'a' * (n - N)
		print(s[::-1])
	else:
		d = floor(d)
		N = k - d * (d + 1) // 2
		d = d - N + 1
		s = 'a' * (N - 1) + 'b' + 'a' * d + 'b'
		N = len(s)
		s += 'a' * (n - len(s))
		print(s[::-1])


t = int(input())
for i in range(t):
	(n, k) = [int(s) for s in input().split()]
	left = 0
	right = int(n + 1)
	while right - left > 1:
		middle = (left + right) // 2
		if middle * (middle + 1) // 2 > k:
			right = middle
		else:
			left = middle
	pos_b_1 = n - left
	if left * (left + 1) // 2 != k:
		pos_b_1 -= 1
	if left * (left + 1) // 2 != k:
		pos_b_2 = n - (k - 1 - left * (left + 1) // 2)
	else:
		pos_b_2 = pos_b_1 + 1
	ans = ''
	ans += 'a' * (pos_b_1 - 1) + 'b' + 'a' * (pos_b_2 - pos_b_1 - 1) + 'b' + 'a' * (n - pos_b_2)
	print(ans)


import math

def solve(k):
	m = (-1 * 1 + math.sqrt(1 * 1 + 4 * 1 * 2 * k)) / 2
	return int(math.ceil(m))
t = int(input())
for case in range(t):
	(n, k) = [int(zax) for zax in input().split()]
	m = solve(k)
	p = m + 1
	q = k - m * (m - 1) // 2
	l = ['a'] * n
	l[-1 * p] = 'b'
	l[-1 * q] = 'b'
	print(''.join(l))


n = int(input())
for i in range(n):
	(n, k) = map(int, input().split())
	output = ['a'] * n
	for i in range(n):
		if i * (i + 1) // 2 >= k:
			ans = i
			break
	output[n - ans - 1] = 'b'
	prod = ans * (ans - 1) // 2
	output[-1 * (k - prod)] = 'b'
	print(''.join(output))


import collections, heapq, itertools, math
groupby = itertools.groupby
rs = lambda : input()
ri = lambda : int(input())
rm = lambda : map(int, input().split())
rai = lambda : [int(x) for x in input().split()]

def solve(n, k):
	S = ['a' for x in range(n)]
	i = 0
	while True:
		if i * (i + 1) >= 2 * k:
			break
		i += 1
	i -= 1
	S[-2 - i] = 'b'
	S[i * (i + 1) // 2 - k] = 'b'
	return ''.join(S)
for t in range(1, 1 + ri()):
	(n, k) = rm()
	ans = solve(n, k)
	print('{}'.format(ans))


t = int(input())
while t:
	t -= 1
	(n, k) = map(int, input().split())
	i = 1
	cnt = 0
	while cnt < k:
		cnt += i
		i += 1
	cnt -= i
	pos = k - cnt
	print((n - i) * 'a' + 'b' + (i - pos) * 'a' + 'b' + (pos - 2) * 'a')


import math
import cmath
from sys import stdin, stdout
for i in range(int(input())):
	(n, k) = map(int, input().split())
	a = 1
	b = 1
	c = -2 * k
	d = b ** 2 - 4 * a * c
	sol = (-b + math.sqrt(d)) / (2 * a)
	c = math.ceil(sol)
	d = int((c - 1) * c / 2)
	c = int(c * (c + 1) / 2)
	a = c - k
	ans = (n - math.ceil(sol) - 1) * 'a' + 'b' + a * 'a' + 'b' + (k - d - 1) * 'a'
	stdout.write(ans + '\n')


def main():
	import sys
	input = sys.stdin.readline
	t = int(input())
	for _ in range(t):
		(n, k) = map(int, input().split())
		for i in range(1, n):
			if k > i:
				k -= i
			else:
				b1 = n - 1 - i
				break
		b2 = b1 + (i - k + 1)
		ans = ['a'] * n
		ans[b1] = 'b'
		ans[b2] = 'b'
		print(''.join(ans))
main()


arr = [1]
i = 2
while arr[-1] < 2 * 10 ** 9:
	arr.append(arr[-1] + i)
	i += 1
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if k == 1:
		print('a' * (n - 2) + 'bb')
	else:
		for i in range(len(arr)):
			if arr[i] == k:
				print('a' * (n - 2 - i) + 'bb' + 'a' * i)
				break
			elif arr[i] > k:
				print('a' * (n - 2 - i) + 'b' + 'a' * (i - (k - arr[i - 1] - 1)) + 'b' + 'a' * (k - arr[i - 1] - 1))
				break


get_int = lambda : map(int, input().rstrip().split())
get_list = lambda : list(map(int, input().rstrip().split()))
TEST_CASES = True

def main():
	(n, k) = get_int()
	arr = ['a'] * n
	b_stays = 0
	for i in range(n - 2, -1, -1):
		b_stays = n - i - 1
		if k <= b_stays:
			arr[i] = 'b'
			arr[n - k] = 'b'
			print(''.join(arr))
			break
		else:
			k -= b_stays
if not TEST_CASES:
	main()
else:
	[main() for _ in range(int(input()))]


t = int(input())
for i in range(0, t):
	(a, b) = input().split()
	n = int(a)
	k = int(b)
	N = (pow(8 * k + 1, 0.5) - 1) / 2
	if N % 1 != 0:
		for i in range(1, n + 1):
			N = int(N)
			if i == n - (N + 1) or i == n - (k - N * (N + 1) // 2 - 1):
				print('b', end='')
			else:
				print('a', end='')
	else:
		for i in range(1, n + 1):
			if i == n - int(N) or i == n - (int(N) - 1):
				print('b', end='')
			else:
				print('a', end='')
	print()


n = int(input())
import math
for i in range(n):
	(a, b) = map(int, input().split())
	s = ['a'] * a
	e = math.ceil((-1 + (1 + 8 * b) ** 0.5) / 2)
	a1 = a - e - 1
	r = e * (e + 1) // 2
	a2 = a - e + r - b
	s[a1] = 'b'
	s[a2] = 'b'
	print(*s, sep='')


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	counter = 2
	sums = 1
	while sums < k:
		sums += counter
		counter += 1
	left_b = n - counter
	right_b = left_b + sums - k + 1
	ans = ''
	for i in range(n):
		if i == left_b or i == right_b:
			ans += 'b'
		else:
			ans += 'a'
	print(ans)


for case in range(int(input())):
	(n, k) = [int(x) for x in input().split()]
	p1 = 1
	i = 1
	sum = 1
	while sum + i <= k:
		sum += i
		i += 1
	p1 = i
	p2 = k - sum
	p1 = n - 1 - p1
	p2 = n - 1 - p2
	s = ''
	for i in range(n):
		if i == p1 or i == p2:
			print('b', end='')
		else:
			print('a', end='')
	print()


import os
import sys
from io import BytesIO, IOBase

def solution(n, k):
	if k == 1:
		write('a' * (n - 2) + 'b' * 2)
		return
	if k == n * (n - 1) // 2:
		write('b' * 2 + 'a' * (n - 2))
		return
	div = 1
	(s, i) = (1, 1)
	while s + i <= k:
		div += 1
		s += i
		i += 1
	(idx1, idx2) = (n - div, n - (k - s))
	res = ['a'] * n
	res[idx1 - 1] = 'b'
	res[idx2 - 1] = 'b'
	write(''.join(res))

def main():
	for _ in range(r_int()):
		(n, k) = r_array()
		solution(n, k)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

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

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

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

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

class IOWrapper(IOBase):

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

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

def write(*args, end='\n'):
	for x in args:
		sys.stdout.write(str(x) + ' ')
	sys.stdout.write(end)

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

def r_int():
	return int(input())

def w_array(arr):
	for x in arr:
		write(x, end=' ')
	write()
main()


import sys
from itertools import permutations
input = sys.stdin.readline
T = int(input())
for test in range(T):
	(n, k) = map(int, input().split())
	lst = [0 for _ in range(n)]
	idx1 = n - 2
	idx2 = n - 1
	temp = 0
	sum = 0
	while sum < k:
		sum += temp
		temp += 1
	a = temp - 1
	b = k - (sum - (temp - 1))
	for i in range(n):
		lst[i] = 'a'
	lst[n - 1 - a] = 'b'
	lst[n - b] = 'b'
	print(''.join(lst))


t = int(input())
while t > 0:
	t = t - 1
	(n, k) = map(int, input().split())
	i = 1
	while k > i:
		k -= i
		i += 1
	print('a' * (n - i - 1) + 'b' + 'a' * (i - k) + 'b' + 'a' * (k - 1))


for _ in [0] * int(input()):
	(n, k) = map(int, input().split())
	i = 1
	while k > i:
		k -= i
		i += 1
	print('a' * (n - i - 1) + 'b' + 'a' * (i - k) + 'b' + 'a' * (k - 1))


def calc(a, b):
	(cnt, pos) = (0, [None, None])
	for i in range(1, a):
		cnt += i
		if cnt >= b:
			pos = [i, i - (cnt - b) - 1]
			break
	s = ['a'] * a
	(s[pos[0]], s[pos[1]]) = ('b', 'b')
	return ''.join(reversed(s))
N = int(input())
cases = []
for _ in range(N):
	cases.append(map(int, input().split()))
for (a, b) in cases:
	print(calc(a, b))


for k in range(int(input())):
	(n, s) = map(int, input().split(' '))
	a = n - 1
	b = n - 1
	j = 0
	while j < s:
		b = b - 1
		a = n - 1
		j = j + (a - b)
	msg = 'a' * n
	msg = list(msg)
	msg[b] = 'b'
	msg[a - (s - (j - (a - b)) - 1)] = 'b'
	print(''.join(msg))


def lexico(li, n):
	for ele in li:
		string = (ele[0] - 2) * 'a' + 'bb'
		if ele[1] == 1:
			print(string)
		else:
			(last, i) = (1, 1)
			summ = 0
			while summ < ele[1]:
				summ += i
				i += 1
				last += 1
			i -= 1
			summ = summ - i
			summ += 1
			diff = ele[1] - summ
			new_string = (ele[0] - last) * 'a' + 'b' + (last - 2 - diff) * 'a' + 'b' + diff * 'a'
			print(new_string)
	return
n = int(input())
li = [[int(j) for j in input().split()] for i in range(n)]
lexico(li, n)


t = int(input())
for _ in range(t):
	(n, k) = input().split()
	n = int(n)
	k = int(k)
	i = 1
	while i:
		if (i ** 2 + i) // 2 < k:
			i += 1
		else:
			break
	a = n - i
	x = a + (i ** 2 + i) // 2 - k + 1
	z = ['a'] * n
	z[x - 1] = 'b'
	z[a - 1] = 'b'
	for j in z:
		print(j, end='')
	print(end='\n')


from sys import stdin, stdout

def solve(tc):
	(n, k) = map(int, stdin.readline().split())
	k -= 1
	ans = ['a' for i in range(n)]
	lo = 0
	hi = n
	while lo < hi:
		mid = lo + (hi - lo) // 2
		if D[mid] <= k:
			lo = mid + 1
		else:
			hi = mid
	lo -= 1
	ans[n - 2 - lo] = 'b'
	k -= D[lo]
	ans[n - 1 - k] = 'b'
	print(''.join(ans))
LOCAL_TEST = not __debug__
if LOCAL_TEST:
	infile = __file__.split('.')[0] + '-test.in'
	stdin = open(infile, 'r')
D = [i for i in range(0, int(100000.0 + 1))]
for i in range(1, int(100000.0 + 1)):
	D[i] += D[i - 1]
tcs = int(stdin.readline().strip())
tc = 1
while tc <= tcs:
	solve(tc)
	tc += 1


n = int(input())
for i in range(n):
	(n, k) = map(int, input().split())
	count = n - 1
	a = n * (n - 1) // 2
	now = 0
	while a > k:
		a -= count
		count -= 1
		now += 1
	if a == k:
		print('a' * now, end='')
	else:
		print('a' * (now - 1), end='')
		count += 1
	print('b', end='')
	a_1 = (count + 1) * (count + 1 - 1) // 2
	meeee = a_1 - k
	a = ['a'] * count
	a[meeee] = 'b'
	print(*a, sep='')


for _ in range(int(input())):
	(n, t) = map(int, input().split())
	q1 = n - 2
	while (n - q1) * (n - q1 - 1) // 2 < t:
		q1 -= 1
	w = (n - q1 - 1) * (n - q1 - 2) // 2
	print('a' * q1 + 'b' + 'a' * (n - t + w - q1 - 1) + 'b' + 'a' * (t - w - 1))


t = int(input())
for i in range(t):
	(n, k) = [int(s) for s in input().split(' ')]
	j = 0
	prev = j
	end = n * (n - 1) // 2
	while True:
		sum = (j ** 2 - j) // 2 + 1
		if k < sum:
			break
		prev = sum
		j += 1
	j -= 1
	index_of_first_b = 0
	index_of_second_b = 0
	str = ''
	for z in range(n):
		str += 'a'
	if k == 1:
		str = str[:n - 1 - 1] + 'b'
		str += 'b'
	elif k < end:
		str = str[:n - j - 1] + 'b' + str[n - j:]
		index_of_first_b = n - j - 1
		index_of_second_b = index_of_first_b + j - (k - prev)
		str = str[:index_of_second_b] + 'b' + str[index_of_second_b + 1:]
	elif k == end:
		str = str[:0] + 'bb' + str[2:]
	else:
		str = str[:0] + 'b' + str[0 + 1:]
		str = str[:k - prev + 1] + 'b' + str[k - prev + 1 + 1:]
	print(str)


import bisect
import os
import gc
import sys
from io import BytesIO, IOBase
from collections import Counter
from collections import deque
import heapq
import math
import statistics

def sin():
	return input()

def ain():
	return list(map(int, sin().split()))

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

def iin():
	return int(sin())
MAX = float('inf')
MIN = float('-inf')
MOD = 1000000007

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

def readTree(n, m):
	adj = [deque([]) for _ in range(n + 1)]
	for _ in range(m):
		(u, v) = ain()
		adj[u].append(v)
		adj[v].append(u)
	return adj

def main():
	for _ in range(iin()):
		(n, k) = ain()
		ans = ['a'] * n
		x = 0
		prev = 1
		c = 1
		while True:
			if k > x:
				x += c
				c += 1
			else:
				break
		ans[-1 * c] = 'b'
		x = (c - 2) * (c - 1) // 2
		k = k - x
		ans[-1 * k] = 'b'
		print(''.join(ans))
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

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

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

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

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

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
if os.getcwd() == 'D:\\code':
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
	input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


import math
T = int(input())
for i in range(T):
	(n, k) = map(int, input().strip().split())
	x = 1
	sum = 1
	while sum < k:
		x += 1
		sum += x
	y = sum - k
	y += 1
	x = n - x
	y = x + y
	for j in range(1, n + 1):
		if j == x or j == y:
			print('b', end='')
		else:
			print('a', end='')
	print('')


t = int(input(''))
i = 0
k = 0
while k < t:
	(x, y) = [int(x) for x in input().split()]
	while y > i * (i + 1) / 2:
		i += 1
	print('a' * int(x - i - 1) + 'b' + 'a' * int((i + 1) * i / 2 - y) + 'b' + 'a' * int(x - 2 - (x - i - 1) - ((i + 1) * i / 2 - y)))
	i = 0
	k += 1


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	ans = ['a'] * n
	b = -1
	b2 = -1
	c = 0
	for i in range(1, n):
		c += i
		if k <= c:
			b = n - i - 1
			b2 = n - (i - (c - k))
			ans[b] = 'b'
			ans[b2] = 'b'
			break
	for i in ans:
		print(i, end='')
	print()


import sys
import math
import itertools
import functools
import collections
import operator
import fileinput
import copy
ORDA = 97

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

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

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

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

def revn(n):
	return str(n)[::-1]

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=1):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base):
	newnumber = 0
	while number > 0:
		newnumber += number % base
		number //= base
	return newnumber

def cdiv(n, k):
	return n // k + (n % k != 0)
ans = []
for _ in range(ii()):
	(n, k) = mi()
	s = ['a'] * n
	p1 = math.ceil(math.sqrt(2 * k + 0.25) - 0.5)
	p2 = k - p1 * (p1 - 1) // 2 - 1
	s[p1] = 'b'
	s[p2] = 'b'
	s.reverse()
	ans.append(''.join(s))
print(*ans, sep='\n')


t = int(input())
while t > 0:
	t = t - 1
	(n, k) = map(int, input().split())
	a = 'a'
	b = 'b'
	s = list(a * n)
	c = 0
	for i in range(n):
		if k > i * (i + 1) // 2:
			continue
		else:
			j = i
			i = i - 1
			m = k - i * (i + 1) // 2
			break
	s[n - (1 + j)] = 'b'
	s[n - m] = 'b'
	ans = ''.join(s)
	print(ans)


for t in range(int(input())):
	(n, k) = map(int, input().split())
	q = 0
	for i in range(1, n):
		if i * (i + 1) // 2 >= k:
			q = i
			break
	w = k - q * (q - 1) // 2
	w = n + 1 - w
	e = n - q
	st = ''
	for i in range(1, n + 1):
		if i == w or i == e:
			st = st + 'b'
		else:
			st = st + 'a'
	print(st)


t = int(input())
for i in range(t):
	(n, k) = [int(x) for x in input().split()]
	x = 0
	i = 1
	ans = ''
	s = ['a'] * n
	while k > x + i:
		x += i
		i += 1
	x += i
	s[-i - 1] = 'b'
	s[-i - 1 + (x - k) + 1] = 'b'
	for i in range(n):
		ans += s[i]
	print(ans)


from array import array
pref = array('Q')
pref.append(0)
pref.append(0)
for i in range(2, 100001):
	pref.append(pref[i - 1] + (i - 1))

def read():
	(n, k) = map(int, input().split())
	return (n, k)

def solve(n, k):
	(i1, i2) = (0, 100000)
	while abs(i2 - i1) > 1:
		i = (i2 + i1) // 2
		if pref[i] < k:
			i1 = i
		else:
			i2 = i
	base = i1 if pref[i1] == k else i2
	s = 'a' * (n - base) + 'b'
	left = base - 1
	k -= pref[base - 1]
	s += (left - k) * 'a' + 'b' + (k - 1) * 'a'
	return s
for t in range(int(input())):
	result = solve(*read())
	print(result)


import math
T = int(input())
for _ in range(T):
	(n, k) = [int(ele) for ele in input().split(' ')]
	S = list('a' * n)
	i = math.ceil((-1 + math.sqrt(1 + 8 * k)) / 2)
	j = int(k - i * (i - 1) / 2) - 1
	S[i] = 'b'
	S[j] = 'b'
	S.reverse()
	print(''.join(S))


import math
for i in range(int(input())):
	(n, r) = map(int, input().split())
	x = math.floor(math.sqrt(r * 2))
	x = max(1, x - 3)
	while x * (x + 1) // 2 < r:
		x += 1
	j = x * (x + 1) // 2 - r
	print('a' * (n - x - 1) + 'b' + 'a' * j + 'b' + 'a' * (n - 2 - (n - x - 1) - j))


T = int(input())
for _ in range(0, T):
	(n, k) = map(int, input().split())
	L = ['a'] * n
	temp = 1
	big = 1
	for i in range(1, n + 10):
		if k <= i * (i + 1) // 2:
			temp = i
			big = i * (i + 1) // 2
			break
	L[n - temp - 1] = 'b'
	L[n - temp - 1 + (big - k + 1)] = 'b'
	ans = ''.join(L)
	print(ans)


from bisect import bisect_left
res = [0 for i in range(200006)]
s = 0
for i in range(1, 200006):
	s += i
	res[i - 1] = s
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	temp = bisect_left(res, k)
	if k == temp:
		(i1, i2) = (temp + 1, temp)
	else:
		(i1, i2) = (temp + 1, k - res[temp - 1] - 1)
	r = 'a' * (n - i1 - 1)
	r += 'b'
	r += 'a' * (i1 - i2 - 1)
	r += 'b'
	r += 'a' * i2
	print(r)


import math
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	i1_temp = math.ceil(((8 * k + 1) ** 0.5 - 1) / 2)
	i1 = i1_temp * (i1_temp + 1) // 2
	diff = i1 - k
	i1 = n - (i1_temp + 1)
	i2 = i1 + diff + 1
	ans = ['a'] * n
	ans[i1] = 'b'
	ans[i2] = 'b'
	print(*ans, sep='')


import bisect
n = int(input())
lst = [i * (i + 1) // 2 for i in range(100000)]
for i in range(n):
	(m, pos) = [int(i) for i in input().split()]
	pos1 = bisect.bisect_left(lst, pos, lo=0, hi=len(lst))
	pos2 = -lst[pos1 - 1] + pos - 1
	ans = ['a'] * m
	ans[m - 1 - pos1] = 'b'
	ans[m - 1 - pos2] = 'b'
	print(''.join(ans))


t = int(input())
while t:
	(n, k) = map(int, input().split())
	i = 0
	z = 1
	strr = ['a'] * n
	while i < k:
		i += z
		z += 1
	index1 = n - z
	i = 1
	z = 1
	while i <= k:
		prev = i
		i += z
		z += 1
	diff = k - prev
	index2 = n - diff - 1
	strr[index1] = 'b'
	strr[index2] = 'b'
	print(''.join(strr))
	t -= 1


def c(v):
	return v * (v - 1) // 2

def f(s, e, v):
	if s == e or e - s == 1:
		return e
	m = (s + e) // 2
	d = c(m)
	if d == v:
		return m
	if d < v:
		return f(m, e, v)
	else:
		return f(s, m, v)
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	left_b_pos = f(1, n, k)
	right_b_pos = k - c(left_b_pos - 1)
	left_a = n - left_b_pos
	right_a = right_b_pos - 1
	mid_a = n - left_a - right_a - 2
	print('a' * left_a + 'b' + 'a' * mid_a + 'b' + 'a' * right_a)


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

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

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

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

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

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

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

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

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

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
for _ in range(int(data())):
	(n, k) = sp()
	temp = ceil((-1 + sqrt(1 + 8 * k)) / 2)
	b1 = n - temp - 1
	b2 = temp * (temp + 1) // 2 - k + 1
	b2 += b1
	answer = []
	for i in range(n):
		if i == b1 or i == b2:
			answer.append('b')
		else:
			answer.append('a')
	outln(''.join(answer))


T = int(input())
for i in range(T):
	(n, k) = map(int, input().split())
	s = ['a'] * n
	for j in range(n - 2, 0 - 1, -1):
		if k <= n - j - 1:
			s[j] = 'b'
			s[n - k] = 'b'
			print(''.join(s))
			break
		k -= n - j - 1


import sys
input = sys.stdin.readline

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

def str_array():
	return input().strip().split()
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
from itertools import permutations
import math

def solve():
	(n, k) = map(int, input().split())
	a = ['a' for _ in range(n)]
	val = 0
	for i in range(int(k ** 0.5), k + 1):
		if i * (i + 1) // 2 >= k:
			val = i
			break
	an = val * (val + 1) // 2 - k
	a[-val - 1] = 'b'
	a[-val + an] = 'b'
	a = ''.join(a)
	print(a)
for _ in range(int(input())):
	solve()


import math
t = eval(input())
for _ in range(t):
	(n, k) = [int(x) for x in input().split()]
	s = math.floor(math.sqrt(2 * k))
	if s * (s + 1) / 2 < k:
		s += 1
	former = s * (s - 1) / 2
	diff = k - former
	for i in range(n, 0, -1):
		if i == diff or i == s + 1:
			print('b', end='')
		else:
			print('a', end='')
	print()


import sys

def process(n, k):
	n1 = 1
	while n1 * (n1 - 1) / 2 < k:
		n1 += 1
	diff = n1 * (n1 - 1) // 2 - k
	coordb2 = n - n1 + 1 + diff
	s = list('a' * n)
	s[n - n1] = 'b'
	s[coordb2] = 'b'
	print(''.join(s))
input = sys.stdin.readline

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

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

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

def invr():
	return map(int, input().split())
t = inp()
for i in range(t):
	AB = inlt()
	(a, b) = (AB[0], AB[1])
	process(a, b)


from math import *
t = int(input())
while t > 0:
	(n, k) = [int(x) for x in input().split()]
	x = ceil((ceil(sqrt(1 + 8 * k)) - 1) / 2)
	y = k - x * (x - 1) // 2 - 1
	f = ''
	for i in range(n):
		if i == y or i == x:
			f += 'b'
		else:
			f += 'a'
	f = f[::-1]
	print(f)
	t -= 1


x = int(input())
for t in range(x):
	(n, m) = map(int, input().split())
	i = 1
	while m > i:
		m -= i
		i += 1
	print('a' * (n - i - 1) + 'b' + 'a' * (i - m) + 'b' + 'a' * (m - 1))


def solve(n, k, ans):
	low = 1
	high = n
	x = -1
	while low <= high:
		mid = (low + high) // 2
		if mid * (mid + 1) // 2 <= k:
			low = mid + 1
			x = mid
		else:
			high = mid - 1
	k -= x * (x + 1) // 2
	s = ['a'] * n
	if k > 0:
		x += 1
		s[-x - 1] = 'b'
		s[-k] = 'b'
	else:
		s[-x - 1] = 'b'
		s[-x] = 'b'
	ans.append(s)

def main():
	t = int(input())
	ans = []
	for i in range(t):
		(n, k) = map(int, input().split())
		solve(n, k, ans)
	for i in ans:
		for j in i:
			print(j, end='')
		print()
main()


import math

def find_(n, k):
	x = int(math.ceil((-1 + (1 + 8 * k) ** 0.5) / 2))
	p = x * (x - 1) / 2
	x = x
	y = int(k - p - 1)
	a = ['a'] * n
	a[x] = 'b'
	a[y] = 'b'
	return ''.join(a[::-1])
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	print(find_(n, k))


def get_string(n, k):
	(res, step) = (0, 0)
	for i in range(1, n):
		if res + i >= k:
			step = i
			break
		res += i
	ans = ['a'] * n
	ans[-(step + 1)] = 'b'
	ans[-(k - res)] = 'b'
	return ''.join(ans)
t = int(input())
for i in range(1, t + 1):
	(n, k) = [int(s) for s in input().split(' ')]
	h = get_string(n, k)
	print(h)


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	i = 1
	s = 0
	while s < k:
		s += i
		i += 1
	print('a' * (n - i) + 'b' + 'a' * (s - k) + 'b' + 'a' * (k + i - 2 - s))


import math
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	x = (math.sqrt(1 + 8 * k) - 1) // 2
	x = int(x)
	rem = k - x * (x + 1) // 2
	ans = list('a' * n)
	if rem == 0:
		ans[n - x - 1] = 'b'
		ans[n - x] = 'b'
		print(*ans, sep='')
	else:
		ans[n - x - 2] = 'b'
		ans[n - rem] = 'b'
		print(*ans, sep='')


l = []
for i in range(1000001):
	x = i * (i - 1) // 2
	l.append(x)
t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	for j in range(len(l)):
		if l[j] >= b:
			break
	x = j - 1
	y = b - l[x] - 1
	m = ['a'] * a
	m[x] = 'b'
	m[y] = 'b'
	for j in m[::-1]:
		print(j, end='')
	print()


import math
T = int(input())
for t in range(T):
	(n, k) = [int(i) for i in input().split(' ')]
	a = math.ceil((-1 + math.sqrt(8 * k + 1)) / 2)
	bf = n - 1 - a
	bs = bf + int(a * (a + 1) / 2) - k + 1
	ans = ['a'] * n
	ans[bf] = 'b'
	ans[bs] = 'b'
	print(''.join(ans))


import math

def term(n):
	x = (1 + math.sqrt(1 + 8 * n)) / 2
	return int(x)

def findNumber(n):
	n -= 1
	i = 1
	while n >= 0:
		n -= i
		i += 1
	return int(n + i)
t = int(input())
for i in range(t):
	(n, k) = list(map(int, input().split()))
	number_1 = n - term(k - 1)
	number_2 = n - (findNumber(k) - 1)
	STR = list(n * 'a')
	STR[number_1 - 1] = 'b'
	STR[number_2 - 1] = 'b'
	print(''.join(STR))


T = int(input())
for _ in range(T):
	(n, k) = map(int, input().split())
	output = ['a'] * n
	for i in range(n - 2, -1, -1):
		if k <= n - 1 - i:
			output[i] = 'b'
			output[n - k] = 'b'
			for ch in output:
				print(ch, end='')
			print()
			break
		else:
			k -= n - 1 - i


from math import ceil
for _ in range(int(input())):
	(n, k) = (int(x) for x in input().split())
	ans = list(n * 'a')
	a = ceil(0.5 * ((8 * k + 1) ** 0.5 - 1))
	n = a - 1
	b = n * (2 * 1 + (n - 1)) >> 1
	b = k - b
	ans[-a - 1] = 'b'
	ans[-b] = 'b'
	print(''.join(ans))


import math
for t in range(int(input())):
	(n, k) = map(int, input().split())
	x = int(math.sqrt(2 * k)) - 1
	while (x + 1) * (x + 2) // 2 <= k:
		x += 1
	k -= x * (x + 1) // 2
	u = n - (x + 1)
	v = n + 1 - k
	if k == 0:
		u = n - x
		v = u + 1
	print('a' * (u - 1) + 'b' + 'a' * (v - u - 1) + 'b' + 'a' * (n - v))


import sys
input = lambda : sys.stdin.readline().strip()
ipnut = input

def main(t=1):
	for i in range(t):
		(n, k) = map(int, ipnut().split())
		ans = ['a'] * n
		for i in range(1, n + 1):
			if k - i < 0:
				ans[i] = 'b'
				ans[k - 1] = 'b'
				break
			elif k == i:
				ans[i] = 'b'
				ans[i - 1] = 'b'
				break
			k -= i
		print(''.join(ans[::-1]))
main(int(input()))


a = int(input())
for _ in range(a):
	(n, x) = map(int, input().split())
	l1 = 0
	l2 = 1
	m = ['a'] * n
	i = 0
	while i < x:
		if x > i + l2 - l1:
			i = i + l2 - l1
			l2 = l2 + 1
		else:
			l1 = l1 + 1
			i += 1
	l1 -= 1
	m[l1] = 'b'
	m[l2] = 'b'
	m.reverse()
	print(''.join(map(str, m)))


t = int(input())
list_ans = []
for i in range(t):
	(x, y) = map(int, input().split())
	for s in range(1, x + 1):
		if s * (s + 1) // 2 >= y:
			break
	m = y - s * (s - 1) // 2
	str1 = 'a' * (x - s - 1) + 'b' + 'a' * (s + 1 - m - 1) + 'b' + 'a' * (m - 1)
	list_ans.append(str1)
for item in list_ans:
	print(item)


def solve(n, k):
	for i in range(n - 2, -1, -1):
		if k <= n - i - 1:
			comb = ['a' for y in range(n)]
			comb[i] = 'b'
			comb[-k] = 'b'
			return ''.join(comb)
		else:
			k -= n - i - 1
t = int(input())
for i in range(t):
	(n, k) = [int(s) for s in input().split()]
	print(solve(n, k))


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	count = 1
	while k - count > 0:
		k -= count
		count += 1
	print('a' * (n - count - 1) + 'b' + 'a' * (count - k) + 'b' + 'a' * (k - 1))


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	p = (1 + (8 * k + 1) ** 0.5) / 2
	if int(p) == p:
		p = int(p)
	else:
		p = int(p) + 1
	ans = 'a' * n
	(ind1, ind2) = (n - p, n - (k - (p - 1) * (p - 2) // 2))
	ans = 'a' * ind1 + 'b' + 'a' * (ind2 - ind1 - 1) + 'b' + 'a' * (n - ind2 - 1)
	print(ans)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
mod2 = 998244353
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

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

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

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

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))

def main():
	t = I()
	rr = []
	for _ in range(t):
		(n, k) = LI()
		r = ['a'] * n
		i = 1
		while k > i:
			k -= i
			i += 1
		r[-i - 1] = 'b'
		r[-k] = 'b'
		rr.append(JA(r, ''))
	return JA(rr, '\n')
print(main())


from sys import stdin
from bisect import bisect_left
N = 100010
triangular = [0]
for n in range(1, N):
	triangular.append(triangular[-1] + n)

def solve(n, k):
	pos = bisect_left(triangular, k)
	b1 = n - pos - 1
	b2 = b1 + triangular[pos] - k + 1
	return 'a' * b1 + 'b' + 'a' * (b2 - b1 - 1) + 'b' + 'a' * (n - b2 - 1)
input()
for line in stdin:
	(n, k) = map(int, line.split())
	print(solve(n, k))


def bix(x):
	(ans, i) = (0, 0)
	while ans <= 2 * x:
		ans = i ** 2 + i + 2
		i += 1
	return i - 2

def bi(b):
	ans = '1'
	m = bix(b)
	k = (m ** 2 + m) // 2 + 1
	ans += '0' * (m - b + k)
	ans += '1'
	ans += '0' * (b - k)
	return ans
for i in range(int(input())):
	(a, b) = list(map(int, input().split()))
	x = bi(b)
	k = len(x)
	ans = 'a' * (a - k) + x
	ans = ans.replace('0', 'a')
	ans = ans.replace('1', 'b')
	print(ans)


import sys
import math
import time
c = int(input())
for i in range(c):
	ans = ''
	(n, k) = [int(j) for j in input().split()]
	q = (1 + (1 + 8 * (k - 1)) ** 0.5) / 2
	fas = n - math.floor(q) - 1
	ans += 'a' * fas + 'b'
	lft = n - fas - 1
	bpl = int(k - ((math.floor(q) - 1) ** 2 + math.floor(q) - 1) / 2)
	lft -= bpl
	ans += 'a' * lft
	ans += 'b' + 'a' * (bpl - 1)
	print(ans)


from math import sqrt
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	(n1, n2) = (0, 0)
	tn = int(sqrt(2 * k))
	while k > tn * (tn + 1) // 2:
		tn += 1
	(n1, n2) = (tn - 1, tn)
	dk = k - n1 * (n1 + 1) // 2
	n1 = dk - 1
	for i in range(n - 1, -1, -1):
		if i == n1 or i == n2:
			print('b', end='')
		else:
			print('a', end='')
	print()


import bisect
t = int(input())
s = []
ssu = 0
for i in range(1, 10 ** 5 + 1):
	ssu += i
	s.append(ssu)
for i in range(t):
	(n, kk) = map(int, input().split())
	aa = 'a' * (n - 2)
	c = bisect.bisect_left(s, kk)
	b1 = c
	if kk == 1:
		b2 = 0
	else:
		b2 = kk - s[b1 - 1] - 1
	d = list(aa)
	d.insert(b1, 'b')
	d.insert(b2, 'b')
	dd = ''.join(d)
	print(dd[::-1])


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	b = 0
	i = 1
	a = 0
	x = ''
	while i < n * (n - 1) / 2:
		if i <= k <= i + b:
			break
		else:
			b += 1
			i += b
		a += 1
	b_pos = n - a - 1
	if b_pos > 0:
		x = 'a' * (n - a - 2) + 'b'
	else:
		x = 'b'
	num_a = n - len(x) - 1 - (k - i)
	x += 'a' * num_a
	x += 'b'
	x += 'a' * (n - len(x))
	print(x)


import math

def bs(k):
	l = 1
	h = math.ceil(math.sqrt(2 * k)) + 1
	while l <= h:
		mid = l + (h - l) // 2
		q = mid * (mid - 1) // 2
		if q == k:
			return mid
		elif q < k:
			l = mid + 1
		else:
			h = mid - 1
	return h
t = int(input())
for _ in range(t):
	l = [int(x) for x in input().split(' ')]
	(n, k) = l[:]
	lsn = bs(k)
	q = lsn * (lsn - 1) // 2
	if q == k:
		s = ''
		a = 'a' * (n - lsn)
		s += a
		s += 'bb'
		a = 'a' * (lsn - 2)
		s += a
		print(s)
	else:
		s = ''
		a = 'a' * (n - lsn - 1)
		s += a
		s += 'b'
		las = k - q - 1
		mas = lsn + 1 - 2 - las
		a = 'a' * mas
		s += a
		s += 'b'
		a = 'a' * las
		s += a
		print(s)


testes = int(input())
for t in range(testes):
	ent = input().split(' ')
	n = int(ent[0])
	index = int(ent[1])
	b1 = n - 2
	b2 = n - 1
	pos = 0
	chave = 0
	for k in range(1, n):
		if pos >= index:
			break
		else:
			pos += k
			chave = k
	b1 = b1 - chave + 1
	pos -= chave
	x = index - pos
	b2 = b2 - x + 1
	str = ''
	for i in range(n):
		if i == b1 or i == b2:
			str += 'b'
		else:
			str += 'a'
	print(str)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = list('a' * n)
	for i in range(1, n):
		if k <= i:
			s[n - 1 - i] = s[n - k] = 'b'
			break
		k -= i
	print(''.join(s))


import math
t = int(input())

def UpperBound(x):
	low = 1
	high = 10 ** 9 + 2
	while low < high:
		k = (low + high) // 2
		if (1 + k) * k // 2 > x:
			high = k - 1
		else:
			low = k + 1
	if x == 1:
		return 1
	for i in range(max(2, k - 4), k + 5):
		if (1 + i) * i // 2 >= x:
			return i
for _ in range(t):
	(n, k) = map(int, input().split())
	m = UpperBound(k)
	print('a' * (n - 1 - m) + 'b' + (m * (m + 1) // 2 - k) * 'a' + 'b' + 'a' * (m - 1 + k - m * (m + 1) // 2))


i = 2
l = []
while 1:
	x = i * (i - 1) // 2
	if x > 2 * 10 ** 9:
		break
	l.append(x)
	i += 1
from bisect import bisect_right as br
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	x = br(l, k)
	p = [''] * n
	if l[x - 1] == k:
		p[n - x] = 'b'
		p[n - x - 1] = 'b'
		for i in range(len(p)):
			if p[i] == '':
				p[i] = 'a'
	else:
		p[n - x - 2] = 'b'
		tem = k - l[x - 1]
		p[-tem] = 'b'
		for i in range(len(p)):
			if p[i] == '':
				p[i] = 'a'
	ans = ''
	for i in p:
		ans += i
	print(ans)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	sm = 0
	i = 0
	while k - sm > 0:
		i += 1
		sm += i
	ans = 'a' * (n - i - 1) + 'b' + 'a' * abs(sm - k) + 'b'
	ans = ans + 'a' * (n - len(ans))
	print(ans)


import math
for _ in range(int(input())):
	(a, b) = map(int, input().split(' '))
	lis = ['a'] * a
	for i in range(a):
		n = math.ceil((-1 + math.sqrt(1 + 8 * b)) / 2)
		lis[n] = 'b'
		lis[n - n * (n + 1) // 2 + b - 1] = 'b'
	lis.reverse()
	print(''.join(lis))


N = int(input())
arr = []
for i in range(N):
	temp = input().split()
	arr.append([int(temp[0]), int(temp[1])])

def func(n, k):
	start = 0
	run_sum = n - 1
	to_add = n - 2
	while run_sum < k:
		run_sum += to_add
		to_add -= 1
		start += 1
	pos1 = start
	pos2 = n - (run_sum - k) - 1
	s = ''
	for i in range(n):
		if i == pos1 or i == pos2:
			s = s + 'b'
		else:
			s += 'a'
	print(s)
for i in range(N):
	n = arr[i][0]
	k = arr[i][1]
	func(n, n * (n - 1) // 2 - k + 1)


from bisect import bisect_left
t = int(input())
from math import ceil
for _ in range(t):
	(n, k) = map(int, input().split())
	j = 1
	s = []
	s = set(s)
	for i in range(n - 1):
		s.add(j + i)
		j = j + i
	if k in s:
		s = list(s)
		i = s.index(k)
		k = len(s) - i - 1
		ans = ''
		for i in range(k):
			print('a', end='')
		print('b', end='')
		for i in range(k + 1, n - 1):
			print('a', end='')
		print('b')
	else:
		s = list(s)
		i = bisect_left(s, k)
		p = k
		temp = s[i - 1]
		i = s.index(temp)
		k = len(s) - i - 1
		ans = ''
		for _ in range(k):
			print('a', end='')
		print('b', end='')
		p = p - temp
		p = n - 1 - p
		for i in range(k + 1, n):
			if i == p:
				print('b', end='')
			else:
				print('a', end='')
		print()


from itertools import permutations

def solve():
	(n, k) = map(int, input().split(' '))
	pt1 = n - 2
	pt2 = n - 1
	i = 0
	while pt1 >= 0 and pt2 >= 0:
		if i == k - 1:
			break
		pt1 -= 1
		pt2 = n - 1
		i += 1
		i += n - 1 - (pt1 + 1)
		pt2 = pt1 + 1
		if i > k - 1:
			pt2 += i - (k - 1)
			break
	ans = ''
	for i in range(n):
		if i == pt1 or i == pt2:
			ans += 'b'
		else:
			ans += 'a'
	return ans
t = int(input())
for _ in range(t):
	print(solve())


import sys

def search_indexes(n, k):
	min_index = 2
	max_index = n + 1
	while 1:
		index = (min_index + max_index) // 2
		temp = (index - 1) * (index - 2) // 2
		a = temp + 1
		b = temp + index - 1
		if k < a:
			max_index = index
		elif k > b:
			min_index = index
		else:
			break
	return (index, k - a + 1)

def print_string(n, i, j):
	string = ''
	for index in range(n):
		if n - index in (i, j):
			string += 'b'
		else:
			string += 'a'
	print(string)

def main():
	next(sys.stdin)
	for line in sys.stdin:
		(n, k) = tuple(map(lambda x: int(x), line.split()))
		(i, j) = search_indexes(n, k)
		print_string(n, i, j)
main()


t = int(input())
for _ in range(t):
	(n, k) = list(map(int, input().split()))
	letters = ['a'] * n
	current = 0
	for i in range(1, n):
		current += i
		if current >= k:
			break
	current -= i
	letters[-i - 1] = 'b'
	letters[-(k - current)] = 'b'
	print(''.join(letters))


def k_string(n, k):
	a = ''
	for _ in range(n):
		t = int(0.5 * n * (n - 1))
		if k > t - (n - 1):
			a += 'b'
			c = ['a' for _ in range(n - 1)]
			c[t - k] = 'b'
			a += ''.join(c)
			return a
		else:
			a += 'a'
			n -= 1
	return a

def ub(x):
	d = pow(1 + 8 * x, 0.5)
	d = (d + 1) // 2
	d += 1
	return max(3, int(d))
n = int(input())
b = []
for _ in range(n):
	(m, k) = input().split(' ')
	m = int(m)
	k = int(k)
	d = min(m, ub(k))
	c = ['a' for _ in range(m - d)]
	c = ''.join(c)
	c += k_string(d, k)
	b.append(c)
for i in b:
	print(i)


t = int(input())
while t:
	(n, k) = map(int, input().split())
	ans = ['a'] * n
	for i in reversed(range(0, n - 1)):
		if k <= n - i - 1:
			ans[i] = 'b'
			ans[n - k] = 'b'
			break
		k -= n - i - 1
	print(''.join(ans))
	t -= 1


from math import floor, sqrt

def sigma(n):
	return n * (n - 1) // 2

def sigma_inv(n):
	f = 1 / 2 + sqrt(2 * n - 2 + 1 / 4)
	return floor(f)
n = int(input())
for _ in range(n):
	(s, k) = map(int, input().split())
	ans = ['a'] * s
	b2 = k - sigma(sigma_inv(k))
	b1 = floor(sigma_inv(k)) + 1
	ans[-b2] = 'b'
	ans[-b1] = 'b'
	print(*ans, sep='')


capacityArray = [0] * 100001
capacityArray[len(capacityArray) - 2] = 1
for i in range(len(capacityArray) - 3, 0, -1):
	capacityArray[i] = capacityArray[i + 1] + (len(capacityArray) - 1 - (i + 1))

def solve(n, k):
	result = list('a' * n)
	firstIndex = None
	endIndex = None
	distance = 2
	for i in range(len(capacityArray) - 3, 0, -1):
		if capacityArray[i] > k:
			firstIndex = distance - 1
			endIndex = k - capacityArray[i + 1]
			break
		distance += 1
	result[-(firstIndex + 1)] = 'b'
	result[-(endIndex + 1)] = 'b'
	return ''.join(result)
numCases = int(input().strip())
for i in range(0, numCases):
	(n, k) = [int(x) for x in input().strip().split()]
	print(solve(n, k))


for i in range(int(input())):
	(n, k) = (int(j) for j in input().split())
	sum = 1
	j = 2
	while sum < k:
		sum += j
		j += 1
	d = int(2 ** (j - 1) + 2 ** (k - sum + j - 2))
	print('a' * (n - len(bin(d)[2:])) + bin(d)[2:].replace('1', 'b').replace('0', 'a'))


from math import ceil

def l1(k):
	return ceil(((1 + 8 * k) ** 0.5 - 1) / 2)
for _ in range(int(input())):
	(n, k) = list(map(int, input().split()))
	s = ['a' for i in range(n)]
	b = l1(k)
	s[n - b - 1] = 'b'
	a = k - (b - 1) * b // 2
	s[-a] = 'b'
	print(''.join(s))


arr = [0] * 10 ** 5
t_sum = 0
for i in range(1, 10 ** 5):
	t_sum += i
	arr[i - 1] = t_sum
(p1, p2) = (0, 10 ** 5)

def bs(ele, arr, p1, p2):
	if ele < arr[0]:
		return 1
	mid = (p1 + p2) // 2
	if arr[mid] == ele:
		return mid + 1
	elif arr[mid] > ele:
		if arr[mid - 1] < ele:
			return mid + 1
		else:
			return bs(ele, arr, p1, mid)
	elif arr[mid + 1] > ele:
		return mid + 2
	else:
		return bs(ele, arr, mid, p2)
t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	temp = bs(k, arr, p1, p2) - 1
	c1 = n - 2 - temp
	c2 = c1 + 1 + arr[temp] - k
	ans = ['a'] * n
	(ans[c1], ans[c2]) = ('b', 'b')
	print(''.join(map(str, ans)))


t = int(input())
ans = []
for i in range(t):
	(n, k) = map(int, input().split())
	for j in range(n):
		if k <= j * (j + 1) / 2:
			index1 = j
			break
	index2 = k - index1 * (index1 - 1) // 2 - 1
	temp = ['a'] * n
	temp[index1] = 'b'
	temp[index2] = 'b'
	temp = temp[::-1]
	ans.append(''.join(temp))
ans = '\n'.join(ans)
print(ans)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	b = 1
	c = 1
	while k - c > 0:
		k -= c
		c += 1
		b += 1
	a = ['a'] * n
	a[n - b - 1] = 'b'
	a[-k] = 'b'
	print(''.join(a))


import sys
from math import sqrt, floor
inp = sys.stdin.readline
read = lambda : list(map(int, inp().split()))

def a():
	ans = ''
	for _ in range(int(inp())):
		(a, b) = read()
		if a % b == 0:
			ans += '0\n'
		else:
			ans += str((a // b + 1) * b - a) + '\n'
	print(ans)

def b():
	ans = ''
	for _ in range(int(inp())):
		(n, k) = read()
		(f1, f2) = (n - 2, n - 1)
		l = floor(sqrt(2 * k))
		while (l + 1) * l // 2 < k:
			l += 1
		f1 -= l - 1
		f2 -= k - l * (l - 1) // 2 - 1
		res = ''
		for i in range(n):
			if i in (f1, f2):
				res += 'b'
			else:
				res += 'a'
		ans += res + '\n'
	print(ans)

def c():
	ans = ''
	for _ in range(int(inp())):
		n = int(inp())
		x = inp().strip()
		res = ['', '']
		flag = 0
		for j in x:
			if j == '1':
				if flag:
					res[1] += '1'
					res[0] += '0'
				else:
					res[1] += '0'
					res[0] += '1'
					flag = 1
			elif j == '2':
				if flag:
					res[1] += '2'
					res[0] += '0'
				else:
					res[1] += '1'
					res[0] += '1'
			else:
				res[1] += '0'
				res[0] += '0'
		ans += res[0] + '\n' + res[1] + '\n'
	print(ans)

def d():
	ans = ''
	for _ in range(int(inp())):
		n = int(inp())
		arr = read()
		ans_arr = [None] * n
		if arr[0] == arr[-1]:
			(ans_arr[0], ans_arr[-1]) = (1, 1)
		else:
			(ans_arr[0], ans_arr[-1]) = (1, 2)
		col = [1, 2]
		j = 0
		for j in range(1, n - 2):
			if arr[i - 1] != arr[i]:
				ans_arr[i] = col[arr[i - 1] % 2]
			else:
				ans_arr[i] = col[arr[i - 1]]
		print(j)
		if ans_arr[j] == ans_arr[(j + 2) % n]:
			ans_arr[j + 1] = col[ans_arr[j] % 2]
		else:
			ans_arr[(j + 1) % n] = 3
	print(*ans_arr)
b()


import sys

def input():
	return sys.stdin.readline()[:-1]
t = int(input())
for _ in range(t):
	(n, k) = list(map(int, input().split()))
	(cur, level, add) = (0, 0, 1)
	k -= 1
	while k >= cur + add:
		cur += add
		level += 1
		add += 1
	(x, y) = (n - 2 - level, n - 1 - (k - cur))
	ans = ['a' for _ in range(n)]
	(ans[x], ans[y]) = ('b', 'b')
	print(''.join(ans))


T = int(input())
arr = []
temp = 0
for i in range(100001):
	temp += i
	arr.append(temp)
for case in range(T):
	(m, n) = [int(x) for x in input().split(' ')]
	pos1 = 0
	pos2 = 0
	for (i, a) in enumerate(arr):
		if n <= a:
			pos1 = m - i - 1
			pos2 = m - i - 1 + 1 + (a - n)
			break
	ret = 'a' * m
	ret = ret[:pos1] + 'b' + ret[pos1 + 1:]
	ret = ret[:pos2] + 'b' + ret[pos2 + 1:]
	print(ret)


def searc(ar, i, j, x, f):
	if i > j:
		f[0] = j
		return
	mid = i + (j - i) // 2
	if ar[mid] == x:
		f[0] = mid
		return
	elif ar[mid] > x:
		searc(ar, i, mid - 1, x, f)
	else:
		searc(ar, mid + 1, j, x, f)
A = [0]
for i in range(1, 100001):
	A.append(A[i - 1] + i)
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if a > 3:
		fa = [0]
		searc(A, 0, a, b, fa)
		x = fa[0]
		y = b - A[x]
		ans = ['a' for i in range(a)]
		if y == 0:
			ans[-x - 1] = 'b'
			ans[-x] = 'b'
		else:
			ans[-x - 2] = 'b'
			ans[-y] = 'b'
		print(''.join(ans))
	else:
		ss = ['abb', 'bab', 'bba']
		print(ss[b - 1])


from math import sqrt, ceil
t = int(input())
for _ in range(t):
	a = input().split()
	n = int(a[0])
	k = int(a[1])
	num = ceil((-1 + sqrt(1 + 8 * k)) / 2)
	(n1, n2) = (num + 1, k - int(num * (num - 1) / 2))
	st = ['a'] * n
	(st[n - n1], st[n - n2]) = ('b', 'b')
	s = ''.join(st)
	print(s)


def func(n, k):
	l = list('a' * n)
	s = ''
	for i in range(n - 1, -1, -1):
		if k <= n - i - 1:
			l[i] = 'b'
			l[n - k] = 'b'
			for j in l:
				s += j
			return s
		k -= n - i - 1
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	tot = n * (n - 1) >> 2
	print(func(n, k))


def solve(n, k):
	i = 1
	cnt = 1
	while cnt < k:
		i += 1
		cnt += i
	j = i - 1
	while cnt > k:
		j -= 1
		cnt -= 1
	return (i, j)
lines = int(input())
for _ in range(lines):
	line = input().split(' ')
	(n, k) = (int(line[0]), int(line[1]))
	(i, j) = solve(n, k)
	s = ['a'] * n
	s[n - i - 1] = s[n - j - 1] = 'b'
	print(''.join(s))


def proB(n, k):
	if k == 1:
		return 'a' * (n - 2) + 'b' * 2
	if k == n * (n - 1) // 2:
		kk = 'a' * (n - 2) + 'b' * 2
		return kk[::-1]
	c = 1
	op = 2
	pos = n - 3
	ans = ['a'] * n
	while n != 0:
		if c + op >= k:
			break
		if c + op < k:
			c += op
			op += 1
		pos -= 1
	ans[pos] = 'b'
	fin = 0
	for i in range(op):
		if c == k:
			break
		c += 1
		fin += 1
	ans[n - fin] = 'b'
	return ''.join(ans)
n = int(input())
for i in range(n):
	arr = list(map(int, input().split()))
	(n, k) = arr
	print(proB(n, k))


from collections import defaultdict as dd, deque as dq
import sys
input = sys.stdin.readline
t = int(input())
import bisect
l = [1]
for i in range(2, 100000):
	l.append(l[-1] + i)
while t:
	(a, b) = map(int, input().split())
	ind = bisect.bisect_left(l, b)
	ll = ['a'] * a
	ll[a - ind - 2] = 'b'
	if ind == 0:
		ll[a - 1] = 'b'
	else:
		ind -= 1
		di = b - l[ind]
		ll[a - di] = 'b'
	print(*ll, sep='')
	t -= 1


def to_list(s):
	return list(map(lambda x: int(x), s.split(' ')))

def get_pos_number(k, numbers):
	for i in range(len(numbers)):
		if numbers[i] >= k:
			fbp = i + 2
			if numbers[i] == k:
				sbp = fbp - 1
			else:
				sbp = max(0, k - numbers[i - 1])
			return (fbp, sbp)

def get_str(fbp, sbp, n):
	s = 'a' * n
	s = s[:n - fbp] + 'b' + s[n - fbp + 1:]
	s = s[:n - sbp] + 'b' + s[n - sbp + 1:]
	return s

def solve(n, k, numbers):
	(fbp, sbp) = get_pos_number(k, numbers)
	s = get_str(fbp, sbp, n)
	return s
numbers = []
k = 1
i = 2
while k < 2 * 10 ** 10 + 1:
	numbers.append(k)
	k += i
	i += 1
t = int(input())
answers = []
for i in range(t):
	(n, k) = to_list(input())
	answers.append(solve(n, k, numbers))
print('\n'.join(answers))


testCases = int(input())
for _ in range(testCases):
	(n, k) = map(int, input().split())
	i = 1
	while k > i:
		k -= i
		i += 1
	print('a' * (n - i - 1) + 'b' + 'a' * (i - k) + 'b' + 'a' * (k - 1))


t = int(input())
nk = []
for i in range(t):
	nk.append([int(i) for i in input().split()])
for i in range(t):
	s = ['a'] * nk[i][0]
	for j in range(nk[i][0] - 2, -1, -1):
		if nk[i][1] <= nk[i][0] - j - 1:
			s[j] = 'b'
			s[nk[i][0] - nk[i][1]] = 'b'
			print(''.join(s))
			break
		nk[i][1] += j + 1 - nk[i][0]


t = int(input())
for num in range(t):
	(n, k) = map(int, input().split())
	b1 = n - 2
	b2 = n - 1
	if k < 1000:
		i = 0
	elif k == n * (n - 1) // 2:
		b1 = 0
		b2 = 1
		i = k - 1
	else:
		i = int((1 + (1 - 4 * -1 * k * 2) ** (1 / 2)) // 2)
		b1 = n - i - 1
		i *= (i - 1) / 2
	while True:
		if i == k - 1:
			most = ['a'] * n
			most[b1] = 'b'
			most[b2] = 'b'
			print(''.join(most))
			break
		else:
			i += 1
		if b2 - b1 == 1:
			b1 -= 1
			b2 = n - 1
		else:
			b2 -= 1


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	for i in range(int(n * (n - 1) / 2) + 1):
		if i * (i - 1) / 2 >= k:
			print('a' * (n - i) + 'b' + 'a' * abs(int(i * (i - 1) / 2 - k)) + 'b' + 'a' * abs(int(i - 2 - (i * (i - 1) / 2 - k))))
			break


import heapq
t = input()
t = int(t)
for case in range(t):
	a = input().split()
	c = int(a[0])
	d = int(a[1])
	ans = ['a'] * c
	now = 0
	for i in range(10 ** 5):
		if now + i >= d:
			break
		n_i = i
		now += i
	ans[c - n_i - 2] = 'b'
	ans[-(d - now)] = 'b'
	print(''.join(ans))


t = int(input())
p = []
for _ in range(t):
	(n, k) = map(int, input().split())
	j = 0
	s = ''
	for i in range(100000):
		j += i
		if k - j <= 0:
			g = i
			gg = k - j + i
			break
	s = 'a' * (n - g - 1)
	s = s + 'b'
	ss = 'a' * (g - gg)
	s += ss
	s += 'b'
	ss = 'a' * (g - (g - gg) - 1)
	s += ss
	p.append(s)
for i in range(len(p)):
	print(p[i])


import itertools
import math
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = ['a'] * n
	fn = math.floor((pow(1 + 8 * k, 1 / 2) - 1) // 2)
	fn = int(fn)
	fsum = fn * (fn + 1) // 2
	if fsum == k:
		s[-fn] = 'b'
		s[-(fn + 1)] = 'b'
		s = ''.join(s)
		print(s)
	else:
		ans = k - fsum
		s[-ans] = 'b'
		s[-(fn + 2)] = 'b'
		s = ''.join(s)
		print(s)


t = int(input())
for test in range(t):
	(n, k) = map(int, input().split())
	if k == n * (n - 1) // 2:
		x = 'a' * (n - 2)
		print('bb' + x)
	else:
		c = 1
		s = 0
		while s < k:
			s += c
			c += 1
		c -= 1
		s -= c
		c -= 1
		p = n - c - 1
		y = 'a' * p
		q = n - p - 2
		z = 'a' * q
		t = y + 'bb' + z
		y = 'a' * (p - 1)
		z = 'a' * (n - p - 1)
		t = y + 'b' + z + 'b'
		count = k - s - 1
		final = n - count - 1
		temp = 'a' * (n - final - 1)
		mid = 'a' * (final - p)
		print(y + 'b' + mid + 'b' + temp)


for z in range(int(input())):
	(a, b) = map(int, input().split())
	j = 0
	c = b
	for i in range(1, b + 1):
		b -= i
		j += 1
		if b <= 0:
			break
	b = c
	d = j + 1
	e = b - (1 + (j - 1)) * (j - 1) // 2
	for i in range(a):
		if i == a - d or i == a - e:
			print('b', end='')
		else:
			print('a', end='')
	print('\n')


import math

def divisiblity(a, b):
	c = a % b
	if c == 0:
		return 0
	return b - c

def beautiful_string(n, k):
	a = int((math.sqrt(8 * k + 1) - 1) / 2) + 1
	b = k - int(a * (a - 1) / 2)
	if b == 0:
		s = 'a' * (n - a) + 'bb' + 'a' * (a - 2)
		return s
	else:
		s = 'a' * (n - a - 1) + 'b' + 'a' * (a - b) + 'b' + 'a' * (b - 1)
		return s
cases = int(input())
for _ in range(cases):
	(n, k) = list(map(int, input().split()))
	print(beautiful_string(n, k))

def ternary_xor(x):
	a = ''
	b = ''
	c = True
	for i in x:
		if i == '0':
			a += '0'
			b += '0'
		elif i == '1':
			if c:
				a += '1'
				b += '0'
				c = False
			else:
				a += '0'
				b += '1'
		elif c:
			a += '1'
			b += '1'
		else:
			a += '0'
			b += '2'
	return (a, b)


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	j = 1
	a = b = 0
	while True:
		if j * (j + 1) // 2 >= k:
			a = j - 1
			b = k - j * (j - 1) // 2 - 1
			break
		j += 1
	res = ['a'] * (n - 2)
	j = 0
	for (i, c) in enumerate(res):
		if c == 'a':
			j += 1
		if j == n - 2 - b:
			res.insert(i + 1, 'b')
			break
	j = 0
	for (i, c) in enumerate(res):
		if c == 'a':
			j += 1
		if j == n - 2 - a:
			res.insert(i + 1, 'b')
			break
	if b >= n - 2:
		res.insert(0, 'b')
	if a >= n - 2:
		res.insert(0, 'b')
	print(''.join(res))


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	ans = ''
	for i in range(n - 2, -1, -1):
		if k <= n - i - 1:
			ans = 'a' * i
			ans = ans + 'b'
			ans = ans + 'a' * (n - len(ans))
			break
		else:
			k -= n - i - 1
	rans = ans[0:n - k]
	rans += 'b'
	rans += 'a' * (n - len(rans))
	print(rans)


def tri(n):
	s = 0
	for i in range(1, n):
		s += i
		yield (s, i)
t = int(input())
answer = ''
for _ in range(t):
	arr = [0]
	(n, k) = map(int, input().split())
	for (s, i) in tri(n):
		arr += [s]
		if k <= s:
			b = k - arr[i - 1]
			answer = ['a'] * (n - 1 - i) + ['b'] + ['a'] * i
			answer[-b] = 'b'
			break
	print(''.join(answer))


import os
import io
import sys
from collections import Counter, defaultdict
import math
import random
import heapq as hq
from functools import reduce, cmp_to_key
from collections import deque
import threading
import bisect

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

def iinput():
	return int(input())

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

def rinput():
	return map(int, tinput())

def rlinput():
	return list(rinput())
mod = int(1000000000.0) + 7

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))
for _ in range(iinput()):
	(n, k) = rinput()
	want = -1
	s = 0
	i = 1
	while s + i < k:
		s += i
		i += 1
	ans = ['a'] * n
	ans[n - i - 1] = 'b'
	ans[-(k - s)] = 'b'
	print(''.join(ans))


t = int(input())

def solve(n, k):
	sol = ['a' for _ in range(n)]
	(sol[-1], sol[-2]) = ('b', 'b')
	(pt1, pt2) = (n - 2, n - 1)
	while k != 1:
		if pt1 + 1 == pt2:
			(sol[pt1 - 1], sol[pt1]) = (sol[pt1], sol[pt1 - 1])
			pt1 -= 1
			(sol[pt2], sol[n - 1]) = (sol[n - 1], sol[pt2])
			pt2 = n - 1
			k -= 1
		elif pt2 - pt1 >= k:
			steps = k - 1
			sol[pt2] = 'a'
			sol[pt2 - steps] = 'b'
			k = 1
		else:
			steps = pt2 - pt1 - 1
			sol[pt1 + 1] = 'b'
			sol[pt2] = 'a'
			pt2 = pt1 + 1
			k -= steps
	return ''.join(sol)
for _ in range(t):
	(n, k) = map(int, input().split())
	print(solve(n, k))


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	temp = 1
	temp1 = 1
	val = int(n * (n - 1) / 2) - (k - 1)
	a = n - 1
	while temp + a <= val:
		temp += a
		temp1 += 1
		a -= 1
	temp2 = temp1 + 1 + val - temp
	for i in range(n):
		if i == temp1 - 1 or i == temp2 - 1:
			print('b', end='')
		else:
			print('a', end='')
	print('')


t = int(input())
for q in range(t):
	(n, k) = map(int, input().split())
	ans = ''
	i = 0
	while (n - i) * (n - i - 1) // 2 >= k:
		i += 1
		if (n - i) * (n - i - 1) // 2 >= k:
			ans += 'a'
	ans += 'b'
	y = k - (n - i) * (n - i - 1) // 2
	r = n - y
	while i < n:
		if i == r:
			ans += 'b'
		else:
			ans += 'a'
		i += 1
	print(ans)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	total = 1
	index = 2
	while k > total:
		index += 1
		total += index - 1
	print('a' * (n - index) + 'b' + 'a' * (total - k) + 'b' + 'a' * (index + k - total - 2))


arr = [1]
zz = 10 ** 5 + 100
for i in range(1, zz):
	arr.append(arr[-1] + i)
from bisect import bisect_left as bl, bisect_right as br
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	ind = bl(arr, k)
	if arr[ind] != k:
		ind -= 1
	if arr[ind + 1] == k:
		ans = 0
	else:
		ans = k - arr[ind]
	x = n - 1 - abs(ans)
	y = n - ind - 2
	rans = ['a'] * n
	rans[x] = 'b'
	rans[y] = 'b'
	print(''.join(rans))


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	s = 'a' * n
	d = 0
	if k == 1:
		print('a' * (n - 2) + 'bb')
	elif k == 2:
		print('a' * (n - 3) + 'bab')
	elif k == 3:
		print('a' * (n - 3) + 'bba')
	else:
		d = 1
		for i in range(3, n + 1):
			b = i * (i - 1) // 2
			if b >= k:
				break
	if d == 1:
		f = (i - 1) * (i - 2) // 2
		if b == k:
			s = s[0:n - i] + 'bb' + s[n - i + 2:]
			print(s)
		elif b > k:
			s = s[0:n - i] + 'b' + s[n - i + 1:n - (k - f)] + 'b' + s[n - (k - f) + 1:]
			print(s)


for nt in range(int(input())):
	(n, k) = map(int, input().split())
	for i in range(1, n + 1):
		c = i * (i + 1) // 2
		if k <= c:
			pos1 = i
			pos2 = k - 1 - i * (i - 1) // 2
			break
	ans = ''
	for i in range(n - 1, -1, -1):
		if i == pos1 or i == pos2:
			ans += 'b'
		else:
			ans += 'a'
	print(ans)


t = int(input())
for q in range(t):
	(n, k) = list(map(int, input().split()))
	c_r = 0
	i = 0
	while c_r < k:
		i += 1
		c_r += i
	sec_ind = c_r - k + 1
	s = ''
	for j in range(1, n + 1):
		if j == n - i or j == n - (i - sec_ind):
			s += 'b'
		else:
			s += 'a'
	print(s)


from math import factorial
from collections import Counter, defaultdict
from heapq import heapify, heappop, heappush
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

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

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

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

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

class IOWrapper(IOBase):

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

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

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

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

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

def mdis(x1, y1, x2, y2):
	return abs(x1 - x2) + abs(y1 - y2)
mod = 1000000007
INF = float('inf')

def main():
	for _ in range(N()):
		(n, k) = RL()
		res = ['a' for _ in range(n)]
		bs = 1
		tk = k
		while tk > bs:
			tk -= bs
			bs += 1
		res[-(bs + 1)] = 'b'
		res[-tk] = 'b'
		print(''.join(res))
main()


t = int(input())
for T in range(t):
	(n, k) = map(int, input().split())
	res = n * ['a']
	for lb in range(n - 2, -1, -1):
		free = n - 1 - lb
		if free >= k:
			res[lb] = 'b'
			res[n - k] = 'b'
			break
		else:
			k -= free
	print(''.join(res))


import sys
import math
input()
for line in sys.stdin:
	(n, k) = map(int, line.split())
	res = ['a'] * n
	a = int(math.sqrt(k)) - 2
	while not 0 <= (a + 1) * a // 2 - k < a:
		a += 1
	b = (a + 1) * a // 2 - k
	res[n - a - 1] = res[n - a + b] = 'b'
	print(''.join(res))


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

class FastIO(IOBase):
	newlines = 0

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

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

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

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

class IOWrapper(IOBase):

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

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

def lower_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] >= num:
			answer = middle
			end = middle - 1
		else:
			start = middle + 1
	return answer

def upper_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] <= num:
			answer = middle
			start = middle + 1
		else:
			end = middle - 1
	return answer

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

def binary_search(li, val, lb, ub):
	ans = 0
	while lb <= ub:
		mid = (lb + ub) // 2
		if li[mid] > val:
			ub = mid - 1
		elif val > li[mid]:
			lb = mid + 1
		else:
			ans = 1
			break
	return ans

def sieve_of_eratosthenes(n):
	ans = []
	arr = [1] * (n + 1)
	(arr[0], arr[1], i) = (0, 0, 2)
	while i * i <= n:
		if arr[i] == 1:
			j = i + i
			while j <= n:
				arr[j] = 0
				j += i
		i += 1
	for k in range(n):
		if arr[k] == 1:
			ans.append(k)
	return ans

def nc2(x):
	if x == 1:
		return 0
	else:
		return x * (x - 1) // 2
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	for i in range(n - 2, -1, -1):
		if k <= n - 1 - i:
			pos1 = i
			pos2 = n - k
			break
		k -= n - 1 - i
	(pos1, pos2) = (min(pos1, pos2), max(pos1, pos2))
	for i in range(n):
		if i == pos1 or i == pos2:
			print('b', end='')
		else:
			print('a', end='')
	print('')


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	s = 'a' * a
	c = 1
	i = 1
	while True:
		if b <= c:
			b1 = a - i - 1
			b2 = b1 + 1 + (c - b)
			s = list(s)
			s[b1] = 'b'
			s[b2] = 'b'
			s = ''.join(s)
			print(s)
			break
		else:
			i = i + 1
			c = c + i


tc = int(input().strip())
for t in range(tc):
	(n, k) = map(int, input().strip().split())
	b = 2
	while n > 0:
		if b == 1:
			for i in range(n):
				if i == n - k:
					print('b', end='')
				else:
					print('a', end='')
			n = 0
		else:
			if n % 2:
				tot = (n - 1) // 2 * n
			else:
				tot = n // 2 * (n - 1)
			al = tot - n + 1
			if k > al:
				print('b', end='')
				n -= 1
				k -= al
				b -= 1
			else:
				print('a', end='')
				n -= 1
	print()


import math

def kthString(n, k):
	resStr = ['a' for i in range(n)]
	firstB = math.floor(math.sqrt(2 * k))
	if firstB * (firstB + 1) < 2 * k:
		firstB += 1
	resStr[-firstB - 1] = 'b'
	secB = k - firstB * (firstB - 1) // 2
	resStr[-secB] = 'b'
	return ''.join(resStr)
t = int(input())
for i in range(1, t + 1):
	(n, k) = [int(s) for s in input().split(' ')]
	print(kthString(n, k))


from math import sqrt

def FindPos(k):
	temp = int(sqrt(2 * k)) + 1
	if (temp - 1) * temp / 2 < k <= (temp + 1) * temp / 2:
		return temp
	else:
		return temp - 1
t = int(input())
res = []
for i in range(t):
	(n, k) = map(int, input().split())
	Pos = FindPos(k)
	index1 = n - Pos
	index2 = int(n - (k - Pos * (Pos - 1) / 2) + 1)
	temp = 'a' * (index1 - 1) + 'b' + 'a' * (index2 - index1 - 1) + 'b' + 'a' * (n - index2)
	res.append(temp)
for i in range(t):
	print(res[i])


t = int(input())
import math
delay = []
for i in range(t):
	(n, k) = map(int, input().split())
	arr = ['a' for _ in range(n)]
	if k == 1:
		arr[0] = 'b'
		arr[1] = 'b'
		delay.append(''.join(arr[::-1]))
		continue
	x = int((1 + math.sqrt(1 + 8 * k)) / 2)
	if x * (x - 1) // 2 >= k:
		x -= 1
	arr[x] = 'b'
	rem = k - x * (x - 1) // 2
	arr[rem - 1] = 'b'
	delay.append(''.join(arr[::-1]))
for e in delay:
	print(e)


for t in range(int(input())):
	(n, k) = map(int, input().split())
	N = int((1 + (1 + 8 * (k - 1)) ** 0.5) // 2)
	a = 'a' * (n - N - 1) + 'b'
	b = 'b' + 'a' * (k - N * (N - 1) // 2 - 1)
	print(a + 'a' * max(0, n - len(a) - len(b)) + b)


def solution(n, k):
	dic = {}
	g = 1
	for i in range(n - 1):
		g += i
		dic[i + 1] = g
	(summ, nsum) = (0, 1)
	i = 1
	while True:
		if k > summ and k <= nsum:
			break
		summ += i
		i += 1
		nsum = summ + i
	q = n * (n - 1) // 2
	(a, b) = (n - i, dic[i] - k + n)
	ans = ['a'] * n
	(ans[a - 1], ans[b - 1]) = ('b', 'b')
	return ''.join(ans)
for _ in range(int(input())):
	(n, k) = list(map(int, input().split()))
	print(solution(n, k))


import math
T = int(input())
while T:
	(n, k) = map(int, input().split())
	x = int((1 + math.sqrt(1 + 8 * (k - 1))) / 2)
	d = int(math.floor((-1 + math.sqrt(1 + 8 * k - 8)) / 2))
	b = d * (d + 1) / 2 + 1
	y = int(k - b)
	A = ['a' for i in range(n)]
	A[n - x - 1] = 'b'
	A[n - y - 1] = 'b'
	R = 'a' * (n - x - 1) + 'b' + 'a' * (x - y - 1) + 'b' + y * 'a'
	print(R)
	T = T - 1


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	q = int((1 + (1 + 8 * k) ** 0.5) / 2)
	r = q * (q - 1) // 2
	q = q - 1 if r == k else q
	r = q * (q - 1) // 2
	a = 'a' * (n - 1 - q) + 'b' + 'a' * (q - k + r) + 'b' + 'a' * (k - r - 1)
	print(a)


def get_kth_perm(n, k):
	p1 = p2 = 0
	for i in range(n - 2, -1, -1):
		if k < n - i - 1:
			(p1, p2) = (i, n - 1 - k)
			break
		k -= n - 1 - i
	res = []
	for i in range(n):
		if i == p1 or i == p2:
			res.append('b')
		else:
			res.append('a')
	return ''.join(res)
t = int(input())
for _ in range(t):
	(n, k) = [int(x) for x in input().split()]
	print(get_kth_perm(n, k - 1))


t = input()
t = int(t)
for i in range(0, t):
	(n, k) = input().split(' ')
	n = int(n)
	k = int(k)
	sum = 0
	step = 1
	while sum < k:
		sum += step
		step += 1
	ans = (n - step) * 'a' + 'b'
	sum -= k
	ans += sum * 'a'
	ans += 'b'
	ans += (n - len(ans)) * 'a'
	print(ans)


am = int(input())
for i in range(am):
	(n, k) = map(int, input().split())
	tmp = k
	j = 1
	sum = 0
	while tmp > 0:
		sum += j
		tmp -= j
		j += 1
	flag1 = j - 1
	flag2 = flag1 - (sum - k) - 1
	a = []
	for i in range(n):
		if i != flag1 and i != flag2:
			a.append('a')
		else:
			a.append('b')
	for i in range(n):
		print(a[n - i - 1], end='')
	print()


i = 1
S = 0
mask = 0
for j in range(int(input())):
	(n, k) = input().split()
	n = int(n)
	k = int(k)
	i = 1
	S = 0
	while S < k:
		S += i
		i += 1
	i = i - 1
	S = 1 << int(i) | 1 << int(k - ((i - 1) * i / 2 + 1))
	for i in range(n):
		mask = 2 ** (n - 1 - i)
		if int(S) & mask:
			print('b', sep='', end='')
		else:
			print('a', sep='', end='')
	print()


from sys import stdin

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

def sinput():
	return input()

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

def linput():
	return list(map(int, stdin.readline().split()))
t = iinput()
while t:
	t -= 1
	(n, k) = minput()
	i = 1
	first = n - 2
	while True:
		if k <= i * (i + 1) // 2:
			break
		i += 1
		first -= 1
	second = i * (i + 1) // 2 - k + n - i
	s = 'a' * first + 'b' + 'a' * (second - first - 1) + 'b' + 'a' * (n - second - 1)
	print(s)


import math
t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	u = (-1 + math.sqrt(1 + 8 * k)) / 2
	if int(u) - u == 0:
		r = n - int(u) - 1
		s = ''
		for j in range(int(r)):
			s += 'a'
		s += 'bb'
		for j in range(int(r) + 2, n):
			s += 'a'
		print(s)
	elif u > int(u):
		u = int(u)
		p = k - (1 + u) * u // 2
		l = n - int(u) - 2
		r = n - p
		s = ''
		for j in range(l):
			s += 'a'
		s += 'b'
		for j in range(l + 1, r):
			s += 'a'
		s += 'b'
		for j in range(r + 1, n):
			s += 'a'
		print(s)


for test_c in range(int(input())):
	(n, k) = map(int, input().split())
	s = list('a' * n)
	for i in range(n):
		if k <= i:
			break
		k = k - i
	s[n - i - 1] = 'b'
	s[n - k] = 'b'
	print(*s, sep='')


t = int(input())
for case_num in range(t):
	(n, k) = map(int, input().split(' '))
	l = 1
	r = n - 1
	while l <= r:
		mid = (l + r) // 2
		num = mid * (mid + 1) // 2
		if k <= num:
			r = mid - 1
		else:
			l = mid + 1
	num = l * (l + 1) // 2
	ans = ['a' for i in range(n)]
	ans[-l - 1] = 'b'
	rest = l - num + k
	ans[-rest] = 'b'
	print(''.join(ans))


from math import sqrt

def solve():
	t = int(input())
	for i in range(t):
		(l, k) = map(int, input().split())
		s = list('a' * int(l))
		x = int((1 + sqrt(8 * k - 7)) // 2)
		s[-(x + 1)] = 'b'
		s[-(k - x * (x - 1) // 2)] = 'b'
		print(''.join(s))
solve()


from sys import stdin, stdout
from math import floor, sqrt, ceil
mod = 10 ** 9 + 7

def quad(c):
	return ceil((-1 + sqrt(1 + 8 * c)) / 2)

def fun(k, n):
	f = quad(k)
	x = f
	y = k - f * (f - 1) // 2 - 1
	li = ['a'] * n
	li[x] = 'b'
	li[y] = 'b'
	return ''.join(li)[::-1]
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	stdout.write(str(fun(k, n)))
	print()


t = int(input())
while t > 0:
	t -= 1
	(n, k) = map(int, input().split(' '))
	s = ['a'] * n
	for i in range(n - 2, -1, -1):
		if k <= n - i - 1:
			s[i] = 'b'
			s[n - k] = 'b'
			break
		else:
			k -= n - i - 1
	for i in range(n):
		print(s[i], end='')
	print()


from math import sqrt
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	p = (sqrt(8 * k + 1) - 1) / 2
	p = int(p) - 1 if p % 1 == 0 else int(p)
	s = sum(range(1, p + 1))
	print('a' * (n - p - 2) + 'b' + 'a' * (p + 1 - (k - s)) + 'b' + 'a' * (k - 1 - s))


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	s = ''
	p = n - 1
	h = 0
	l = 0
	o = 0
	while p >= 2:
		l += 1
		if k > p * (p - 1) // 2:
			h = 1
			m = p * (p - 1) // 2
			break
		else:
			o += 1
		p += -1
	v = ['a'] * o
	s += ''.join(v)
	if h == 0:
		print(s + 'b' + 'b')
	else:
		s += 'b'
		j = k - m
		g = ['a'] * (n - l)
		g[j - 1] = 'b'
		g.reverse()
		d = ''.join(g)
		print(s + d)


import math

def sol(b1, b2, n):
	for i in range(n):
		if i == b1 or i == b2:
			print('b', end='')
		else:
			print('a', end='')
	print('')
t = int(input())
while t > 0:
	t -= 1
	(n, k) = input().split()
	(n, k) = (int(n), int(k))
	k -= 1
	b1 = int((math.sqrt(1 + 8 * k) - 1) / 2)
	b2 = int(k - b1 * (b1 + 1) / 2)
	b2 = n - b2 - 1
	b1 = n - b1 - 2
	sol(b1, b2, n)


import sys

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

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

def input():
	return sys.stdin.readline().strip()
mod = 10 ** 9 + 7
for _ in range(int(input())):
	(n, k) = get_ints()
	i = 1
	while k > i:
		k -= i
		i += 1
	print('a' * (n - i - 1) + 'b' + 'a' * (i - k) + 'b' + 'a' * (k - 1))


for i in range(int(input())):
	(num, ind) = [int(each) for each in input().split(' ')]
	count = 1
	ans = ['a' for _ in range(num - 2)] + ['b', 'b']
	temp = (count ** 2 + count) // 2
	while temp < ind:
		count += 1
		temp = (count ** 2 + count) // 2
	(ans[-2], ans[-count - 1]) = (ans[-count - 1], ans[-2])
	(ans[-1], ans[((count - 1) ** 2 + count - 1) // 2 - ind]) = (ans[((count - 1) ** 2 + count - 1) // 2 - ind], ans[-1])
	print(''.join(ans))


from functools import reduce
import operator
import itertools
from bisect import bisect_left
arr = [i for i in range(10 ** 5)]
arr = list(itertools.accumulate(arr))
t = int(input())

def solve():
	(n, x) = map(int, input().split(' '))

	def build(f, x):
		ans = ['a'] * n
		ans[f] = 'b'
		ans[x] = 'b'
		return ''.join(reversed(ans))
	f = bisect_left(arr, x)
	print(build(f, x - arr[f - 1] - 1))
for i in range(t):
	solve()


t = int(input())
while t > 0:
	t -= 1
	(n, k) = [int(C) for C in input().split()]
	arr = ['a' for x in range(n)]
	i = 0
	curr = 0
	index = n - 1
	while True:
		i += 1
		if curr + i >= k:
			index -= 1
			arr[index] = 'b'
			for j in range(1, i + 1):
				if curr + j == k:
					arr[n - j] = 'b'
					break
			break
		else:
			index -= 1
			curr += i
	print(''.join(arr))


from math import ceil
t = int(input())
while t:
	t -= 1
	(n, k) = list(map(int, input().split()))
	i = 1
	count = 1
	while i < n and count <= k:
		count += i
		i += 1
	i -= 1
	count -= i
	ans = ['a'] * n
	ans[i] = 'b'
	ans[k - count] = 'b'
	print(''.join(ans[::-1]))


from bisect import bisect_left
t = int(input())
x = 1
s = 1
values = []
buckets = {}
while s < 4999950010:
	values.append(s)
	buckets[s] = x
	x += 1
	s += x
out = ''
while t > 0:
	t -= 1
	(n, k) = [int(i) for i in input().split(' ')]
	index = bisect_left(values, k)
	b_pos = buckets[values[index]]
	bb_pos = b_pos - (values[index] - k + 1)
	for i in range(n - 1, -1, -1):
		if i != b_pos and i != bb_pos:
			out += 'a'
		else:
			out += 'b'
	out += '\n'
print(out)


import math

def tri(b):
	return b * (b + 1) // 2

def valid(k, b):
	return tri(b) < k

def solve(k):
	estimate = math.ceil(math.sqrt(k * 2))
	diff = 0
	while 1:
		if valid(k, estimate - diff):
			return estimate - diff + 1
		diff += 1

def solve2(k, b):
	maxx = tri(b)
	distance = maxx - k
	pos = b - distance - 1
	return pos

def stringize(p1, p2, n):
	s = ['a'] * n
	s[-p1 - 1] = 'b'
	s[-p2 - 1] = 'b'
	return ''.join(s)
for testcase in range(int(input())):
	(n, k) = map(int, input().split())
	b = solve(k)
	p1 = b
	p2 = solve2(k, b)
	print(stringize(p1, p2, n))


n = int(input())
for _ in range(n):
	(a, b) = map(int, input().split())
	diff = a - 1
	tot = a * (a - 1) / 2
	res = diff
	flag = 1
	while True:
		j = a * (a - 1) // 2 - res
		if b > j and b <= tot:
			x = flag
			y = a - (b - j - 1)
			break
		flag = flag + 1
		tot = tot - diff
		diff = diff - 1
		res = diff + res
	for i in range(a):
		if i + 1 == x or i + 1 == y:
			print('b', end='')
		else:
			print('a', end='')
	print(' ')


def tri_geq(n):
	acc = 1
	stage = 1
	while acc < n:
		stage += 1
		acc += stage
	return (acc, stage)
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = ['a'] * n
	(tri, stage) = tri_geq(k)
	s[-stage - 1] = 'b'
	s[-stage + (tri - k)] = 'b'
	print(''.join(s))


from math import sqrt
T = int(input())
for t in range(T):
	(N, K) = map(int, input().split())
	n = (-3 + sqrt(9 + 8 * (K - 1))) / 2
	x = int(n)
	low = int((x + 1) * (x + 2) / 2)
	if n == x:
		print('a' * (N - 2 - x) + 'b' * 2 + 'a' * x)
	else:
		n = x + 1
		num = K - low - 1
		print('a' * (N - 2 - x - 1) + 'b' + 'a' * (n - num) + 'b' + 'a' * num)


t = int(input())
from math import ceil
for i in range(t):
	(n, k) = map(int, input().split())
	str1 = ['a' for j in range(n)]
	t = (-1 + pow(1 + 8 * k, 1 / 2)) / 2
	str1[n - 1 - int(ceil(t))] = 'b'
	r = int(t)
	if k == r * (r + 1) // 2:
		str1[n - 1 - int(ceil(t)) + 1] = 'b'
	else:
		p = n - 1 - int(ceil(t))
		r = int(t)
		r1 = ceil(t)
		k = k - int(r * (r + 1) // 2)
		str1[p + (r1 - k) + 1] = 'b'
	print(''.join(str1))


import math
t = int(input())
for _ in range(t):
	(n, d) = map(int, input().split())
	f = (-1 + math.sqrt(1 + 8 * d)) / 2
	f = math.ceil(f)
	g = f * (f - 1) // 2 + 1
	in_a = n - 1 - int(f)
	A = ['a' for i in range(in_a)]
	A.append('b')
	mid_a = int(f) - 1 - (d - g)
	for i in range(mid_a):
		A.append('a')
	A.append('b')
	for i in range(d - g):
		A.append('a')
	print(''.join(A))


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	fbp = n - 2
	cur = 1
	while cur < k:
		k -= cur
		fbp -= 1
		cur += 1
	sbp = n - k
	cnt = 0
	for j in range(n):
		if j == fbp:
			print('b', end='')
		elif j == sbp:
			print('b', end='')
		else:
			print('a', end='')
	print()


x = int(input())
for i in range(x):
	(n, k) = list(map(int, input().split(' ')))
	vetor = ['' for j in range(n)]
	for j in range(n):
		vetor[j] = 'a'
	total = 0
	diferenca = 0
	indice = 0
	for j in range(k + 1):
		total += j
		if total >= k:
			diferenca = total % k
			indice = j
			break
	vetor[n - 1 - indice] = 'b'
	if diferenca == 0:
		vetor[n - indice] = 'b'
	else:
		vetor[n - indice + diferenca] = 'b'
	for j in range(n):
		print(vetor[j], end='')
	print('')


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	s = ''
	pos2 = n - 1
	sum = 2 * n - 3
	while k - (n - 1 - pos2) > 0:
		k = k - (n - 1 - pos2)
		pos2 = pos2 - 1
	pos1 = n - k
	for i in range(n):
		if i == pos1 or i == pos2:
			s += 'b'
		else:
			s += 'a'
	print(s)


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	(N, k) = map(int, input().split())
	pic = 0
	back = 0
	for i in range(N - 1):
		pic += i + 1
		if pic >= k:
			break
		back = pic
	if pic == k:
		pos = pic
		gap = i + 1
		st = ['a'] * N
		st[-gap] = 'b'
		st[-(gap + 1)] = 'b'
		print(''.join(st))
	else:
		pos = back
		gap = i + 1
		dis = k - (pos + 1)
		st = ['a'] * N
		st[-(gap + 1)] = 'b'
		st[-(gap + 1 - (gap - dis))] = 'b'
		print(''.join(st))


for _ in [0] * int(input()):
	(n, k) = map(int, input().split())
	x = int(((8 * k + 1) ** 0.5 + 1) / 2)
	y = x * (x - 1) // 2
	if k == y:
		print('a' * (n - x) + 'b' * 2 + 'a' * (x - 2))
	if k != y:
		print('a' * (n - x - 1) + 'b' + 'a' * (x - k + y) + 'b' + 'a' * (k - y - 1))


import time as t

def C2(n):
	return int(n * (n - 1) / 2)

def withoutB(string, n):
	return 'a' * (len(string) - n) + 'b' * 1 + 'a' * (n - 1)
n = int(input())
for i in range(n):
	(l, goal) = list(map(int, input().split()))
	if goal == 1:
		print('a' * (l - 2) + 'b' * 2)
	else:
		ans = ''
		while goal <= C2(l - 1):
			ans += 'a'
			l -= 1
		ans += 'b'
		ans += withoutB('a' * (l - 2) + 'b', goal - C2(l - 1))
		print(ans)


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	i = 1
	cnt = 1
	arr = ['a' for _ in range(n - 2)]
	arr.append('b')
	arr.append('b')
	while i < k:
		k -= i
		i += 1
		cnt += 1
	for i in range(n):
		if i == n - cnt - 1 or i == n - k:
			print('b', end='')
		else:
			print('a', end='')
	print()


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	temp = 1
	ans = ['a'] * n
	i = 0
	while k >= temp:
		temp += i
		i += 1
	ans[n - i] = 'b'
	ans[n - i + 1 + (temp - 1 - k)] = 'b'
	print(*ans, sep='')


def linput():
	return [int(i) for i in input().split()]
q = int(input())
for ______ in range(q):
	(n, k) = linput()
	i = 1
	while i <= k:
		k -= i
		i += 1
	if k == 0:
		print('a' * (n - i) + 'bb' + 'a' * (i - 2))
	else:
		print('a' * (n - i - 1) + 'b' + 'a' * (i - k) + 'b' + 'a' * (k - 1))


import sys
import math
import collections
inp = lambda : sys.stdin.readline()
for _ in range(int(inp())):
	(n, k) = map(int, inp().split())
	if k == 1:
		print('a' * (n - 2) + 'b' * 2)
		continue
	pos = n
	ans = n
	while pos >= 0:
		if pos * (pos + 1) // 2 >= k:
			ans = pos
			pos -= 1
		else:
			break
	k -= (ans - 1) * ans // 2
	ans = n - ans - 1
	k = n - k
	st = ['a'] * n
	st[ans] = 'b'
	st[k] = 'b'
	print(''.join(st))


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	(t, m) = (0, 1)
	ans = ['a'] * n
	while t + m < k:
		t += m
		m += 1
	(ans[m], ans[k - t - 1]) = ('b', 'b')
	print(''.join(ans[::-1]))


def get_num(n, k):
	f_num = s_num = 1
	for i in range(1, n):
		f_num = s_num
		s_num = f_num + i
		if s_num > k:
			return (i, f_num)

def main():
	result = str()
	for _ in range(int(input())):
		(n, k) = map(int, input().split())
		r = ['a'] * n
		position = get_num(n, k)
		r[position[0]] = 'b'
		r[k - position[1]] = 'b'
		r.reverse()
		result += f"{''.join(r)}\n"
	print(result.strip())
main()


l = [0]
i = 0
while 1:
	i += 1
	l.append(l[-1] + i)
	if l[-1] > 2 * 10 ** 9:
		break
for tc in range(int(input())):
	(n, k) = list(map(int, input().split()))
	ans = ['a' for i in range(n)]
	i = 1
	for i in range(1, len(l)):
		if l[i] >= k:
			break
	ans[n - 1 - i] = 'b'
	ans[n - (k - l[i - 1])] = 'b'
	print(''.join(ans))


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	if k == 1:
		s = 'a' * (n - 2)
		print(s + 'bb')
	elif k == n * (n - 1) / 2:
		s = 'a' * (n - 2)
		print('bb' + s)
	else:
		i = 1
		k -= 1
		val = 0
		cnt = 1
		for j in range(n - 1, 0, -1):
			i += 1
			k -= i
			if k <= 0:
				val = j
				if k == 0:
					cnt = i
				else:
					cnt = i + k
				break
		lb = val - 2
		rb = n - cnt
		s = ''
		for i in range(n):
			if i == lb or i == rb:
				s += 'b'
			else:
				s += 'a'
		print(s)


import math
t = int(input())
for _ in range(t):
	(n, k) = list(map(int, input().split()))
	a = math.ceil((-1 + math.sqrt(1 + 8 * k)) / 2) - 1
	b = n - 2 - a
	c = k - a * (a + 1) // 2 - 1
	print(b * 'a' + 'b' + 'a' * (a - c) + 'b' + c * 'a')


from math import ceil, sqrt, log, gcd

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

def si():
	return input()

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

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

def main():
	for _ in range(ii()):
		(n, k) = mi()
		ans = n - 1
		s = ['a'] * n
		f = 0
		for i in range(n):
			x = i * (i + 1) // 2
			if x >= k:
				f = 1
				ans = i
				break
		s[ans] = 'b'
		k -= ans * (ans - 1) // 2
		s[k - 1] = 'b'
		s.reverse()
		print(''.join(s))
main()


def answer(n, k):
	m = 1
	while True:
		if m * (m + 1) == 2 * k:
			break
		if m * (m + 1) > 2 * k:
			break
		m += 1
	arr = ['b'] + ['a'] * m
	startPoint = int(m * (m - 1) / 2) + 1
	diff = k - startPoint
	arr[len(arr) - 1 - diff] = 'b'
	ab = 'a' * (n - len(arr)) + ''.join(arr)
	return ab
testCount = int(input())
for _ in range(testCount):
	(n, k) = map(int, input().split())
	print(answer(n, k))


import math

def kth_string(n, k):
	i = int((1 + math.sqrt(-1 + 8 * k)) // 2)
	j = int(k - i * (i - 1) // 2)
	as1 = n - i - 1
	as2 = i - j
	as3 = j - 1
	return 'a' * as1 + 'b' + 'a' * as2 + 'b' + 'a' * as3
t = int(input())
results = []
for i in range(t):
	[n, k] = list(map(int, input().split(' ')))
	results.append(kth_string(n, k))
for s in results:
	print(s)


from itertools import permutations
debug = False
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = ['a'] * n
	i = 1
	k1 = k
	start = 0
	while k1 > 0:
		k1 -= i
		if k1 > 0:
			start += i
		i += 1
	s[n - (k - start)] = 'b'
	s[n - 1 - (i - 1)] = 'b'
	print(''.join(s))


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	x = 1
	while k > x:
		k -= x
		x += 1
	print('a' * (n - x - 1) + 'b' + 'a' * (x - k) + 'b' + 'a' * (k - 1))


import math
t = int(input())
while t:
	(n, K) = [int(x) for x in input().split()]
	k = K
	k = 2 * k
	k = round(math.sqrt(k)) - 1
	length = k + 2
	if K == (k + 1) * (k + 2) / 2:
		str1 = 'bb'
		for i in range(0, k):
			str1 += 'a'
		k += 1
		str2 = ''
		for i in range(0, n - k - 1):
			str2 += 'a'
		print(str2 + str1)
		t -= 1
		continue
	else:
		str2 = ''
		for i in range(0, n - length):
			str2 += 'a'
		left = K - k * (k + 1) / 2
		index = length - left - 1
		str1 = 'b'
		for i in range(0, k + 1):
			if i == index:
				str1 += 'b'
			else:
				str1 += 'a'
		print(str2 + str1)
		t -= 1


for i in range(int(input())):
	(n, k) = map(int, input().split())
	x = 0
	keep = 0
	for i in range(n):
		if x >= k:
			break
		keep = i
		x += i
	final = 'a' * (n - keep - 1) + 'b' + 'a' * (x - k) + 'b' + 'a' * (keep - x + k - 1)
	print(final)


import math
for i in range(int(input())):
	(n, k) = map(int, input().split())
	a = ['a'] * (n - 2) + ['b'] * 2
	t = (-1 + math.sqrt(1 + 8 * k)) / 2
	t = math.ceil(t)
	x = t - 1
	si = x * (x + 1) // 2
	y = k - si - 1
	(a[n - 2], a[n - 2 - x]) = (a[n - 2 - x], a[n - 2])
	(a[n - 1], a[n - 1 - y]) = (a[n - 1 - y], a[n - 1])
	print(''.join(a))


for l in range(int(input())):
	(x, y) = map(int, input().split())
	k = x - 2
	s = ['a'] * x
	while k >= 0:
		if y <= x - k - 1:
			s[k] = 'b'
			s[x - y] = 'b'
			break
		y -= x - k - 1
		k -= 1
	print(''.join(s))


def pos(n, k):
	z = 0
	l = 0
	out_0 = n
	while z < k:
		l = l + 1
		out_1 = k
		k = k - l
		out_0 = out_0 - 1
	return [out_0, n - out_1 + 1]

def pos2string(pos, n):
	out = ['a'] * n
	out[pos[0] - 1] = 'b'
	out[pos[1] - 1] = 'b'
	return ''.join(out)

def input2nk(inputa):
	out = inputa.split(' ')
	return [int(out[0]), int(out[1])]
N = int(input())
for K in range(N):
	inputa = input2nk(input())
	n = inputa[0]
	k = inputa[1]
	print(pos2string(pos(n, k), n))


for i in range(int(input())):
	(a, b) = [int(i) for i in input().split()]
	i = 1
	p = 1
	while b - i > 0:
		p += 1
		b -= i
		i += 1
	arr = ['a' for pa in range(a)]
	arr[-1 - p] = 'b'
	arr[-b] = 'b'
	print(''.join(arr))


def PA(x):
	return x * (x - 1) // 2

def res(x):
	a = []
	while x > 0:
		if x & 1 == 0:
			a.append('a')
		else:
			a.append('b')
		x = x // 2
	return a
n = int(input())
for _ in range(n):
	(a, b) = map(int, input().split())
	aux = 0
	for i in range(100000):
		if PA(i) >= b:
			aux = i
			break
	porra = aux - 1 - (PA(aux) - b)
	c = res(1 << aux - 1 | 1 << porra - 1)
	falta = a - len(c)
	print('a' * falta, end='')
	for i in range(len(c) - 1, -1, -1):
		print(c[i], end='')
	print()


t = int(input())

def solve(n, k):
	l = 1
	r = n
	while l < r:
		mid = (l + r) // 2
		v_mid = mid * (mid - 1) // 2
		if v_mid >= k:
			r = mid
		else:
			l = mid + 1
	st1 = 'a' * (n - l) + 'b'
	b2 = k - (l - 1) * (l - 2) // 2
	l -= 1
	st2 = 'a' * (l - b2) + 'b' + 'a' * (b2 - 1)
	return st1 + st2
for _ in range(t):
	(a, b) = map(int, input().split())
	print(solve(a, b))


import bisect
import math as m
from sys import stdin, stdout
sn = [0]
for i in range(1, 10 ** 5 + 1):
	sn += [sn[-1] + i]
for _ in range(int(stdin.readline())):
	(n, k) = map(int, stdin.readline().split())
	pos = bisect.bisect_left(sn, k)
	if sn[pos] == k:
		(i1, i2) = (pos, pos - 1)
	else:
		(i1, i2) = (pos, k - sn[pos - 1] - 1)
	s = ''
	for i in range(n):
		if i in (i1, i2):
			s = 'b' + s
		else:
			s = 'a' + s
	stdout.write(s + '\n')


import math

def solve(n, k):
	first_b_index = n - 2
	second_b_index = n - 1
	k = k - 1
	(a, b, c) = (1, 1, -k * 2)
	closest_jump = int((-b + math.sqrt(b ** 2 - 4 * a * c)) / (2 * a))
	first_b_index -= closest_jump
	closest_jump_val = closest_jump * (closest_jump + 1) // 2
	second_b_index -= k - closest_jump_val
	result = []
	for i in range(n):
		if i in [first_b_index, second_b_index]:
			result.append('b')
		else:
			result.append('a')
	return ''.join(result)
t = int(input())
for i in range(t):
	(n, k) = map(int, input().split(' '))
	print(solve(n, k))


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	s = ['a'] * n
	for j in range(n - 2, -1, -1):
		if k <= n - 1 - j:
			s[j] = 'b'
			s[n - k] = 'b'
			r = ''.join(s)
			print(r)
			break
		k -= n - 1 - j


from sys import stdin
from collections import deque
mod = 10 ** 9 + 7
import sys
import random
from queue import PriorityQueue
from bisect import bisect_right
from bisect import bisect_left
from collections import defaultdict
from math import sqrt, factorial, gcd, log2, inf, ceil
import heapq
input = lambda : sys.stdin.readline().rstrip()
from sys import stdin, stdout
from heapq import heapify, heappush, heappop
from itertools import permutations
from math import factorial as f

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p
from collections import defaultdict
from heapq import heappop, heappush, heapify
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	ans = ['a'] * n
	y = ceil((-1 + sqrt(1 + 8 * k)) / 2)
	z = ceil((-1 + sqrt(1 + 8 * k)) // 2)
	ka = k - z * (z + 1) // 2
	cnt = 0
	for i in range(n - 1, -1, -1):
		if y == cnt:
			ans[i] = 'b'
			if ka == 0:
				ans[i + 1] = 'b'
			break
		cnt += 1
	cnt = 1
	for i in range(n - 1, -1, -1):
		if ka == cnt:
			ans[i] = 'b'
			break
		cnt += 1
	print(''.join(ans))


import math
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	l = math.ceil(((8 * k + 1) ** 0.5 - 1) / 2) - 1
	r = ''
	for i in range(n):
		if n - i == l + 2 or n - i == k - l * (l + 1) / 2:
			r += 'b'
		else:
			r += 'a'
	print(r)


def left(n, b):
	if b == 1:
		return n - 1
	else:
		return (n - 1) * (n - 2) // 2
t = int(input(''))
arr = []
for i in range(t):
	arr.append(list(map(int, input().split())))
for i in arr:
	n = i[0]
	pos = i[1]
	b = 2
	pos1 = -1
	pos2 = -1
	sol = ''
	for j in range(n, 0, -1):
		l = left(j, b)
		if l >= pos:
			sol += 'a'
		else:
			sol += 'b'
			pos -= l
			b -= 1
			if b == 0:
				break
	if b:
		if b == 1:
			sol += 'b'
			sol = sol[1:]
		elif b == 2:
			sol += 'bb'
			sol = sol[2:]
	if j != 1:
		sol += 'a' * (j - 1)
	print(sol)


import math
t = int(input())
for i in range(t):
	(n, k) = tuple(map(int, input().split()))
	k -= 1
	p1 = int(math.floor((-1 + math.sqrt(1 + k * 8)) / 2))
	p2 = k - p1 * (p1 + 1) // 2
	s = ['a'] * n
	s[-2 - p1] = 'b'
	s[-1 - p2] = 'b'
	print(''.join(s))


import sys
input = sys.stdin.readline
(t,) = map(int, input().split())
for _ in range(t):
	(N, K) = map(int, input().split())
	c = 0
	while c * (c + 1) < 2 * K:
		c += 1
	c -= 1
	r = ['a'] * N
	r[c + 1] = 'b'
	r[K - c * (c + 1) // 2 - 1] = 'b'
	print(''.join(r[::-1]))


d = []
a = []
b = int(input())
sr = ''
while b > 0:
	(n, k) = map(int, input().split())
	string_val = 'a' * n
	string_val = list(string_val)
	j = n - 2
	for i in range(j, -1, -1):
		left_b = n - 1 - i
		if k <= left_b:
			string_val[i] = 'b'
			string_val[n - k] = 'b'
			a.append(string_val)
			break
		k -= left_b
	vola = sr.join(string_val)
	d.append(vola)
	sr = ''
	b = b - 1
for i in d:
	print(i)


t = int(input())
for _ in range(t):
	(n, k) = tuple(map(int, input().split()))
	x = int(((8 * k + 1) ** 0.5 - 1) / 2)
	s = list('a' * n)
	if k == x * (x + 1) // 2:
		s[x] = 'b'
		s[x - 1] = 'b'
	else:
		s[x + 1] = 'b'
		s[k - x * (x + 1) // 2 - 1] = 'b'
	print(''.join(s[::-1]))


t = int(input())
for testcase in range(t):
	(n, k) = map(int, input().split())
	s = list('a' * n)
	x = 1
	y = 0
	while y + x < k:
		y += x
		x += 1
	s[x] = 'b'
	s[k - y - 1] = 'b'
	print(''.join(s[::-1]))


t = int(input())
L = []
for i in range(t):
	a = input()
	b = ''
	for j in a:
		if j != ' ':
			b += j
		else:
			n = int(b)
			b = ''
	k = int(b)
	m = int(-(-(-1 + (1 + 8 * k) ** (1 / 2)) // 2))
	L += [[k, m, n]]
for x in L:
	(k, m, n) = (x[0], x[1], x[2])
	print('a' * (n - m - 1) + 'b' + 'a' * (m * (m + 1) // 2 - k) + 'b' + 'a' * (k - m * (m - 1) // 2 - 1))


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = ['a'] * n
	str1 = ''
	if k == 1:
		s[-1] = 'b'
		s[-2] = 'b'
		print(str1.join(s))
	else:
		count1 = 2
		count2 = 1
		sum = count1 - 1
		while sum < k:
			sum += count1
			count1 += 1
		sum -= count1
		count2 = k - sum
		s[-count1] = 'b'
		s[-count2 + 1] = 'b'
		print(str1.join(s))


import math

def term(n):
	x = (1 + math.sqrt(1 + 8 * n)) // 2
	return x

def term2(n):
	x = ((2 * n - 1) * (2 * n - 1) - 1) // 8
	return x
for _ in range(int(input())):
	(n, m) = map(int, input().split())
	if n == 2:
		print('bb')
	else:
		t = term(m - 1)
		a = n - 1 - int(t)
		b = int(n - (m - term2(int(t))))
		l = ['a' for i in range(n)]
		l[a] = 'b'
		l[b] = 'b'
		print(''.join(l))


t = int(input())
while t:
	(n, k) = map(int, input().split())
	s = 1
	while k >= s:
		k = k - s
		s += 1
	l = [0] * n
	if k == 0:
		l[n - s] = 1
		l[n - s + 1] = 1
	else:
		l[n - 1 - s] = 1
		l[n - k] = 1
	w = 0
	while w < n:
		if l[w] == 0:
			print('a', end='')
		else:
			print('b', end='')
		w += 1
	print()
	t -= 1


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

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

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

def istr():
	return stdin.readline()

def f(n):
	s = int(((1 + 8 * n) ** 0.5 - 1) // 2)
	k = s * (s + 1) // 2
	if k == n:
		s -= 1
	k = s * (s + 1) // 2
	return [s + 1, n - k - 1]
t = iint()
for _x in range(t):
	(m, n) = ilist()
	(x, y) = sorted(f(n))
	j = m - 1 - x
	i = m - 1 - y
	ans = 'a' * m
	ans = ans[:i] + 'b' + ans[i + 1:j] + 'b' + ans[j + 1:] + '\n'
	stdout.write(ans)


import bisect
pre = [0, 1]
for i in range(2, pow(10, 5)):
	pre.append(pre[i - 1] + i)
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	b1 = 0
	b2 = 0
	p = bisect.bisect_left(pre, k - 1)
	if pre[p] != k - 1:
		p = p - 1
	b1 = n - 1 - p
	b2 = n - (k - 1 - pre[p])
	for i in range(1, n + 1):
		if i != b1 and i != b2:
			print('a', end='')
		else:
			print('b', end='')
	print()


t = int(input())

def ass(rr, k, i):
	if i == rr or i == k:
		return 'b'
	else:
		return 'a'
for xx in range(t):
	(n, k) = map(int, input().split())
	rr = 0
	ans = 0
	k -= 1
	while ans <= k:
		ans = rr * (rr + 1) // 2
		rr += 1
	k -= (rr - 1) * (rr - 2) // 2
	x = [ass(rr - 1, k, i) for i in range(n)]
	ans = ''.join([x[n - i - 1] for i in range(n)])
	print(ans)


import math
t = int(input())
for test in range(t):
	(n, k) = map(int, input().split())
	i = 1
	f = (-1 + math.sqrt(1 + 8 * k)) / 2
	f = math.ceil(f)
	arr = ['A' for i in range(n)]
	rem = f * (f + 1) / 2 - k
	f += 1
	res = ''
	res += 'a' * (n - f)
	res += 'b'
	res += 'a' * int(rem)
	res += 'b'
	res += 'a' * (n - len(res))
	print(res)


import math

def findRoots(val):
	pos_root = (-3 + math.sqrt(9 + 8 * val)) / 2
	res_low = math.floor(pos_root)
	return res_low

def arthSum(val, limit):
	global n
	res = int(val / 2 * (4 + (val - 1))) + 1
	if res < limit:
		n += 1
		return int(n / 2 * (4 + (n - 1))) + 1
	else:
		return res
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	if b == 1:
		print('a' * (a - 2) + 'b' * 2)
	else:
		n = findRoots(b)
		sep = arthSum(n, b)
		print('a' * (a - 2 - n) + 'b' + 'a' * (sep - b) + 'b' + 'a' * (a - 2 - (a - 2 - n + (sep - b))))


import sys
input = sys.stdin.readline
f = lambda : list(map(int, input().split()))
res = []
for _ in range(int(input())):
	(n, k) = f()
	l = 1
	r = 1000000.0
	val = 0
	while l <= r:
		m = (l + r) // 2
		if m * (m + 1) // 2 > k:
			r = m - 1
		else:
			val = int(m)
			l = m + 1
	ans = ['a'] * n
	if k == val * (val + 1) // 2:
		ans[val] = 'b'
		ans[val - 1] = 'b'
	else:
		ans[val + 1] = 'b'
		ans[k - val * (val + 1) // 2 - 1] = 'b'
	res.append(''.join(ans[::-1]))
print(*res)


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split(' '))
	arr = ['a'] * n
	x = int((1 + (1 + 4 * 2 * k) ** 0.5) // 2)
	if x * (x - 1) // 2 == k:
		s = 'bb'
		arr[x - 1] = 'b'
		arr[x - 2] = 'b'
	else:
		m = k - x * (x - 1) // 2
		arr[x] = 'b'
		arr[m - 1] = 'b'
	s = ''
	for i in arr:
		s = i + s
	print(s)


t = int(input())
for q in range(t):
	(n, k) = map(int, input().split())
	arr = [0] * n
	temp = 0
	temp2 = 0
	for i in range(1, n + 1):
		if i * (i - 1) // 2 + 1 <= k < (i + 1) * (i + 2) // 2 + 1:
			temp = i
			p = i * (i - 1) // 2 + 1
	arr[n - temp - 1] = 1
	z = k - p
	arr[n - z - 1] = 1
	for i in range(len(arr)):
		if arr[i] == 1:
			arr[i] = 'b'
		else:
			arr[i] = 'a'
	print(''.join(arr))


t = int(input())
for i in range(t):
	(n, k) = map(int, input().rstrip().split())
	r = list()
	rem = 2
	while n > 0:
		if rem == 0:
			r.append('a')
		elif rem == 1:
			if k <= n - 1:
				r.append('a')
			else:
				k -= n - 1
				r.append('b')
				rem -= 1
		elif k <= (n - 2) * (n - 1) // 2:
			r.append('a')
		else:
			k -= (n - 2) * (n - 1) // 2
			r.append('b')
			rem -= 1
		n -= 1
	print(''.join(r))


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	ans = ['a'] * n
	for i in range(1, n + 1):
		ll = int(i * (i - 1) / 2)
		ul = int(i * (i + 1) / 2)
		if k > ll and k <= ul:
			ans[i] = 'b'
			ans[k - ll - 1] = 'b'
			break
	ans.reverse()
	print(*ans, sep='')


from sys import stdin, stdout
from math import ceil
rr = lambda : input().strip()
rri = lambda : int(rr())
rrm = lambda : [int(x) for x in rr().split()]

def sol():
	(n, k) = rrm()
	res = ''
	x = (1 + (1 + 8 * k) ** 0.5) / 2
	cx = ceil(x) - 1
	z = cx * (cx + 1) // 2
	return 'a' * (n - ceil(x)) + 'b' + 'a' * (z - k) + 'b' + (ceil(x) - z + k - 2) * 'a'
T = rri()
for t in range(T):
	ans = sol()
	print(ans)


from sys import stdin
input = lambda : stdin.readline()
from math import ceil
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	i = 0
	su = 0
	while i < k and su < k:
		i += 1
		su += i
	su -= i
	i -= 1
	if su == k:
		print('a' * max(0, n - 2 - i), end='')
		print('b', end='')
		print('a' * max(0, i), end='')
		print('b')
	else:
		t = k - su
		print('a' * max(0, n - 2 - i), end='')
		print('b', end='')
		print('a' * max(0, i - t + 1), end='')
		print('b', end='')
		print('a' * max(0, t - 1))


from math import sqrt
tes = int(input())
for t in range(tes):
	(n, k) = map(int, input().split())
	m = k - 1
	pos_rev = int((-1 + sqrt(1 + 8 * m)) / 2)
	pos_2_rev = m - pos_rev * (pos_rev + 1) / 2
	pos_rev += 1
	second_a = pos_rev - pos_2_rev
	third_a = pos_2_rev
	pos_1 = n - pos_rev
	print('a' * (pos_1 - 1) + 'b' + 'a' * int(second_a - 1) + 'b' + 'a' * int(third_a))


def solve(n, k):
	in_ = 1
	while k > in_:
		k -= in_
		in_ += 1
	ans = [None] * n
	for i in range(n):
		if i == n - in_ - 1 or i == n - k:
			ans[i] = 'b'
		else:
			ans[i] = 'a'
	return ''.join(ans)
t = int(input())
while t:
	(n, k) = map(int, input().split())
	print(solve(n, k))
	t -= 1


import math

def getsum(n):
	if n % 2 == 1:
		return (n + 1) * int(n / 2) + (n + 1) / 2
	else:
		return (n + 1) * int(n / 2)
t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	startNum = 1 if b < 100 else int(math.sqrt(b * 2))
	while True:
		if b <= getsum(startNum):
			break
		else:
			startNum += 1
	secNum = b - getsum(startNum - 1)
	str = ''
	while a > 0:
		if a != startNum + 1 and a != secNum:
			str += 'a'
		else:
			str += 'b'
		a -= 1
	print(str)


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

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

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

def LIST_2D_ARRAY(m, n):
	return [[0 for _ in range(n)] for _ in range(m)]
import bisect
A = [0] * (10 ** 5 + 2)
for i in range(1, len(A)):
	A[i] = A[i - 1] + i
for i in range(int(input())):
	(n, k) = INPUT()
	x = bisect.bisect_left(A, k)
	dif = A[x] - k
	ans = ['a'] * (n - x - 1)
	ans.append('b')
	new = ['a'] * x
	new[dif] = 'b'
	ans.extend(new)
	print(''.join(ans))


def main():
	t = int(input())
	for _ in range(t):
		(n, k) = map(int, input().split())
		if k == 1:
			print('a' * (n - 2) + 'b' * 2)
			continue
		else:
			x = 2
			p = n - 2
			while k > x and k > x + (n - p - 1):
				x += n - p
				p -= 1
			s = 'a' * (p - 1) + 'b'
			q = n
			while x < k:
				q -= 1
				x += 1
			s += 'a' * (q - p - 1) + 'b' + 'a' * (n - q)
			print(s)
	return
main()


def kthBeautifulStr(n, k):
	s = []
	for _ in range(0, n):
		s.append('a')
	i = n - 2
	while i >= 0:
		if k <= n - i - 1:
			s[i] = 'b'
			s[n - k] = 'b'
			str = ''
			s = str.join(s)
			print(s)
			break
		k -= n - i - 1
		i -= 1
tc = int(input())
for _ in range(0, tc):
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	kthBeautifulStr(a, b)


import bisect

def solve(n, k):
	ans = ['a'] * n
	dp = [0] * n
	ind = [0]
	dp[1] = 1
	for i in range(2, n):
		dp[i] = dp[i - 1] + i
	for i in range(n - 2, -1, -1):
		ind.append(i)
	aa = bisect.bisect_left(dp, k)
	if dp[aa] < k:
		aa += 1
	k = k - dp[aa - 1]
	k = n - k
	ans[ind[aa]] = 'b'
	ans[k] = 'b'
	print(''.join(map(str, ans)))
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	solve(n, k)


import math
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	k1 = math.ceil((-1.0 + math.sqrt(1 + 8 * k)) / 2.0)
	k2 = k - k1 * (k1 - 1) // 2 - 1
	for i in range(n):
		if i == n - k1 - 1 or i == n - k2 - 1:
			print('b', end='')
		else:
			print('a', end='')
	print()


from math import sqrt
t = int(input())
for _ in range(t):
	(n, k) = list(map(int, input().split()))
	m = int(sqrt(2 * k))
	while m * (m + 1) / 2 < k:
		m += 1
	s = ['a'] * n
	s[m] = 'b'
	m -= 1
	s[k - int(m * (m + 1) / 2) - 1] = 'b'
	print(''.join(s[::-1]))


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	l = 1
	while k > l:
		k -= l
		l += 1
	print('a' * (n - l - 1) + 'b' + 'a' * (l - k) + 'b' + 'a' * (k - 1))


from math import factorial, sqrt, floor

def binomial(x, y):
	try:
		binom = factorial(x) // factorial(y) // factorial(x - y)
	except ValueError:
		binom = 0
	return binom

def solve(n, k):
	a_str = 'a'
	a = n - 2
	x = k - 1
	a1 = floor((sqrt(1 + 8 * x) - 1) / 2)
	a2 = x - binomial(round(sqrt(2 + 2 * x)), 2)
	return f'{a_str * (a - a1)}b{a_str * (a1 - a2)}b{a_str * a2}'
t = int(input())
for ti in range(t):
	(n, k) = map(int, input().split())
	res = solve(n, k)
	print(res)


import math
testCases = int(input())
while testCases:
	testCases -= 1
	(n, k) = input().split()
	n = int(n)
	k = int(k)
	stringList = list(())
	for i in range(n):
		stringList.append('a')
	if k == 1:
		stringList[-1] = stringList[-2] = 'b'
	else:
		temp = int(math.ceil(math.sqrt(2 * k)))
		while temp * (temp - 1) < 2 * k:
			temp += 1
		pos1 = int(n - temp)
		pos2 = int(n - k + (temp - 1) * (temp - 2) / 2)
		stringList[pos1] = stringList[pos2] = 'b'
	result = ''
	for x in stringList:
		result += x
	print(result)


t = int(input())
for _ in range(t):
	(n, k) = list(map(int, input().split()))
	i = 0
	strList = list('a' * n)
	while k - i > 0:
		k = k - i
		i += 1
	strList[n - k] = 'b'
	strList[n - (i + 1)] = 'b'
	str_ = ''.join(strList)
	print(str_)


import math
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	x = math.ceil((-1 + (1 + 8 * k) ** 0.5) / 2) - 1
	y = k - (x + 1) * x / 2 - 1
	for i in range(n):
		if i == n - 2 - x or i == n - 1 - y:
			print('b', end='')
		else:
			print('a', end='')
	print()


t = int(input())
for i in range(t):
	(n, k) = [int(i) for i in input().split()]
	m = 1
	while m * (m - 1) // 2 < k:
		m += 1
	p1 = n - m
	m -= 1
	p2 = n - (k - m * (m - 1) // 2)
	for i in range(n):
		if i == p1 or i == p2:
			print('b', end='')
		else:
			print('a', end='')
	print()


for t in range(int(input())):
	a = input().split()
	n = int(a[0])
	k = int(a[1])
	u = 0
	v = 0
	for i in range(1, n):
		if i * (i + 1) // 2 >= k:
			k -= i * (i - 1) // 2
			u = n - i
			v = n + 1 - k
			break
	print('a' * (u - 1) + 'b' + 'a' * (v - u - 1) + 'b' + 'a' * (n - v))


import os
import sys
if os.path.exists('/mnt/c/Users/Square/square/codeforces'):
	f = iter(open('B.txt').readlines())

	def input():
		return next(f)
else:
	input = lambda : sys.stdin.readline().strip()
fprint = lambda *args: print(*args, flush=True)
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	k -= 1
	pos_b = 2
	while k > pos_b - 2:
		k -= pos_b - 1
		pos_b += 1
	pos_b = n - pos_b
	pos_a = n - k - 1
	x = ['a'] * n
	x[pos_a] = 'b'
	x[pos_b] = 'b'
	r = ''.join(x)
	print(r)


from math import *
from sys import stdin, stdout

def f(n):
	i = floor((sqrt(8 * n - 1) + 1) // 2)
	j = n - 1 - i * (i - 1) // 2
	return (1 << i) + (1 << j)

def bina(n, l):
	res = ''
	while n:
		if n % 2 == 1:
			res = 'b' + res
		else:
			res = 'a' + res
		n //= 2
	lon = len(res)
	aux = ''
	if l != lon:
		aux = 'a' * (l - lon)
	stdout.write(aux + res + '\n')
for _ in range(int(stdin.readline())):
	(n, k) = map(int, stdin.readline().split())
	bina(f(k), n)


t = int(input())
arr = [i for i in range(1, 100000)]
prefix = [1]
for i in range(1, len(arr)):
	prefix.append(prefix[i - 1] + arr[i])

def binary(l, r, x):
	ans = -1
	while l <= r:
		mid = l + (r - l) // 2
		if prefix[mid] <= x:
			ans = mid
			l = mid + 1
		else:
			r = mid - 1
	return ans
while t:
	s = input().split()
	n = int(s[0])
	k = int(s[1])
	ind = binary(0, len(arr), k)
	if prefix[ind] == k:
		ans = ['b', 'b'] + ['a'] * (arr[ind] - 1)
		ans = ['a'] * (n - len(ans)) + ans
		for i in ans:
			print(i, end='')
		print()
	else:
		ans = ['a' for i in range(n)]
		ans[arr[ind + 1]] = 'b'
		temp = k - prefix[ind]
		ans[temp - 1] = 'b'
		for i in range(len(ans) - 1, -1, -1):
			print(ans[i], end='')
		print()
	t -= 1


import bisect
a = [0]
for i in range(1, 100001):
	a.append(i + a[-1])
for t in range(int(input())):
	(n, k) = map(int, input().split())
	i = bisect.bisect_left(a[0:n + 1], k)
	ans = ['a'] * n
	if a[i] == k:
		ans[n - i - 1] = 'b'
		ans[n - i] = 'b'
	else:
		ans[n - i - 1] = 'b'
		j = k - a[i - 1]
		ans[-j] = 'b'
	print(''.join(ans))


q = int(input())
for _ in range(q):
	(a, b) = map(int, input().split())
	temp = a
	tt = 0
	for i in range(2, a + 1):
		if b <= i * (i - 1) / 2:
			temp = i - 1
			tt = temp * (temp - 1) / 2
			break
	temp2 = b - tt
	(temp, temp2) = (int(temp), int(temp2))
	print('a' * (a - temp - 1) + 'b' + 'a' * (temp - temp2) + 'b' + 'a' * (temp2 - 1))


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	ans = ['a'] * n
	for (i, right) in zip(range(n - 2, -1, -1), range(1, n + 1)):
		if k > right:
			k -= right
			continue
		j = n
		while k:
			k -= 1
			j -= 1
		ans[i] = ans[j] = 'b'
		break
	print(*ans, sep='')


t = int(input())
for iii in range(t):
	(n, k) = map(int, input().split())
	i = 1
	while k > i:
		k -= i
		i += 1
	s = ['a'] * n
	s[-i - 1] = 'b'
	s[-k] = 'b'
	print(''.join(map(str, s)))


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	l = ['a'] * n
	for i in range(n - 2, -1, -1):
		p = n - 1 - i
		if k <= p:
			l[i] = 'b'
			l[n - k] = 'b'
			print(''.join(l))
			break
		k -= p


import math, sys
input = sys.stdin.readline
for t in range(int(input())):
	(n, k) = map(int, input().split())
	l = ['a'] * n
	b1 = (1 + math.sqrt(1 + 8 * k)) / 2
	if b1 == math.floor(b1):
		b1 = int(b1)
	else:
		b1 = math.ceil(b1)
	l[-b1] = 'b'
	b2 = int(k - b1 * (b1 - 1) / 2)
	b2 += b1 - 1
	l[-b2] = 'b'
	output = ''
	for x in range(n):
		output += l[x]
	print(output)


dp = []
num = 0
for i in range(1, 100001):
	num += i
	dp.append(num)

def binSearch(l, n):
	if len(l) == 1:
		return 0
	mid = len(l) // 2
	if l[mid] == n:
		return mid
	if l[mid] > n:
		return binSearch(l[:mid], n)
	return mid + binSearch(l[mid:], n)
t = int(input())
for _ in range(t):
	(n, k) = list(map(int, input().split()))
	ansString = 'a' * n
	ans = binSearch(dp[:n + 1], k)
	if dp[ans] != k:
		ans += 1
	ansString = ansString[:-2 - ans] + 'b' + ansString[-2 - ans + 1:]
	newPos = dp[ans] - k
	if -1 - ans + newPos + 1 != 0:
		ansString = ansString[:-1 - ans + newPos] + 'b' + ansString[-1 - ans + newPos + 1:]
	else:
		ansString = ansString[:-1 - ans + newPos] + 'b'
	print(ansString)


t = int(input())
while t:
	(n, k) = [int(s) for s in input().split()]
	s = ['a' for i in range(n)]
	cnt = 0
	for h in range(1, n):
		cnt += h
		if k <= cnt:
			break
	s[h] = 'b'
	s[k - (cnt - h + 1)] = 'b'
	for i in reversed(s):
		print(i, end='')
	print()
	t = t - 1


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	for i in range(1, n + 1):
		sm = (i + 1) * i // 2
		if sm >= k:
			j = n - i - 1
			break
	l = k - (i - 1) * i // 2
	l = n - l
	s = ''
	for w in range(n):
		if w == l or w == j:
			s = s + 'b'
		else:
			s = s + 'a'
	print(s)


import heapq
from collections import *
import math

def solve():
	(n, k) = map(int, input().split())
	a = 2
	t = 0
	while t < k:
		t = a * (a - 1) // 2
		a += 1
	a -= 1
	if t == k:
		f = n - a
		l = f + 1
	else:
		a -= 1
		f = n - a - 1
		l = a * (a + 1) // 2 - k + f + 1
	s = ''
	for i in range(n):
		if i == f or i == l:
			s += 'b'
		else:
			s += 'a'
	print(s)
t = int(input())
for _ in range(t):
	solve()


number_test = int(input())

def find_n(k):
	n = 1
	somme = 1
	while somme < k:
		n += 1
		somme = n * (n + 1) / 2
	return n
for k in range(number_test):
	nk = input().split(' ')
	(n, k) = (int(nk[0]), int(nk[1]))
	g = find_n(k)
	d = int(k - g * (g - 1) / 2)
	sol = 'b' + 'a' * (g - d) + 'b' + 'a' * (d - 1)
	l = len(sol)
	solf = 'a' * (n - l) + sol
	print(solf)


from sys import stdin, stdout
S = lambda x: x * (x + 1) // 2
R = lambda : input()
Ri = lambda x: map(int, x.split())

def bs(n):
	(l, r) = (0, 1000000)
	while r - l > 1:
		m = (l + r) // 2
		if S(m) > n:
			r = m
		else:
			l = m
	return l

def main():
	t = int(R())
	for x in range(t):
		(n, b) = Ri(R())
		if b != 1:
			b -= 1
			c = bs(b)
			d = b - S(c)
			for i in range(1, n + 1):
				if i == n - c - 1 or i == n - d:
					print('b', end='')
				else:
					print('a', end='')
			print()
		else:
			s = 'a' * (n - 2)
			print(s + 'bb')
main()


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	a = ['a'] * n
	i = 1
	while True:
		x = i * (i + 1) // 2
		if k <= x:
			j = i
			p = i * (i - 1) // 2
			a[-(j + 1)] = 'b'
			a[-(k - p)] = 'b'
			break
		i += 1
	print(''.join((str(x) for x in a)))


for _ in range(int(input())):
	(m, n) = map(int, input().split())
	i = 1
	temp = 0
	while temp + i < n:
		temp += i
		i += 1
	arr = ['a'] * m
	arr[m - i - 1] = 'b'
	arr[m - (n - temp)] = 'b'
	print(''.join(map(str, arr)))


from sys import stdin

def func():
	return
for _ in range(int(stdin.readline())):
	(n, k) = map(int, stdin.readline().split())
	count = 1
	i = n - 2
	j = n - 1
	val = 2
	while count != k:
		if count + val < k:
			count += val
			val += 1
			i -= 1
		else:
			i -= 1
			m = 1
			while count + m != k:
				m += 1
			j -= m - 1
			break
	s = 'a' * i + 'b' + 'a' * (j - i - 1) + 'b' + 'a' * (n - j - 1)
	print(s)


def main():
	t = int(input())
	for case in range(t):
		(n, k) = input().split()
		n = int(n)
		k = int(k)
		i = 1
		count = 0
		while count + i < k:
			count += i
			i += 1
		rem = k % (count + 1)
		for j in range(n):
			if j == n - 1 - i or j == n - 1 - rem:
				print('b', end='')
			else:
				print('a', end='')
		print()
main()


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	a = (1 + (1 + 8 * k) ** 0.5) / 2
	if int(a) == a:
		a = int(a)
		print('a' * (n - a) + 'bb' + 'a' * (a - 2))
		continue
	a = int(a)
	p = int(a * (a + 1) / 2)
	c = int(a * (a - 1) / 2)
	print('a' * (n - (a + 1)) + 'b' + 'a' * (p - k) + 'b' + 'a' * (k - c - 1))


t = int(input())
while t > 0:
	t -= 1
	(n, k) = [int(i) for i in input().split()]
	lst = [1]
	for i in range(1, n):
		lst.append(lst[i - 1] + i + 1)
	for i in range(n):
		if k <= lst[i]:
			cases = lst[i] - lst[i - 1]
			before = k - lst[i - 1]
			break
	ans = []
	for i in range(n):
		ans.append('a')
	if k == 1:
		(ans[n - 1], ans[n - 2]) = ('b', 'b')
	else:
		ans[n - cases - 1] = 'b'
		ans[n - before] = 'b'
	final = ''
	for i in ans:
		final += i
	print(final)


arr = []
(c, i, h) = (1, 1, 0)
while i <= 10 ** 5:
	arr.append(c)
	i += 1
	c += i
	h += 1
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	(lb, ub, flag) = (0, h - 1, 0)
	while lb <= ub:
		mid = (lb + ub) // 2
		if arr[mid] == k:
			flag = 1
			break
		elif arr[mid] > k:
			ub = mid - 1
		else:
			lb = mid + 1
	pos = 0
	if flag == 1:
		pos = mid + 2
	else:
		pos = lb + 2
	ones = n - 2
	print('a' * (n - pos) + 'b' + 'a' * (arr[pos - 2] - k) + 'b' + 'a' * (ones - (n - pos + (arr[pos - 2] - k))))


import sys
input = lambda : sys.stdin.readline().rstrip()
from math import sqrt, ceil
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	ans = ceil((-1 + sqrt(8 * k + 1)) / 2)
	a = ['a'] * n
	(a[-(ans + 1)], a[n - 1 - (k - ans * (ans - 1) // 2 - 1)]) = ['b'] * 2
	print(''.join(a))


import os, sys, bisect, copy
from collections import defaultdict, Counter, deque
from functools import lru_cache
if os.path.exists('in.txt'):
	sys.stdin = open('in.txt', 'r')
if os.path.exists('out.txt'):
	sys.stdout = open('out.txt', 'w')

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

def mapi(arg=0):
	return map(int if arg == 0 else str, input().split())
for _ in range(int(input())):
	(n, k) = mapi()
	res = ['a'] * n
	one = int(((8 * k - 7) ** 0.5 + 3) // 2 - 1)
	tmp = ((8 * k - 7) ** 0.5 - 1) // 2
	two = int(k - (tmp ** 2 + tmp) // 2 - 1)
	res[one] = 'b'
	res[two] = 'b'
	res = res[::-1]
	print(''.join(res))


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	kk = k
	i = 1
	while kk - i > 0:
		kk -= i
		i += 1
	b1 = i
	b2 = kk - 1
	ans = ['a'] * n
	ans[n - 1 - b1] = 'b'
	ans[n - 1 - b2] = 'b'
	print(''.join(ans))


def fr(x):
	y = str(x)
	t = 10 * int(y[y.index('.') + 1:])
	if t < 5:
		return int(x)
	elif t >= 5:
		return int(x + 1)
for m in range(int(input().strip())):
	(n, k) = map(int, input().strip().split())
	j = ((8 * k + 1) ** 0.5 - 1) / 2
	j = fr(j)
	x = n - 2 - j + 1
	lowerBound = j * (j - 1) // 2 + 1
	y = n - 2 - x - (k - lowerBound)
	z = n - 2 - x - y
	s = 'a' * x + 'b' + 'a' * y + 'b' + 'a' * z
	print(s)


l = [2]
d = 2
for i in range(2, 100000):
	l.append(l[i - 2] + i)
for u in range(int(input())):
	(n, x) = map(int, input().split())
	s = []
	for j in range(n):
		s.append('a')
	for i in range(len(l)):
		if l[i] > x:
			break
	s[n - (i + 2)] = 'b'
	if i == 0:
		s[n - 1] = 'b'
	else:
		s[n - (x - l[i - 1] + 1)] = 'b'
	ans = ''
	for ch in s:
		ans = ans + ch
	print(ans)


from math import floor
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	st = ['a' for _ in range(n)]
	t = int(floor((-1 + (1 + 8 * k) ** 0.5) / 2))
	r = int(k - t * (t + 1) / 2)
	if r == 0:
		st[n - (t + 1)] = 'b'
		st[n - t] = 'b'
	else:
		st[n - (t + 2)] = 'b'
		st[n - r] = 'b'
	print(''.join(st))


lenl = int(input())
for _ in range(lenl):
	(x, y) = map(int, input().split())
	n = 1
	while n * (n + 1) / 2 < y:
		n += 1
	t = y - n * (n - 1) // 2
	for j in range(x):
		if j == x - t or j == x - n - 1:
			print('b', end='')
		else:
			print('a', end='')
	print()


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	l = ['a'] * n
	prev = 0
	current = 0
	i = 1
	while current < k:
		prev = current
		current += i
		i += 1
	l[n - i] = 'b'
	step = k - prev
	l[-step] = 'b'
	print(''.join(l))


t = int(input())
while t:
	t -= 1
	(n, k) = map(int, input().split())
	i = n - 2
	s = ['a'] * n
	while i >= 0:
		if k <= n - i - 1:
			s[i] = 'b'
			s[n - k] = 'b'
			break
		k -= n - i - 1
		i -= 1
	print(''.join(s))


def bn(a, b):
	l = 0
	r = a
	while r - l > 1:
		m = (r + l) // 2
		if m * (m + 1) // 2 < b:
			l = m
		else:
			r = m
	return l
t = int(input())
for xr in range(t):
	(a, b) = map(int, input().split())
	l = bn(a, b) + 1
	tr = l * (l + 1) // 2 - b
	print('a' * (a - 1 - l) + 'b' + 'a' * tr + 'b' + 'a' * (l - tr - 1))


import sys
for i in range(int(sys.stdin.readline())):
	(num, limit) = map(int, sys.stdin.readline().split())
	limit -= 1
	li = ['a'] * num
	b1 = num - 2
	b2 = num - 1
	count = 0
	moveb1 = 0
	moveb2 = 0
	for j in range(1, num + 1):
		count += j
		if count > limit:
			moveb1 = j - 1
			moveb2 = limit - (count - j)
			break
	li[b1 - moveb1] = 'b'
	li[b2 - moveb2] = 'b'
	print(''.join(li))


import sys
input = sys.stdin.readline
for i in range(int(input())):
	(a, b) = map(int, input().split())
	j = 0
	i = 0
	while i < b:
		j += 1
		i += j
	i -= j
	l = ['a'] * a
	l[~j] = 'b'
	l[~(b - i - 1)] = 'b'
	print(''.join(l))


n = int(input())
for i in range(n):
	(x, y) = map(int, input().split())
	d1 = 0
	d2 = 0
	for i in range(1, x):
		if y > i * (i - 1) // 2 and y <= min(2 * 10 ** 9, i * (i + 1) // 2):
			h = y - i * (i - 1) // 2
			l = h % i
			d1 = i
			d2 = i if l == 0 else l
			break
	for j in range(x):
		if j == x - 1 - d1 or j == x - d2:
			print('b', end='')
		else:
			print('a', end='')
	print()


import bisect
t = int(input())
pre = [0]
for i in range(1, 10 ** 5 + 1):
	pre.append(pre[-1] + i)
while t:
	t -= 1
	(n, k) = map(int, input().split())
	first = bisect.bisect_left(pre, k - 1)
	if pre[first] > k - 1:
		first -= 1
	second = k - pre[first]
	ans = ['a'] * n
	ans[-(first + 2)] = 'b'
	ans[-second] = 'b'
	print(''.join(ans))


import bisect
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().strip().split())
	s = ''
	s += 'a' * (n - 2)
	s += 'b' * 2
	tot = n * (n - 1) // 2
	arr = [1]
	curr = arr[0]
	j = 1
	while curr <= tot:
		arr.append(curr + j)
		curr = curr + j
		j += 1
	x = bisect.bisect_left(arr, k, 0, len(arr))
	if arr[x] != k:
		x -= 1
	left = n - (x + 2)
	diff = k - arr[x]
	right = n - 1 - diff
	ans = ''
	for i in range(n):
		if i == left or i == right:
			ans += 'b'
		else:
			ans += 'a'
	print(ans)


import sys
import math
lines = sys.stdin.readlines()
T = int(lines[0])
for t in range(T):
	(n, k) = map(int, lines[t + 1].strip().split(' '))
	m = math.ceil(math.sqrt(2 * k))
	for i in range(m + 2, m - 1, -1):
		if i * (i - 1) // 2 >= k and k > (i - 1) * (i - 2) // 2:
			index = i
			break
	res = 'a' * (n - i) + 'b' + 'a' * (i * (i - 1) // 2 - k) + 'b' + 'a' * (i - 2 - i * (i - 1) // 2 + k)
	print(res)


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	j = 1
	s = 0
	k = 0
	while 1:
		s = s + j
		k = k + 1
		j = j + 1
		if s >= b:
			break
	ss = ''
	for i in range(1, a + 1):
		if i == a - k:
			ss = ss + 'b'
		elif i == a - (k - (s - b) - 1):
			ss = ss + 'b'
		else:
			ss = ss + 'a'
	print(ss)


from collections import Counter

def solve(letters, rank, n):
	ctr = Counter()
	permcount = 1
	for i in range(n):
		x = letters[i]
		ctr[x] += 1
		permcount = permcount * (i + 1) // ctr[x]
	perm = []
	for i in range(n):
		for x in sorted(ctr.keys()):
			suffixcount = permcount * ctr[x] // (len(letters) - i)
			if rank <= suffixcount:
				perm.append(x)
				permcount = suffixcount
				ctr[x] -= 1
				if ctr[x] == 0:
					del ctr[x]
				break
			rank -= suffixcount
	return ''.join(perm)
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	st = 'a' * (n - 2) + 'bb'
	print(solve(st, k, n))


T = int(input())
for it in range(T):
	s = input().split()
	n = int(s[0])
	k = int(s[1])
	k = n * (n - 1) // 2 - k + 1
	ans = ['a' for i in range(n)]
	for i in range(0, n):
		if k <= n - 1 - i:
			break
		k -= n - i - 1
	ans[i] = 'b'
	ans[i + k] = 'b'
	for i in ans:
		print(i, end='')
	print()


def f(low, high, x):
	while high >= low:
		mid = (high + low) // 2
		if mid * (mid - 1) < x and mid * (mid + 1) >= x:
			return mid
		elif mid * (mid + 1) > x:
			high = mid - 1
		else:
			low = mid + 1
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	a = f(0, n, 2 * k)
	ans = 'a' * n
	b = int(a * (a + 1) / 2 - k)
	t1 = ans[:-(a + 1)] + 'b' + 'a' * b + 'b'
	t2 = n - len(t1)
	t1 += 'a' * t2
	print(t1)


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	t = ['a'] * a
	z = 0
	count = 0
	while b > 0:
		b -= z
		z += 1
		count += 1
	t[-count] = 'b'
	t[-count - b + 1] = 'b'
	print(''.join(t))


t = int(input())
for _ in range(t):
	(n, k) = list(map(int, input().split()))
	i = 1
	s = 1
	while k > s:
		i += 1
		s += i
	res = ['b'] + ['a'] * i
	res[s - k + 1] = 'b'
	res = ['a'] * (n - i - 1) + res
	print(''.join(res))


import math
for _ in range(int(input())):
	(n, k) = list(map(int, input().split()))
	d = 1 + 8 * k
	t = (math.sqrt(d) - 1) / 2
	if t == math.floor(t):
		t = int(t)
	else:
		t = math.ceil(t)
	aux = k - int(t * (t - 1) / 2)
	t = n - 1 - t
	aux = n - aux
	a = ['a'] * n
	a[t] = 'b'
	a[aux] = 'b'
	print(''.join(a))


n = int(input())
while n > 0:
	(a, b) = [int(x) for x in input().split()]
	k = 0
	while k * (k + 1) // 2 < b:
		k = k + 1
	r = a - k
	L = ['b' if i == r - 1 else 'a' for i in range(a)]
	b -= (k - 1) * k // 2
	L[a - b] = 'b'
	print(''.join(L))
	n = n - 1


t = int(input())
cases = []
for i in range(t):
	inp = input().split()
	a = int(inp[0])
	b = int(inp[1])
	cases.append([a, b])
b_letter = []
for i in range(t):
	n = cases[i][0]
	k = cases[i][1]
	r = int((k * 2) ** 0.5)
	x = r * (r + 1) / 2
	while x < k:
		r = r + 1
		x = int(r * (r + 1)) / 2
	first_b = n - 1 - r
	second_b = int(x - k + first_b + 1)
	b_letter.append([first_b, second_b])
for i in range(t):
	s = ''
	n = cases[i][0]
	first_b = b_letter[i][0]
	second_b = b_letter[i][1]
	for i in range(n):
		if i == first_b or i == second_b:
			s = s + 'b'
		else:
			s = s + 'a'
	print(s)


import math

def version_one():
	t = int(input())
	r = []
	while t > 0:
		(n, k) = list(map(int, input().split()))
		string = ['a'] * n
		for i in range(len(string) - 2, -1, -1):
			for j in range(len(string) - 1, i, -1):
				k = k - 1
				if k == 0:
					string[i] = 'b'
					string[j] = 'b'
					r.append(''.join(string))
					break
			if k <= 0:
				break
		t = t - 1
	for x in r:
		print(x)

def version_two():
	t = int(input())
	r = []
	while t > 0:
		(n, k) = list(map(int, input().split()))
		string = ['a'] * n
		nd = (1 + math.sqrt(1 + 8 * k)) / 2
		nr = int(nd)
		if float(nr) == nd:
			string[len(string) - nr] = 'b'
			string[len(string) - nr + 1] = 'b'
		else:
			rem = int(nr * (nr + 1) / 2)
			rem = rem - k
			i = len(string) - nr - 1
			string[i] = 'b'
			string[i + 1 + rem] = 'b'
		r.append(''.join(string))
		t = t - 1
	for x in r:
		print(x)
version_two()


import sys
input = sys.stdin.readline
for i in range(int(input())):
	(a, b) = map(int, input().split())
	shag = 1
	now = 0
	while now + shag < b:
		now += shag
		shag += 1
	sc = b - now
	for j in range(a):
		print('b' if j == a - shag - 1 or j == a - sc else 'a', end='')
	print()


t = int(input())
l = []
for i in range(t):
	l.append([int(x) for x in input().split()])

def s(n, k):
	c = 1
	while c * (c + 1) / 2 < k:
		c += 1
	f = c * (c + 1) // 2 - k
	v = 'b' + 'a' * f + 'b'
	g = 'a' * n
	g = g[0:n - c - 1]
	g = g + v
	g = g + 'a' * n
	g = g[0:n]
	return g
for i in l:
	print(s(i[0], i[1]))


t = int(input())
for i in range(t):
	(n, k) = input().split()
	n = int(n)
	k = int(k)
	t = 0
	s = ''
	(ind1, ind2) = (0, 0)
	for j in range(0, n + 1):
		if t + j + 1 == k:
			ind1 = j
			ind2 = j + 1
			break
		if t + j + 1 > k:
			ind1 = j + 1
			ind2 = k - t - 1
			break
		t += j + 1
	for j in range(n):
		if j == ind1:
			s += 'b'
		elif j == ind2:
			s += 'b'
		else:
			s += 'a'
	print(s[::-1])


n = int(input())
for i in range(n):
	nk = list(map(int, input().split()))
	n = nk[0]
	k = nk[1]
	found = False
	for a in range(n - 1, 1, -1):
		if k > a * (a - 1) / 2:
			first = n - (a + 1)
			second = int(n - (k - a * (a - 1) / 2))
			answer = ''
			answer += 'a' * first
			answer += 'b'
			answer += 'a' * (second - first - 1)
			answer += 'b'
			answer += 'a' * (n - second - 1)
			print(answer)
			found = True
			break
	if not found:
		print('a' * (n - 2) + 'bb')


for _ in range(int(input())):
	(n, k) = list(map(int, input().split()))
	string = ['a'] * n
	final = ''
	if k < (n - 1) * (n - 2) // 2:
		for i in range(1, n):
			value = i * (i - 1) // 2
			if value > k:
				maxi = i
				mini = i - 1
				count = mini * (mini - 1) // 2
				far = k - count
				string[n - maxi] = 'b'
				string[n - far] = 'b'
				break
			elif value == k:
				string[n - i] = 'b'
				string[n - i + 1] = 'b'
				break
	elif k > (n - 1) * (n - 2) // 2:
		value = (n - 1) * (n - 2) // 2
		far = k - value
		string[0] = 'b'
		string[n - far] = 'b'
	elif k == (n - 1) * (n - 2) // 2:
		string[1] = 'b'
		string[2] = 'b'
	for i in range(n):
		final = final + string[i]
	print(final)


def beau(n, k):
	m = 1
	t = 1
	while k > m:
		t += 1
		m = t * (t + 1) // 2
	print('a' * (n - t - 1) + 'b' + 'a' * (m - k) + 'b' + 'a' * (t + k - m - 1))
t = int(input())
l = []
for i in range(t):
	s = list(map(int, input().split()))
	l.append(s)
for j in l:
	beau(j[0], j[1])


t = int(input())
ent = lambda x: int(x * (x - 1) / 2)

def test():
	a = [int(x) for x in input().split()]
	n = a[0]
	k = a[1]
	if k == 1:
		print('a' * (n - 2), end='')
		print('bb')
		pass
	else:
		m = 2
		while ent(m) < k:
			m += 1
		m -= 1
		s = ['a'] * n
		s[n - m - 1] = 'b'
		s[n - k + ent(m)] = 'b'
		print(''.join(s))
while t:
	test()
	t -= 1


n = int(input())
for _ in range(n):
	(a, b) = map(int, input().split())
	st = list('a' * (a - 2) + 'bb')
	if b == 1:
		print(''.join(st))
	else:
		row = 0
		r = 0
		count = 0
		minn = 0
		for i in range(1, 1000000):
			if i * (i - 1) // 2 + 1 <= b <= (i + 1) * i // 2:
				row = i
				break
		minn = 1 + (1 + row - 1) * (row - 1) // 2
		aa = b % minn
		temp1 = st[-2]
		temp2 = st[-1]
		st[-2] = st[-(row + 1)]
		st[-(row + 1)] = temp1
		st[-1] = st[-(aa + 1)]
		st[-(aa + 1)] = temp2
		print(''.join(st))


import math

def quad(val):
	val = 2 * val
	s1 = (1 + math.sqrt(1 + 4 * val)) / 2
	s1 = math.ceil(s1)
	return s1
t = int(input())
lol = []
for _ in range(t):
	(n, k) = list(map(int, input().split()))
	op = ['a'] * n
	b1 = quad(k)
	b2 = k - 1 - (b1 - 1) * (b1 - 2) // 2
	op[n - b1] = 'b'
	op[n - b2 - 1] = 'b'
	out = ''.join(op)
	lol.append(out)
print(*lol, sep='\n')


n = int(input())
while n:
	(a, b) = map(int, input().split())
	s = 0
	for i in range(1, a):
		s += i
		if s >= b:
			j = a + 1 - (b - (s - i)) - 1
			s = a - i - 1
			break
	for i in range(a):
		if i == j or i == s:
			print('b', end='')
		else:
			print('a', end='')
	print('')
	n -= 1


import sys
input = sys.stdin.readline

def main():
	for _ in range(int(input())):
		(n, k) = map(int, input().split())
		n1 = n2 = 0
		for i in range(2, n + 1):
			if k <= i * (i - 1) / 2:
				n1 = i - 1
				n2 = n1 - (n1 * (n1 + 1) // 2 - k) - 1
				break
		i = n - n1 - 1
		j = n - n2 - 1
		print('a' * i + 'b' + 'a' * (j - i - 1) + 'b' + 'a' * (n - j - 1))
main()


t = int(input())
for i in range(t):
	(n, k) = input().split(' ')
	n = int(n)
	k = int(k)
	for i in range(1, n):
		if k - i > 0:
			k = k - i
		else:
			break
	ans = ['a'] * n
	ans[n - i - 1] = 'b'
	ans[n - k] = 'b'
	print(''.join(ans))


from math import sqrt

def k_string(n, k):
	a = int(sqrt(2 * k - 7 / 4) + 1 / 2)
	c = k - a * (a - 1) // 2
	s = ['a' for _ in range(n)]
	(s[n - c], s[n - a - 1]) = ('b', 'b')
	return ''.join(s)
t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	print(k_string(n, k))


t = int(input())
while t > 0:
	(n, k) = map(int, input().strip().split())
	c = []
	c1 = ''
	r = k % n
	d = int(k / n)
	i = 1
	j = 0
	while i + j < k:
		j += i
		i += 1
	i1 = n - (i + 1)
	i2 = i1 + (j + i - k + 1)
	c = ['a'] * n
	c[i1] = 'b'
	c[i2] = 'b'
	c1 = ''.join(c)
	print(c1)
	t -= 1


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	ans = ['a'] * n
	c = 1
	while True:
		if k - c * (c + 1) // 2 <= 0:
			C = c - 1
			ans[n - 2 - C] = 'b'
			ans[n - (k - C * (C + 1) // 2)] = 'b'
			break
		c += 1
	print(''.join(ans))


from sys import stdin

def ncr(n, r):
	if n < r:
		return 0
	if r == 2:
		return n * (n - 1) // 2
	if r == 1:
		return n
	else:
		return 1

def main():
	inp = stdin.readline
	for _ in range(int(inp())):
		(n, k) = map(int, inp().split())
		b_used = 0
		s = []
		for u in range(n):
			h = ncr(n - 1 - u, 2 - b_used)
			if h >= k:
				s.append('a')
			else:
				s.append('b')
				b_used += 1
				k -= h
		print(''.join(s))
main()


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	k = n * (n - 1) // 2 - k + 1
	m = n - 1
	while k - m > 0:
		k -= m
		m -= 1
	m = n - m
	k = m + k
	for i in range(1, n + 1):
		if i != m and i != k:
			print('a', end='')
		else:
			print('b', end='')
	print()


t = int(input())
import math
for _ in range(t):
	(n, k) = map(int, input().split())
	r = int((-1 + math.sqrt(1 + 8 * k)) // 2)
	rem = -(k - r * (r + 1) // 2)
	l = -(r + 1)
	if rem == 0:
		rem = -r
	else:
		l -= 1
	string = ['a'] * n
	string[l] = 'b'
	string[rem] = 'b'
	print(''.join(string))


import math

def init(n):
	return ['a' for i in range(n)]

def insert(String, n, n1, n2):
	String[n - n1 - 1] = String[n - n2] = 'b'
t = int(input())
for i in range(t):
	(n, k) = [int(j) for j in input().split(' ')]
	String = init(n)
	b1 = math.ceil((2 * k + 1 / 4) ** 0.5 - 1 / 2)
	b2 = int(k - b1 * (b1 - 1) / 2)
	insert(String, n, b1, b2)
	print(''.join(String))


import sys
import math
input = sys.stdin.readline

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

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

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

def invr():
	return map(int, input().split())
tests = inp()
testcount = 0
while testcount < tests:
	arr = inlt()
	a = arr[0]
	b = arr[1]
	k = math.floor(math.sqrt(2 * b) + 0.5)
	triangle = k * (k - 1) / 2
	print('a' * int(a - k - 1) + 'b' + 'a' * int(triangle - b + k) + 'b' + 'a' * int(b - triangle - 1))
	testcount += 1


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	x = n * (n - 1) // 2
	c = n - 1
	while x - c >= k:
		x -= c
		c -= 1
	l = ['a'] * n
	l[c] = 'b'
	l[c + (k - x - 1)] = 'b'
	print(*l[::-1], sep='')


import math

def tri(k):
	z = (1 + math.sqrt(1 + 8 * k)) / 2
	if z == int(z):
		return (int(z), 'NO')
	else:
		return (int(z), 'YES')
t = int(input())
for you in range(t):
	l = input().split()
	n = int(l[0])
	k = int(l[1])
	pu = tri(k)
	if pu[1] == 'NO':
		pos1 = n - pu[0]
		pos2 = pos1 + 1
	else:
		pos1 = n - pu[0] - 1
		pos2 = n - (k - pu[0] * (pu[0] - 1) // 2)
	for i in range(n):
		if i == pos1:
			print('b', end='')
		elif i == pos2:
			print('b', end='')
		else:
			print('a', end='')
	print()


def k_string(n, line_number):
	total = 0
	for i in range(1, n):
		if total <= line_number <= total + i:
			break
		total += i
	res = ['a' if j not in [i, line_number - total - 1] else 'b' for j in range(n - 1, -1, -1)]
	return ''.join(res)
results = ''
for _ in range(int(input())):
	(n, line_number) = [int(e) for e in input().split()]
	results += k_string(n, line_number) + '\n'
print(results, sep='')


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	(l, r) = (1, 0)
	while l * (l + 1) // 2 < k:
		l += 1
	r = k - 1 - l * (l - 1) // 2
	ans = ['a'] * n
	ans[l] = ans[r] = 'b'
	print(''.join(ans[::-1]))


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	i = int((1 + (1 + 8 * (k - 1)) ** 0.5) / 2)
	j = k - i * (i - 1) // 2 - 1
	print((n - i - 1) * 'a' + 'b' + (i - j - 1) * 'a' + 'b' + j * 'a')


from math import sqrt
b = int(input())
nn = []
kk = []
for _ in range(b):
	buf = input().split(' ')
	nn.append(int(buf[0]))
	kk.append(int(buf[1]))
for (n, k) in zip(nn, kk):
	buf = int(sqrt(1 + 8 * k))
	x = (1 + buf) // 2
	if x * (x - 1) // 2 == k:
		x = x - 1
	pos1 = n - 1 - x
	pos2 = n - (k - x * (x - 1) // 2)
	s = ['a'] * n
	s[pos1] = 'b'
	s[pos2] = 'b'
	print(''.join(s))


import os
import sys
from io import BytesIO, IOBase
from bisect import bisect_left, bisect_right
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

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

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

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

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

class IOWrapper(IOBase):

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

def scanf(datatype=str):
	return datatype(sys.stdin.readline().rstrip())

def printf(answer=''):
	return sys.stdout.write(str(answer) + '\n')

def prints(answer):
	return sys.stdout.write(str(answer) + ' ')

def map_input(datatype=str):
	return map(datatype, sys.stdin.readline().split())

def list_input(datatype=str):
	return list(map(datatype, sys.stdin.readline().split()))

def testcase(number: int, solve_function):
	for _ in range(number):
		printf(solve_function())

def solve():
	(n, k) = map_input(int)
	s = ['a'] * n
	l = 1
	Sum = 0
	while l * (l - 1) // 2 < k:
		Sum += l
		l += 1
	s[-(k - (Sum - l)) + 1] = 'b'
	s[-l] = 'b'
	return ''.join(s)
t = scanf(int)
testcase(t, solve)


from math import sqrt, ceil
for _ in range(int(input())):
	(N, K) = map(int, input().split())
	S = list('a' * N)
	Z = ceil((-1 + sqrt(1 + 8 * K)) / 2)
	S[N - Z - 1] = 'b'
	S[N - (K - (Z - 1) * Z // 2)] = 'b'
	print(''.join(S))


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	a = ['a'] * (n - 2)
	a.extend(['b'] * 2)
	pk = 0
	j = 1
	prev = pk
	for i in range(n - 2, -1, -1):
		prev = pk
		pk += j
		j += 1
		if pk >= k:
			break
	(a[-2], a[-j]) = (a[-j], a[-2])
	(a[-1], a[-j + 1 + pk - k]) = (a[-j + 1 + pk - k], a[-1])
	print(''.join(a))


from functools import lru_cache
import sys
sys.setrecursionlimit(375000)

@lru_cache(maxsize=None)
def score(a, b):
	if a < 0 or b < 0:
		return 0
	if a == 0 and b == 0:
		return 1
	return score(a - 1, b) + score(a, b - 1)
t = int(input())
for i in range(t):
	(n, k) = list(map(int, input().split()))
	for i in range(n - 2, -1, -1):
		if k <= n - i - 1:
			pos = i
			pos2 = n - k
			break
		else:
			k -= n - i - 1
	for i in range(n):
		if i == pos or i == pos2:
			print('b', end='')
		else:
			print('a', end='')
	print('\n')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	x = int((2 * k) ** 0.5)
	z = x - 1
	if x * (x + 1) // 2 < k:
		z = x
	ans = ['a'] * n
	y = n - 1 - z - 1
	ans[y] = 'b'
	x = n - k + z * (z + 1) // 2
	ans[x] = 'b'
	print(''.join((e for e in ans)))


test = int(input())
my_list = []
while test != 0:
	(n, k) = [int(n) for n in input().split()]
	string = 'a' * n
	i = n - 2
	while i >= 0:
		if k <= n - 1 - i:
			string = string[:i] + 'b' + string[i + 1:]
			string = string[:n - k] + 'b' + string[n - k + 1:]
			my_list.append(string)
			break
		k -= n - 1 - i
		i -= 1
	test -= 1
for i in my_list:
	print(i)


for _ in range(int(input())):
	(N, k) = map(int, input().split())
	n = max((-1 + (1 + 8 * k) ** 0.5) // 2, (-1 - (1 + 8 * k) ** 0.5) // 2)
	t = k - n * (n + 1) // 2
	n = int(n)
	t = int(t)
	if t == 0:
		s = (n - 1) * 'a' + 'bb' + (N - n - 1) * 'a'
	else:
		s = (t - 1) * 'a' + 'b' + (n + 1 - t) * 'a' + 'b' + (N - n - 2) * 'a'
	print(s[::-1])


t = int(input())
test_cases = []
for i in range(t):
	test_cases.append([int(v) for v in input().split(' ', 2)])

def find_group(n):
	s = 1
	i = 1
	while s < n:
		i += 1
		s += i
	return [i, s]

def solution(t, test_cases):
	outputs = []
	for test in test_cases:
		n = test[0]
		k = test[1]
		result = ['a' for i in range(n)]
		(group, total) = find_group(k)
		result[n - group - 1] = 'b'
		result[n - group + total - k] = 'b'
		outputs.append(''.join(result))
	return outputs
for s in solution(t, test_cases):
	print(s)


import sys
import math

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

def idata():
	return [int(x) for x in ii().split()]

def binary_search(array, x):
	(left, right) = (-1, len(array))
	while left + 1 != right:
		middle = (left + right) // 2
		if array[middle] >= x:
			right = middle
		elif array[middle] < x:
			left = middle
	return right

def solve_of_problem():
	(n, k) = idata()
	d = math.sqrt(8 * k + 1)
	if d % 1 == 0:
		z = int((1 + d) // 2)
		print('a' * (n - z) + 'bb' + 'a' * (z - 2))
	else:
		z = int((1 + d) // 2)
		k -= z * (z - 1) // 2
		print('a' * (n - z - 1) + 'b' + 'a' * (z - k) + 'b' + 'a' * (k - 1))
	return
for ______ in range(int(ii())):
	solve_of_problem()


for j in range(int(input())):
	(n, k) = map(int, input().split())
	i = 1
	while k > i:
		k -= i
		i += 1
	print('a' * (n - i - 1) + 'b' + 'a' * (i - k) + 'b' + 'a' * (k - 1))


for t in range(int(input())):
	(n, k) = map(int, input().split())
	c = 0
	r = 1
	while 1:
		if c + r >= k:
			f = k - c
			break
		c = c + r
		r += 1
	z = n - r - 1
	y = n - f
	s = ''
	for i in range(n):
		if i == z or i == y:
			s = s + 'b'
		else:
			s = s + 'a'
	print(s)


import sys
import math

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

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

def read_int_line():
	return [int(v) for v in sys.stdin.readline().split()]
t = read_int()
for i in range(t):
	(n, k) = read_int_line()
	r = 1
	while r * (r + 1) < 2 * k:
		r += 1
	r = r - 1
	lower = 1 + (r + 1) * r // 2
	j = k - lower
	st = 'a' * (n - 2 - r) + 'b' + 'a' * (r - j) + 'b' + 'a' * j
	print(st)


t = int(input())
for i in range(t):
	NK = list(map(int, input().split()))
	n = NK[0]
	k = NK[1]
	sum = 0
	for i in range(1, n):
		sum += i
		if sum >= k:
			break
	str = ['a' for j in range(n)]
	str[n - i - 1] = 'b'
	diff = sum - k
	posi = i - diff
	str[n - posi] = 'b'
	str = ''.join(str)
	print(str)


for i in range(int(input())):
	(n, k) = map(int, input().split())
	x = 0
	y = 1
	while x < k:
		x += y
		y += 1
	print('a' * (n - y) + 'b' + 'a' * (x - k) + 'b' + 'a' * (y + k - x - 2))


import sys
import math
input = sys.stdin.readline
print = sys.stdout.write

def ye(k):
	i = 0
	while i * (i - 1) / 2 < k:
		i += 1
	return i - 1

def main():
	q = int(input())
	for x in range(q):
		(a, b) = map(int, input().split())
		y = ye(b)
		y2 = int(b - y * (y - 1) / 2)
		s = ''
		for x in range(a):
			if y == x or x == y2 - 1:
				s += 'b'
			else:
				s += 'a'
		s = s[::-1]
		print(s + '\n')
main()


from math import *
from sys import *
t = int(stdin.readline())
for _ in range(t):
	(n, k) = map(int, stdin.readline().split())
	i = 1
	prev = i
	p = 0
	x = 1
	while i <= k:
		p += 1
		prev = i
		i += x
		x += 1
	ans = ['a'] * n
	for i in range(n):
		if i == p:
			ans[n - i - 1] = 'b'
			break
	k -= prev
	ans[n - k - 1] = 'b'
	print(*ans, sep='')


import bisect
t = int(input())
bb = []
i = 2
b = 2
bb.append(0)
while i < 4999960001:
	bb.append(i)
	i += b
	b += 1
for test in range(t):
	(n, k) = [int(x) for x in input().split()]
	if n == 3:
		if k == 1:
			print('abb')
		elif k == 2:
			print('bab')
		else:
			print('bba')
		continue
	elif n == 4:
		if k == 1:
			print('aabb')
		elif k == 2:
			print('abab')
		elif k == 3:
			print('abba')
		elif k == 4:
			print('baab')
		elif k == 5:
			print('baba')
		elif k == 6:
			print('bbaa')
		continue
	elif k == 1:
		for i in range(n - 2):
			print('a', end='')
		print('bb')
		continue
	x = bisect.bisect_left(bb, k)
	if bb[x] == k:
		fb = n - 2 - x
		sb = n - 1
	else:
		fb = n - 2 - (x - 1)
		sb = n - 1 - (k - bb[x - 1])
	for i in range(n):
		if i == sb:
			print('b', end='')
		elif i == fb:
			print('b', end='')
		else:
			print('a', end='')
	print()


def solution(q):
	ans = []
	for i in range(len(q)):
		flag = True
		(n, k) = q[i]
		s = []
		count = 1
		b1 = 1
		b2 = 0
		while count < k + 1:
			if count + b1 < k:
				count = count + b1
				b1 = b1 + 1
			elif count + b1 == k:
				count = count + b1
				b1 = b1 + 1
			elif count + b1 > k:
				b2 = k - count
				count = count + b1
		for i in range(n - b1 - 1):
			s.append('a')
		s.append('b')
		for i in range(n - b1, n - b2 - 1):
			s.append('a')
		s.append('b')
		for i in range(n - b2, n):
			s.append('a')
		ans.append(s)
	return ans

def main():
	t = int(input())
	array = []
	for i in range(t):
		x = list(map(int, input().split()))
		array.append(x)
	ans = solution(array)
	for i in range(len(ans)):
		s = ''.join(map(str, ans[i]))
		print(s)
main()


import math

def ProcessInputs():
	(N, K) = map(int, input().strip().split())
	n = (math.sqrt(8 * K - 7) - 3) / 2
	if n > 1 and n % int(n) == 0:
		n = int(n)
		rem = 0
	else:
		n = int(n)
		rem = K - (int(n * (n + 1) / 2) + (n + 1) + 1)
	pos = int((1 + math.sqrt(8 * K - 7)) / 2)
	fa = 'a' * (N - pos - 1) + 'b'
	n = n - rem + 1
	fa += 'a' * n + 'b'
	L = len(fa)
	fa += 'a' * (N - L)
	print(fa)
T = int(input())
for _ in range(T):
	ProcessInputs()


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	arr = ['a'] * n
	lst = [0, 1]
	for i in range(1, n):
		lst.append(lst[i] + i)
	for i in range(1, n):
		if lst[i] <= k < lst[i + 1]:
			a = n - 1 - i
			arr[a] = 'b'
			arr[n - 1 - (k - lst[i])] = 'b'
			break
	print(''.join(arr))


import math
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	t = int((math.sqrt(8 * k + 1) - 1) // 2)
	k -= t * (t + 1) // 2
	if k == 0:
		ans = 'a' * n
		ans = list(ans)
		ans[n - t - 1] = 'b'
		ans[n - t] = 'b'
		ans = ''.join(ans)
		print(ans)
	else:
		ans = 'a' * n
		ans = list(ans)
		ans[n - t - 2] = 'b'
		ans[-k] = 'b'
		ans = ''.join(ans)
		print(ans)


t = int(input())
for h in range(t):
	l = list(map(int, input().split()))
	n = l[0]
	k = l[1]
	c = 0
	i = 1
	while c < k and i != n:
		c += i
		i += 1
	d = n - c + k - 1
	s = ''
	e = n - i + 1
	if e == 1:
		s += 'b'
	else:
		for j in range(e - 1):
			s += 'a'
		s += 'b'
	for j in range(n - 1 - d):
		s += 'a'
	s += 'b'
	for j in range(d - e):
		s += 'a'
	print(s)


for i in range(int(input())):
	(n, k) = map(int, input().split())
	for j in range(1, n):
		if j * (j + 1) / 2 < k:
			continue
		else:
			pos = -1 * (j + 1)
			pos2 = pos + (j * (j + 1) // 2 - k) + 1
			break
	s = ['a'] * n
	s[pos] = 'b'
	s[pos2] = 'b'
	print(''.join(s))


T = int(input())
for i in range(T):
	(n, k) = map(int, input().split())
	c = 1
	i = 1
	a = 1
	b = 0
	f = 0
	l1 = ['a' for i in range(n)]
	c1 = 1
	c2 = 2
	if k >= n * (n - 1) // 2:
		l1[0] = 'b'
		l1[1] = 'b'
		print(''.join(l1))
	else:
		while k > c:
			a = a + 1
			i = i + 1
			c = c + i
		l1[len(l1) - 1 - a] = 'b'
		b = c - k
		l1[len(l1) - a + b] = 'b'
		w = ''.join(l1)
		print(w)


t = int(input())
while t > 0:
	t -= 1
	(n, k) = map(int, input().split())
	s = 'a' * n
	s = list(s)
	for i in range(n - 2, -1, -1):
		if k <= n - i - 1:
			s[i] = 'b'
			s[n - k] = 'b'
			print(''.join(s))
			break
		k -= n - i - 1


t = int(input())
while t > 0:
	(n, k) = map(int, input().split())
	s = ''
	for i in range(n):
		s += 'a'
	c = 1
	count = 2
	while k > c:
		c += count
		count += 1
	num = c - k
	s = s[:-count] + 'b' + s[-count + 1:-count + 1 + num] + 'b'
	x = n - len(s)
	for i in range(x):
		s += 'a'
	print(s)
	t -= 1


for t in range(int(input())):
	(n, k) = map(int, input().split())
	res = ''
	m = 2
	while k > m * (m - 1) // 2:
		m += 1
	res += 'a' * (n - m) + 'b'
	d = m * (m - 1) // 2 - k
	res += 'a' * d + 'b'
	res += (m - d - 2) * 'a'
	print(res)


import sys
import os
from io import BytesIO, IOBase
from collections import Counter, deque
import math

def ceil(n, k):
	return n // k + (n % k != 0)

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

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

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

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

def prr(a, sep=' '):
	print(sep.join(map(str, a)))

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)

def ddd():
	return collections.defaultdict(collections.defaultdict(int))
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')
from bisect import bisect_left as bl
sm = [i * (i + 1) // 2 for i in range(10 ** 5 + 10)]
for _ in range(ii()):
	(n, k) = mi()
	idx = bl(sm, k)
	res1 = 'a' * (n - idx - 1)
	stp = k - sm[idx - 1] - 1
	res2 = 'a' * stp + 'b' + 'a' * (idx - stp - 1) + 'b'
	res = res1 + res2[::-1]
	print(res)


from math import sqrt

def string_k(n, k):
	value = round(sqrt(k * 2))
	positionOfb1 = n - value - 1
	positionOfb2 = n - k + value * (value - 1) // 2
	return 'a' * positionOfb1 + 'b' + 'a' * (positionOfb2 - positionOfb1 - 1) + 'b' + 'a' * (n - positionOfb2 - 1)
n_cases = int(input())
[print(string_k(nk[0], nk[1])) for nk in [tuple(map(int, input().split(' '))) for x in range(n_cases)]]


def main():
	t = int(input())
	for _ in range(t):
		(n, k) = map(int, input().split())
		i = 0
		increm = 1
		l = ['a'] * (n - 2)
		while i + increm < k:
			i += increm
			increm += 1
		l.insert(n - increm - 1, 'b')
		ind = k - i
		l.insert(n - ind, 'b')
		print(''.join(l))
main()


import math
t = int(input())
for i in range(0, t):
	ip = str(input()).split(' ')
	n = int(ip[0])
	k = int(ip[1])
	m = math.ceil((-1 + math.sqrt(8.0 * k + 1)) / 2.0)
	first = n - 1 - m
	second = n - int(k - m * (m - 1) / 2)
	lst = ['a' for i in range(0, n)]
	lst[first] = 'b'
	lst[second] = 'b'
	print(*lst, sep='')


t = int(input())
for jjj in range(t):
	(n, k) = map(int, input().split())
	l = 0
	r = n
	while r - l > 1:
		m = (r + l) // 2
		if m * (m + 1) // 2 < k:
			l = m
		else:
			r = m
	l += 1
	k1 = l * (l + 1) // 2 - k
	ans = 'a' * (l - k1 - 1) + 'b' + 'a' * k1 + 'b' + 'a' * (n - 1 - l)
	print(ans[::-1])


t = int(input())
for i in range(0, t):
	(n, k) = map(int, input().split())
	s = 'a' * n
	kk = k
	ss = 0
	ls = list(s)
	for j in range(1, n + 1):
		if j < k:
			k = k - j
			ss = ss + j
		else:
			break
	pos1 = n - j - 1
	pos2 = n - (kk - ss)
	ls[pos1] = 'b'
	ls[pos2] = 'b'
	print(''.join(ls))


for tin in range(int(input())):
	(n, k) = map(int, input().split())
	j = 0
	for i in range(n ** 2):
		if k <= i * (i + 1) // 2:
			h = k - i * (i - 1) // 2
			break
	i = n - i
	j = n - h + 1
	s = list('a' * n)
	s[i - 1] = 'b'
	s[j - 1] = 'b'
	for _ in range(len(s) - 1):
		print(s[_], end='')
	print(s[-1])


def solve():
	(n, k) = map(int, input().split())
	p = int((2 * k - 2) ** 0.5) - 1
	while (p + 1) * (p + 2) // 2 + 1 <= k:
		p += 1
	p1 = -2 - p
	p2 = -1 - (k - p * (p + 1) // 2 - 1)
	ret = ['a'] * n
	ret[p1] = 'b'
	ret[p2] = 'b'
	return ''.join(ret)
t = int(input())
for i in range(t):
	print(solve())


import math
t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	if k == 1:
		r = 2
	else:
		x = (1 + math.sqrt(1 + 8 * k)) / 2
		if x - int(x) == 0:
			r = int(x)
		else:
			r = math.floor(x) + 1
	s = k - (r - 1) * (r - 2) // 2
	for j in range(n - r):
		print('a', end='')
	print('b', end='')
	ost = n - (n - r + 1)
	for j in range(ost - s):
		print('a', end='')
	print('b', end='')
	ost -= ost - s + 1
	for j in range(ost):
		print('a', end='')
	print()


x = int(input())
for index in range(x):
	(n, k) = map(int, input().split())
	a = ['a'] * n
	i = n - 2
	while i >= 0:
		num = n - 1 - i
		if k <= num:
			a[i] = 'b'
			a[n - k] = 'b'
			break
		k -= num
		i -= 1
	resposta = ''.join(a)
	print(resposta)


import math
test_cases = int(input())
for t in range(test_cases):
	(n, k) = list(map(int, input().split()))
	p1 = int(math.floor((1 + (1 + 8 * (k - 1)) ** 0.5) / 2)) + 1
	p2 = int(k - (p1 - 2) * (p1 - 1) / 2)
	res = ['a'] * n
	res[-p1] = 'b'
	res[-p2] = 'b'
	res_str = ''
	res_str = res_str.join(res)
	print(res_str)


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	a = 1
	res = ['a'] * n
	while k > a:
		k -= a
		a += 1
	res[n - a - 1] = 'b'
	res[n - k] = 'b'
	print(''.join(res), end='\n')


def main():
	for _ in range(int(input())):
		(n, k) = list(map(int, input().split()))
		x = ['a'] * n
		y = 1
		while 1:
			if y ** 2 + y - 2 * k >= 0:
				break
			else:
				y += 1
		x[n - y - 1] = 'b'
		x[n - (k - y * (y - 1) // 2)] = 'b'
		print(''.join(x))
main()


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	c = 1
	while c * (c + 1) / 2 < b:
		c += 1
	x = b - c * (c - 1) // 2
	for j in range(a):
		if j == a - x or j == a - c - 1:
			print('b', end='')
		else:
			print('a', end='')
	print()


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	k_xtr = []
	i = 1
	x = 2
	while i <= int(n * (n - 1) / 2) + 1:
		k_xtr.append(i)
		i += x
		x += 1
	x = ['a'] * n
	for i in range(n - 1):
		if k == k_xtr[i]:
			x[-i - 1] = 'b'
			x[-i - 2] = 'b'
			x_str = ''.join(map(str, x))
			print(x_str)
		elif k > k_xtr[i]:
			k_ref = k_xtr[i]
			if k_xtr[i + 1] > k:
				x[-i - 3] = 'b'
				temp = k_ref - k
				x[temp] = 'b'
				x_str = ''.join(map(str, x))
				print(x_str)


import sys
I = sys.stdin.readline
for _ in range(int(I())):
	(n, k) = map(int, I().split())
	f = [0, 0]
	for i in range(n - 2, -1, -1):
		if n - i - 1 >= k:
			f[0] = i
			f[1] = n - k
			break
		k -= n - i - 1
	for i in range(n):
		if i in f:
			print('b', end='')
		else:
			print('a', end='')
	print()


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	ans = ['a'] * n
	num = 1
	i = n - 2
	while num < k:
		k -= num
		num += 1
		i -= 1
	ans[i] = 'b'
	ans[n - k] = 'b'
	print(''.join(ans))


import math, collections, heapq

def check(n):
	for i in range(10 ** 9):
		if i * (i + 1) / 2 >= n:
			return [i, i * (i - 1) / 2]
testcase = int(input())
for _ in range(testcase):
	(n, m) = map(int, input().split())
	s = ['a'] * n
	(a, b) = check(m)
	(a, b) = (int(a), int(b))
	s[-1 - a] = 'b'
	b = m - b
	s[-b] = 'b'
	print(''.join(s))


import sys
input = sys.stdin.readline
I = lambda : list(map(int, input().split()))
t = int(input())
for _ in range(t):
	(n, k) = I()
	an = ['a'] * n
	x = 1
	i = 1
	while x < k:
		x += i
		i += 1
	x = k - (i - 1) * (i - 2) // 2
	if i == x:
		an[n - 1] = 'b'
		if i == 1:
			an[n - 2] = 'b'
		else:
			an[n - i - 1] = 'b'
	else:
		an[n - i] = an[n - x] = 'b'
	print(''.join(an))


test = int(input())
while test:
	test -= 1
	m = 0
	(n, k) = map(int, input().split())
	x = 0
	for i in range(1, n + 1):
		x += i
		if x >= k:
			m = x - i
			x = i - 1
			break
	ls = ['a'] * n
	ll = x
	b2 = k - m
	ll += 1
	ls[-(ll + 1)] = 'b'
	ls[-b2] = 'b'
	print(*ls, sep='')


t = int(input())
for rep in range(t):
	(n, k) = list(map(int, input().split()))
	tempk = n * (n - 1) // 2 - k
	tempn = n - 1
	s = ''
	while tempk >= tempn:
		tempk -= tempn
		tempn -= 1
		s = s + 'a'
	s = s + 'b'
	for i in range(tempk):
		s += 'a'
	s = s + 'b'
	while len(s) < n:
		s = s + 'a'
	print(s)


l = [0, 1]
for i in range(2, 100001):
	l.append(l[-1] + i)
import bisect
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	ind = bisect.bisect_left(l, k)
	s = ['a'] * n
	first_b = ind
	second_b = k - l[ind - 1] - 1
	s[n - first_b - 1] = 'b'
	s[n - second_b - 1] = 'b'
	print(''.join(s))


import math
t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	x = 1 + 8 * k
	y = x ** (1 / 2)
	z = (y - 1) / 2
	z = math.ceil(z)
	init = n - 2
	curr = init - (z - 1)
	ans = 'a' * curr
	x = (z - 1) * z // 2
	y = k - x - 1
	ans += 'b'
	ans += (n - 2 - (k - x - 1) - curr) * 'a'
	ans += 'b'
	ans += (k - x - 1) * 'a'
	print(ans)


import math
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	p = math.ceil(((1 + 8 * k) ** 0.5 - 1) / 2)
	s = (2 * k - p * p + p) / 2
	string = list('a' * n)
	string[int(n - 1 - p)] = 'b'
	string[int(n - s)] = 'b'
	print(''.join(string))


import sys
input = sys.stdin.readline
t = int(input())
for testcase in range(t):
	(n, k) = map(int, input().split())
	ng = 0
	ok = n
	while ok - ng > 1:
		mid = (ok + ng) // 2
		if k <= mid * (mid + 1) // 2:
			ok = mid
		else:
			ng = mid
	ok2 = (ok - 1) * ok // 2
	k -= ok2 + 1
	res = 'a' * (n - 1 - ok) + 'b' + 'a' * (ok - k - 1) + 'b' + 'a' * k
	print(res)


for t in range(int(input())):
	(n, k) = map(int, input().split())
	i = 0
	count = 0
	while i <= n - 2 and count <= k - 1:
		if count + i + 1 <= k - 1:
			count += i + 1
		else:
			break
		i += 1
	posb1 = n - 2 - i
	posb2 = n - (k - count)
	s = ['a'] * n
	s[posb1] = 'b'
	s[posb2] = 'b'
	print(''.join(s))


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	i = 1
	while k > i:
		k -= i
		i += 1
	s = ['a'] * n
	s[-i - 1] = 'b'
	s[-k] = 'b'
	print(''.join(map(str, s)))


import os
import sys
from io import BytesIO, IOBase
from bisect import bisect_left, bisect_right
import threading
arr = []

def main():
	prefix = [0]
	for i in range(1, 10 ** 5):
		prefix.append(prefix[-1] + i)
	for _ in range(int(input())):
		(n, k) = map(int, input().split())
		ans = ['a'] * n
		ind = bisect_left(prefix, k)
		ans[n - 1 - ind] = 'b'
		ans[n - (k - prefix[ind - 1])] = 'b'
		print(''.join(ans))
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

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

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

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

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

class IOWrapper(IOBase):

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


def bober(x):
	(l, r) = (0, 10 ** 9 + 1)
	while r - 1 > l:
		mid = (l + r) // 2
		if mid * (mid + 1) // 2 >= x:
			r = mid
		else:
			l = mid
	return r
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	cur = bober(k)
	print('a' * (n - cur - 1), end='')
	print('b', end='')
	buben = cur * (cur - 1) // 2 + 1
	if buben == 0:
		pos = 0
	else:
		pos = k % buben
	print('a' * (cur - pos - 1), end='')
	print('b', end='')
	print('a' * pos)


from pprint import pprint
import sys
input = sys.stdin.readline
q = int(input())
for _ in range(q):
	(n, k) = map(int, input().split())
	t = 0
	for i in range(10 ** 9):
		t += i
		if t >= k:
			break
	t -= i
	l = i - 1
	r = k - t
	s = list('a' * n)
	s[n - 2 - l] = 'b'
	s[n - r] = 'b'
	print(''.join(s))


import math
for t in range(int(input())):
	(n, k) = map(int, input().split())
	ans = ['a' for i in range(n)]
	firstB = int(math.ceil((-1 + math.sqrt(1 + 8 * k)) / 2))
	secB = k - firstB * (firstB - 1) // 2
	ans[n - (firstB + 1)] = 'b'
	ans[n - secB] = 'b'
	print(''.join(ans))


import math as mt
n = int(input())
for i in range(n):
	m = list(map(int, input().split()))
	a = m[0]
	b = m[1]
	d = mt.ceil((-1 + mt.sqrt(1 + 8 * b)) / 2)
	r = mt.floor(b - (d - 1) * d / 2) - 1
	s = a - (a - d + 1 + r - 1 + 1)
	sd = ''.join(['a'] * r + ['b'] + ['a'] * (d - r - 1) + ['b'] + ['a'] * (a - d - 1))
	print(sd[::-1])


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	str = []
	for i in range(n):
		str.append('a')
	for j in range(n - 2, -1, -1):
		if k <= n - j - 1:
			str[j] = 'b'
			str[n - k] = 'b'
			break
		k -= n - j - 1
	for j in range(n):
		print(str[j], end='')
	print()


for t in range(int(input())):
	(n, k) = map(int, input().split())
	for i in range(1, n + 1):
		if i * (i + 1) // 2 >= k:
			b1 = i
			break
	b2 = b1 * (b1 - 1) // 2
	b2 = k - b2
	b1 = n - b1 - 1
	b2 = n - b2
	for i in range(n):
		if i != b1 and i != b2:
			print('a', end='')
		else:
			print('b', end='')
	print()


T = int(input())
while T > 0:
	number = input()
	number2 = number.split()
	n = int(number2[0])
	e = int(number2[1])
	string = ''
	c = 1
	adder = 2
	while c < e:
		c = c + adder
		adder += 1
	b1 = n - adder
	b2 = b1 + 1
	if c > e:
		b2 = b2 + 1
		adder -= 1
		var = c - adder
		x = c - 1
		while x > var:
			if x != e:
				b2 = b2 + 1
			else:
				break
			x = x - 1
	for x in range(b1):
		string = string + 'a'
	string = string + 'b'
	for x in range(b1 + 1, b2):
		string = string + 'a'
	string = string + 'b'
	if b2 != n:
		for x in range(b2 + 1, n):
			string = string + 'a'
	print(string)
	T -= 1


import math
T = int(input())
for _ in range(T):
	(n, k) = map(int, input().split())
	ans = ['a'] * n
	i = 1
	while i * (i - 1) / 2 < k:
		i += 1
	ans[-i] = 'b'
	temp = int(i * (i - 1) / 2) - k
	ans[-i + temp + 1] = 'b'
	s = ''.join(map(str, ans))
	print(s)


import sys
t = int(input())
for tt in range(t):
	(n, k) = map(int, input().split())
	first = 1
	while first < k:
		k -= first
		first += 1
	second = n - k + 1
	first = n - first
	for i in range(n):
		if i + 1 == first or i + 1 == second:
			print('b', end='')
		else:
			print('a', end='')
	print()


import sys, math, cmath
input = sys.stdin.readline

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

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

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

def invr():
	return map(int, input().split())
t = 1
t = inp()
for tt in range(t):
	(n, k) = invr()
	if n == 2:
		print('bb')
		continue
	a = 1
	b = 1
	c = -2 * k
	d = b ** 2 - 4 * a * c
	sol1 = (-b - cmath.sqrt(d)) / (2 * a)
	sol2 = (-b + cmath.sqrt(d)) / (2 * a)
	q = math.ceil(max(sol1.real, sol2.real)) + 1
	w = k - ((q - 2) * (q - 1) // 2 + 1) + 1
	print('a' * (n - q) + 'b' + 'a' * (q - w - 1) + 'b' + 'a' * (w - 1))


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	l = []
	s = ['a']
	for i in range(2, n + 1):
		l.append(int(i * (i - 1) / 2))
		s.append('a')
	for i in range(n - 1):
		if m <= l[i]:
			break
	s[i + 1] = 'b'
	s[i + 1 - (l[i] - m + 1)] = 'b'
	str1 = ''
	str1 = str1.join(s[::-1])
	print(str1)


t = int(input())
for i in range(0, t):
	(n, k) = map(int, input().split())
	c = 0
	s = 'a' * n
	for j in range(0, n):
		c = c + j
		if c >= k:
			s1 = s[:n - j - 1] + 'b' + s[n - j:]
			s2 = s1[:n - j + (c - k)] + 'b' + s1[n - j + (c - k) + 1:]
			break
	print(s2)


import math

def firstpos(n, k):
	t = 0
	while (t ** 2 + t) // 2 <= k - 1:
		t += 1
	return t - 1
t = int(input())
for tt in range(t):
	(n, k) = map(int, input().split())
	b1 = firstpos(n, k)
	b2 = k - 1 - (b1 ** 2 + b1) // 2
	sol = [0] * n
	sol[b1 + 1] = 1
	sol[b2] = 1
	sol = ''.join(map(lambda x: 'ab'[x], sol))
	print(sol[::-1])


t = int(input())
for wert in range(t):
	(n, k) = input().split()
	n = int(n)
	k = int(k)
	num_of_a = 1
	i = 1
	prev_i = 0
	while i < k:
		num_of_a += 1
		prev_i = i
		i = i + num_of_a
	num = n * (n - 1) // 2
	rem = n - (n - num_of_a - 1)
	z = k - prev_i
	st = 'a' * (n - num_of_a - 1) + 'b' + (rem - 2 - z + 1) * 'a' + 'b' + (z - 1) * 'a'
	print(st)


def search(n):
	(l, r) = (1, n)
	ret = 1
	while l <= r:
		m = (l + r) // 2
		if m * (m + 1) // 2 >= n:
			ret = m
			r = m - 1
		else:
			l = m + 1
	return ret
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	m = search(k)
	f = n - 1 - search(k)
	a = (m - 1) * m // 2
	b = n - (k - a)
	res = ['a'] * n
	res[f] = res[b] = 'b'
	print(''.join(res))


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	k -= 1
	s = int(((1 + 8 * k) ** 0.5 - 1) // 2 + 1)
	left = s + 1
	right = k - s * (s - 1) // 2 + 1
	res = ['a'] * n
	res[-right] = 'b'
	res[-left] = 'b'
	print(*res, sep='')


def binarySearch(mini, maxi, k):
	if maxi - mini <= 1:
		return maxi
	else:
		mid = (maxi + mini) // 2
		total = (mid + 1 + 2) * mid // 2
		if total > k:
			maxi = mid
		elif total == k:
			return mid
		else:
			mini = mid
		return binarySearch(mini, maxi, k)

def solve(n, k):
	st = ['a'] * n
	st[-1] = 'b'
	st[-2] = 'b'
	k -= 1
	if k == 0:
		return ''.join(st)
	firstBLoc = binarySearch(0, n - 2, k)
	st[n - 2 - firstBLoc] = 'b'
	st[-2] = 'a'
	movesDone = (firstBLoc + 2) * (firstBLoc - 1) // 2
	leftover = k - movesDone - 1
	if leftover == 0:
		return ''.join(st)
	else:
		st[n - 1 - leftover] = 'b'
		st[n - 1] = 'a'
		return ''.join(st)
for x in range(int(input())):
	(n, k) = list(map(int, input().split()))
	print(solve(n, k))


def swap(a, b):
	return (b, a)
t = int(input())
while t:
	t -= 1
	nums = list((int(x) for x in input().split()))
	(n, k) = (nums[0], nums[1])
	val = 1
	while k > val * (val + 1) // 2:
		val += 1
	k = k - val * (val - 1) // 2
	arr = ['a' for x in range(n - 2)]
	arr.append('b')
	arr.append('b')
	index1 = n - val - 1
	index2 = n - k
	(arr[index1], arr[n - 2]) = swap(arr[index1], arr[n - 2])
	(arr[index2], arr[n - 1]) = swap(arr[index2], arr[n - 1])
	st = ''
	for p in arr:
		st = st + str(p)
	print(st)


from math import sqrt
m = int(1000000000.0 + 7)

def power(a, b):
	if b == 0:
		return 1
	t = power(a, b // 2)
	p = t * t
	if b % 2 == 0:
		return p
	return a * p
T = int(input())
for l in range(0, T):
	(k, N) = map(int, input().split())
	a = sqrt(1 + 8 * N)
	n = int((-1 + a) / 2)
	if a == float(int(a)):
		n -= 1
		n = int(n)
	res = power(2, n + 1) + power(2, N - int(n * (n + 1) / 2) - 1)
	res = bin(res)[2:]
	ans = ['0'] * (k - len(res))
	ans.extend(res)
	for i in ans:
		if i == '1':
			print('b', end='')
		else:
			print('a', end='')
	print()


from math import *
import sys, random

def nextInt():
	return int(input())

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

def nextInts():
	return list(map(int, nextStrs()))

def main():
	t = nextInt()
	for _ in range(t):
		(n, k) = nextInts()
		a = n
		b = 2
		res = ''
		while True:
			combo = (a - 2) * (a - 1) // 2
			if combo >= k:
				print('a', end='')
			else:
				break
			a -= 1
		print('b', end='')
		a -= 1
		k -= a * (a - 1) // 2
		while True:
			combo = a - 1
			if combo >= k:
				print('a', end='')
			else:
				break
			a -= 1
		print('b', end='')
		for i in range(a - 1):
			print('a', end='')
		print()
exit(main())


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	tmp = ['a' for _ in range(a)]
	i = 1
	while b > i:
		b -= i
		i += 1
	tmp[b - 1] = tmp[i] = 'b'
	print(''.join(tmp[::-1]))


from math import sqrt
t = int(input())
for i in range(0, t):
	(n, k) = [int(i) for i in input().split()]
	a = int((sqrt(8 * k + 1) - 1) / 2)
	if a * (a + 1) == 2 * k:
		print('a' * (n - a - 1) + 'bb' + 'a' * (a - 1))
	else:
		b = k - a * (a + 1) // 2
		print('a' * (n - a - 2) + 'b' + 'a' * (a - b + 1) + 'b' + 'a' * (b - 1))


def solve(n, k):
	left_b = n - 2
	cnt = 1
	while left_b:
		if k > cnt:
			k -= cnt
			cnt += 1
		else:
			break
		left_b -= 1
	s = ['a'] * n
	s[left_b] = 'b'
	s[n - k] = 'b'
	return ''.join(s)
t = int(input())
for _ in range(t):
	(n, k) = input().split()
	print(solve(int(n), int(k)))


def solve(n, k):
	total = n * (n - 1) // 2
	res = ['a'] * n
	i = 1
	count = 1
	while count < k:
		i += 1
		count += i
	x = n - i - 1
	y = x + count - k + 1
	res = ['a'] * n
	res[x] = res[y] = 'b'
	return ''.join(res)
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	print(solve(n, k))
assert solve(5, 1) == 'aaabb'
assert solve(5, 2) == 'aabab'
assert solve(5, 8) == 'baaba'
assert solve(5, 10) == 'bbaaa'
assert solve(3, 1) == 'abb'
assert solve(3, 2) == 'bab'
assert solve(20, 100) == 'aaaaabaaaaabaaaaaaaa'


num_of_test = int(input())
lst = []
for i in range(0, num_of_test):
	lst.append(list(map(int, input().split())))
for i in range(0, num_of_test):
	n = lst[i][0]
	k = lst[i][1]
	lb = n - 2
	rb = n - 1
	while True:
		rem = rb - lb
		if rem < k:
			k -= rem
			lb -= 1
		else:
			rb_result = n - k
			break
	str_result = ''
	for i in range(0, n):
		if i == lb or i == rb_result:
			str_result += 'b'
		else:
			str_result += 'a'
	print(str_result)


def string_to_list(t=str):
	return list(map(t, input().split()))
for _ in range(int(input())):
	line = string_to_list(t=int)
	(length, k) = (line[0], line[1])
	itr = 1
	b1 = 0
	b2 = 1
	while itr != k:
		if itr + b2 <= k:
			itr += b2
			b2 += 1
		else:
			b1 += 1
			if b2 == b1:
				b2 += 1
				b1 = 0
			itr += 1
	base = []
	for _ in range(length):
		base.append('a')
	base[b1] = 'b'
	base[b2] = 'b'
	base.reverse()
	print(''.join(base))


from bisect import bisect_left

def solve():
	(n, k) = map(int, input().split())
	k = n * (n - 1) // 2 + 1 - k
	a = [0]
	for i in range(n - 1, 0, -1):
		a.append(i)
	for i in range(1, n):
		a[i] += a[i - 1]
	cnt = bisect_left(a, k)
	left = k - a[cnt - 1]
	res = ['a'] * n
	res[cnt - 1] = 'b'
	res[cnt + left - 1] = 'b'
	print(''.join(res))
	return

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


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	a = [0] * n
	a[0] = 1
	first = -1
	second = -1
	for i in range(1, n):
		a[i] = a[i - 1] + i
	for i in range(n):
		if k < a[i]:
			first = n - i - 1
			k %= a[i - 1]
			break
	second = n - k - 1
	answer = ['a'] * n
	answer[first] = 'b'
	answer[second] = 'b'
	print(*answer, sep='')


import sys
input = sys.stdin.readline
t = int(input())
SUM = [x * (x - 1) // 2 for x in range(1, 2 * 10 ** 5)]
import bisect
for tests in range(t):
	(n, k) = map(int, input().split())
	x = bisect.bisect_left(SUM, k)
	rest = k - SUM[x - 1]
	ANS = ['a'] * n
	ANS[-(x + 1)] = 'b'
	ANS[-rest] = 'b'
	print(''.join(ANS))


import sys
input = sys.stdin.readline
Q = int(input())
Query = [list(map(int, input().split())) for _ in range(Q)]
for (N, K) in Query:
	a = 0
	for n in range(1, N + 1):
		if a + n >= K:
			i1 = N - 1 - n
			i2 = N - (K - a)
			break
		a += n
	ans = ['a'] * N
	ans[i1] = 'b'
	ans[i2] = 'b'
	print(''.join(ans))


t = int(input())
for _ in range(0, t):
	(n, k) = map(int, input().split())
	A = ['a'] * n
	for i in range(n - 2, -1, -1):
		if k <= n - i - 1:
			A[i] = 'b'
			A[n - k] = 'b'
			break
		k -= n - i - 1
	print(''.join(map(str, A)))


T = int(input())
S = {}
for t in range(T):
	(N, K) = map(int, input().split())
	B = [0]
	somma = 0
	n = 1
	while somma < K:
		somma = n * (n + 1) // 2
		n = n + 1
	blocco = n - 1
	n = n - 2
	somma = n * (n + 1) // 2
	b1 = N - blocco
	b2 = N - (K - somma - 1)
	for x in range(1, b1):
		print('a', end='')
	print('b', end='')
	for x in range(b1 + 1, b2):
		print('a', end='')
	print('b', end='')
	for x in range(b2 + 1, N + 1):
		print('a', end='')
	print()


import sys
RI = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()

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

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

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

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

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

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

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

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

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7
for i in range(int(ri())):
	(n, k) = RI()
	ite = 1
	while ite * (ite + 1) // 2 < k:
		ite += 1
	pos1 = n - 1 - ite
	ite = ite - 1
	rest = k - ite * (ite + 1) // 2
	rest -= 1
	pos2 = n - 1 - rest
	ans = []
	for i in range(n):
		if i != pos1 and i != pos2:
			ans.append('a')
		else:
			ans.append('b')
	print(''.join(ans))


from sys import stdin, stdout
from math import gcd, ceil, sqrt
from collections import Counter
from bisect import bisect_left, bisect_right
ii1 = lambda : int(stdin.readline().strip())
is1 = lambda : stdin.readline().strip()
iia = lambda : list(map(int, stdin.readline().strip().split()))
isa = lambda : stdin.readline().strip().split()
mod = 1000000007
tc = ii1()
for _ in range(tc):
	(n, k) = iia()
	for i in range(1, n):
		if k <= i:
			break
		else:
			k -= i
	print('a' * (n - i - 1) + 'b' + 'a' * (i - k) + 'b' + 'a' * (k - 1))


import sys
inputlist = sys.stdin.readlines()
number_of_testcases = int(inputlist[0].strip())

def formkthformation(n, k):
	for i in range(n - k):
		print('a', end='')
	print('b', end='')
	for i in range(k - 1):
		print('a', end='')
	print('')
for i in range(number_of_testcases):
	(n, k) = list(map(int, inputlist[i + 1].strip().split(' ')))
	for j in range(1, n):
		k = k - j
		if k <= 0:
			k = k + j
			break
	for i in range(n - j - 1):
		print('a', end='')
	print('b', end='')
	formkthformation(j, k)


t = int(input())
for i in range(0, t):
	(n, k) = map(int, input().split())
	number = 0
	q = 0
	d = 0
	for j in range(1, n):
		number += j
		if number >= k:
			q = j
			d = j - number + k - 1
			break
	ans = ''
	for p in range(0, n):
		l = n - 1 - p
		if l == q or l == d:
			ans += 'b'
		else:
			ans += 'a'
	print(ans)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	ans = -1
	j = 1
	i = 0
	while i < k:
		i += j
		j = j + 1
		ans -= 1
	s = ['a' for i in range(n)]
	s[ans] = 'b'
	s[ans + (i - k + 1)] = 'b'
	print(''.join(s))


import string

def pa(last):
	resp = int(last * (1 + last) / 2)
	return resp

def solution(cases):
	n = cases[0]
	k = cases[1]
	s = ''
	a = 'a'
	b = 'b'
	y = 0
	while True:
		y += 1
		soma = pa(y)
		if soma >= k:
			na = y
			snb = y - (soma - k)
			na = n - na - 1
			left = n - (na + 1)
			s = na * a + b + (left - snb) * a + b + (left - (left - snb + 1)) * a
			return s
for i in range(int(input())):
	cases = input().split(' ')
	for j in range(len(cases)):
		cases[j] = int(cases[j])
	print(solution(cases))


T = int(input())
for _ in range(T):
	(n, k) = list(map(int, input().split()))
	c = 0
	s = ['a'] * (n - 2) + ['b'] * 2
	if k == 1:
		print(''.join(s))
	else:
		for i in range(1, n):
			k -= i
			if k <= i + 1:
				c = i + 1
				d = k
				break
		l = ['a' for i in range(n)]
		l[n - c - 1] = 'b'
		l[n - d] = 'b'
		print(''.join(l))


t = int(input())
count = 0
while count < t:
	count += 1
	l = list(map(int, input().split(' ')))
	n = l[0]
	k = l[1]
	i = (-1 + (1 + 8 * k) ** 0.5) / 2
	if i % 1 != 0:
		i = int(i + 1)
	else:
		i = int(i)
	j = k - (i - 1) * i // 2 - 1
	ans = (n - i - 1) * 'a' + 'b' + (i - j - 1) * 'a' + 'b' + j * 'a'
	print(ans)


import sys
import math
t = int(sys.stdin.readline())
for _ in range(t):
	(n, k) = map(int, sys.stdin.readline().split())
	for i in range(1, n + 1):
		if k > i:
			k -= i
		else:
			break
	ans = ['' for _ in range(n)]
	for j in range(k - 1):
		ans[j] = 'a'
	ans[k - 1] = 'b'
	for j in range(k, i):
		ans[j] = 'a'
	ans[i] = 'b'
	for j in range(i + 1, n):
		ans[j] = 'a'
	ans.reverse()
	print(''.join((x for x in ans)))


import math
test = int(input())
for _ in range(test):
	(n, k) = map(int, input().split())
	i = math.floor((math.sqrt(8 * k - 1) + 1) / 2)
	ans = k - 1 - i * (i - 1) / 2
	final = ['a' for i in range(n)]
	final[int(i)] = 'b'
	final[int(ans)] = 'b'
	print(''.join(final[::-1]))


def k_string(n, k):
	string = ['a' for i in range(n)]
	first = 1
	while k > first * (first + 1) / 2:
		first += 1
	second = k - first * (first - 1) // 2
	string[-first - 1] = 'b'
	string[-second] = 'b'
	return string

def test():
	number_of_tests = int(input())
	for i in range(number_of_tests):
		nk = input().split(' ')
		n = int(nk[0])
		k = int(nk[1])
		output = ''.join(k_string(n, k))
		print(output)
	return ()
test()


import bisect
t = int(input())
arr = []
for i in range(2, 100000):
	arr.append(i * (i - 1) // 2)
for i in range(t):
	(n, b) = [int(i) for i in input().split()]
	first = bisect.bisect_left(arr, b)
	sec = first - (arr[first] - b)
	ans = ['a'] * n
	ans[n - 2 - first] = 'b'
	ans[n - 1 - sec] = 'b'
	print(''.join(ans))


t = int(input())
for i in range(t):
	(n, k) = map(int, input().strip().split())
	s = ''
	if k == 1:
		s = 'a' * (n - 2) + 'bb'
		print(s)
		continue
	if k == 2:
		s = 'a' * (n - 3) + 'bab'
		print(s)
		continue
	while True:
		x = (n - 1) * (n - 2) // 2 + 1
		if x == k:
			s += 'b' + 'a' * (n - 2) + 'b'
			break
		elif x > k:
			s += 'a'
			n = n - 1
		elif x < k:
			s += 'b' + 'a' * (n - 2 - k + x) + 'b' + 'a' * (k - x)
			break
	print(s)


t = int(input())
for test_case in range(t):
	(n, k) = input().split()
	n = int(n)
	k = int(k)
	output = ''
	b_1_index = 0
	b_2_index = 0
	for i in range(1, n):
		if (n - i) * (n - i - 1) / 2 < k:
			b_1_index = i - 1
			b_2_index = n - (k - (n - i) * (n - i - 1) / 2)
			break
	for i in range(n):
		if i == b_1_index or i == b_2_index:
			output += 'b'
		else:
			output += 'a'
	print(output)


import sys, math, cmath
input = sys.stdin.readline

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

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

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

def invr():
	return map(int, input().split())
t = 1
t = inp()
for tt in range(t):
	(n, k) = invr()
	if n == 2:
		print('bb')
		continue
	q = math.ceil(((-1 + cmath.sqrt(1 + 8 * k)) / 2).real) + 1
	w = k - ((q - 2) * (q - 1) // 2 + 1) + 1
	print('a' * (n - q) + 'b' + 'a' * (q - w - 1) + 'b' + 'a' * (w - 1))


import sys
input = sys.stdin.readline

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

def b():
	(n, k) = input_list()
	(x1, x2) = (0, 0)
	x = 1
	counter = 2
	while x < k:
		x += counter
		counter += 1
	new_x = x - counter + 1
	x1 = n - counter
	x2 = n - (k - new_x)
	result = ''.join(('a' if i not in (x1, x2) else 'b' for i in range(n)))
	print(result)

def main():
	n = int(input())
	for _ in range(n):
		b()
main()


import math
for i in range(int(input())):
	(n, k) = [int(i) for i in input().split()]
	w = ['a' for i in range(n)]
	a = math.ceil((1 + math.sqrt(1 + 8 * k)) / 2)
	w[-a] = 'b'
	s = (a - 1) * (a - 1 - 1) // 2 + 1
	w[-(k - s + 1)] = 'b'
	print(''.join(w))


for tc in range(int(input())):
	(size, pos) = list(map(int, input().split()))
	tl = 1
	tot = 0
	while tot + tl < pos:
		tot += tl
		tl += 1
	res = ['a' for _ in range(size)]
	res[-tl - 1] = 'b'
	res[-(pos - tot)] = 'b'
	print(''.join(res))


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split(' '))
	ans = ['a'] * n
	count = 1
	val = 1
	while val + count <= k:
		val += count
		count += 1
	if count == 0:
		count = 1
	ans[n - count - 1] = 'b'
	num = k - val
	ans[n - num - 1] = 'b'
	print(''.join(ans))


import sys
import math
input = sys.stdin.readline

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

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

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

def invr():
	return map(int, input().split())
t = inp()
answer_list = []
for i in range(t):
	[n, k] = inlt()
	for i in range(n - 2, -1, -1):
		if k <= n - i - 1:
			s = list('a' * n)
			s[i] = 'b'
			s[n - k] = 'b'
			answer_list.append(''.join(s))
			break
		else:
			k = k - (n - i - 1)
for a in answer_list:
	print(a)


for h in range(int(input())):
	(n, k) = map(int, input().strip().split())
	low = 1
	high = n
	mid = (low + high) // 2
	L1 = mid * (mid + 1) / 2
	R1 = (mid + 2) * (mid + 1) / 2
	flag = False
	while not L1 <= k < R1:
		if k > L1:
			low = mid + 1
		else:
			high = mid - 1
		mid = (high + low) // 2
		L1 = mid * (mid + 1) / 2
		R1 = (mid + 2) * (mid + 1) / 2
	if L1 == k:
		flag = True
	ans = ['a' for i in range(n)]
	if flag:
		ans[-mid] = 'b'
		ans[-mid - 1] = 'b'
	else:
		ans[-mid - 2] = 'b'
		ans[-(k - mid * (mid + 1) // 2)] = 'b'
	print(''.join(ans))


import sys
from math import ceil, floor
from collections import deque, Counter, defaultdict
from fractions import gcd
input = lambda : sys.stdin.readline().rstrip()

def eprint(s):
	sys.stderr.write('DEBUG: {}'.format(s))
	return

def make(i, j, n):
	ans = ['a'] * n
	ans[n - i - 1] = 'b'
	ans[n - j - 1] = 'b'
	return ''.join(ans)

def solve(n, k):
	cnt = 0
	cumsum = list()
	for i in range(n):
		if i == 0:
			cumsum.append(i + 1)
			if i + 1 >= k:
				break
		else:
			cumsum.append(cumsum[i - 1] + i + 1)
			if cumsum[i - 1] + i + 1 >= k:
				break
	if len(cumsum) < 2:
		cnt = 0
	else:
		cnt = cumsum[len(cumsum) - 2]
	j = len(cumsum)
	for i in range(j):
		cnt += 1
		if cnt == k:
			print(make(i, j, n))

def main():
	t = int(input())
	for i in range(t):
		(n, k) = map(int, input().split())
		solve(n, k)
	return
main()


k = list(map(int, input().split()))
n = k[0]
s = ''
for i in range(n):
	k = list(map(int, input().split()))
	n = k[0]
	k = k[1]
	d = 1 + 8 * k
	kd = round(d ** 0.5, 0)
	if kd * kd == d:
		i = int((-1 + kd) // 2)
		s = ''.join(['a' for j in range(n - 1 - i)]) + 'bb' + ''.join(['a' for j in range(i - 1)])
	else:
		i = (-1 + d ** 0.5) / 2
		ii = round(i, 0)
		if ii > i:
			i2 = int(ii)
			i1 = int(ii - 1)
		else:
			i2 = int(ii + 1)
			i1 = int(ii)
		l = int(k - i1 * (i1 + 1) // 2)
		s = ''.join(['a' for j in range(n - 1 - i2)]) + 'b' + ''.join(['a' for j in range(n - (n - i2) - l)]) + 'b' + ''.join(['a' for j in range(l - 1)])
	print(s)


def solve(a, b):
	n = 1
	while True:
		s = n * (n + 1) // 2
		if s >= b:
			b2_index = n
			break
		n += 1
	s = (n - 1) * (n - 1 + 1) // 2
	b1_index = 0
	for _ in range(b - s - 1):
		if abs(b1_index - b2_index) == 1:
			b1_index = 0
			b2_index += 1
		else:
			b1_index += 1
	b1_index = a - b1_index - 1
	b2_index = a - b2_index - 1
	string = ['a'] * a
	string[b1_index] = 'b'
	string[b2_index] = 'b'
	return ''.join(string)
rounds = int(input())
for _ in range(rounds):
	(a_, b_) = map(int, input().split())
	print(solve(a_, b_))


t = int(input())
while t:
	t -= 1
	(n, a) = map(int, input().strip().split(' '))
	z = n - 1
	y = n
	s = ['a' for _ in range(n + 1)]
	total = 0
	for x in range(n - 1, 0, -1):
		total += n - 1 - x + 1
		if total >= a:
			z = x
			break
	s[z] = 'b'
	s[z + (total - a) + 1] = 'b'
	print(*s[1:], sep='')


t = int(input())
for i in range(t):
	(n, c) = list(map(int, input().split()))
	sum = 0
	i = 1
	ans = ['a'] * n
	if c != 1:
		for i in range(1, n + 1):
			sum += i
			if c <= sum:
				break
	else:
		sum = 1
	if c == sum:
		ans[-i - 1] = 'b'
		ans[-i] = 'b'
	else:
		r = int(i * (i - 1) / 2)
		f = n - i - 1
		l = n - (c - r)
		ans[f] = 'b'
		ans[l] = 'b'
	print(''.join(ans))


from sys import stdin, stdout
cin = stdin.readline
cout = stdout.write
mp = lambda : list(map(int, cin().split()))

def chars():
	s = cin()
	return list(s[:len(s) - 1])

def pl(a):
	for val in a:
		cout(val)
	cout('\n')
(t,) = mp()
for _ in range(t):
	(n, k) = mp()
	p = int(((k * 8) ** 0.5 - 1) / 2)
	y = int(((p * 2 + 1) ** 2 - 1) / 8)
	s = ['a'] * n
	pos1 = pos2 = -1
	if y == k:
		pos1 = n - p
		pos2 = pos1 + 1
	else:
		pos1 = n - p - 1
		pos2 = n - k + y + 1
	s[pos1 - 1] = 'b'
	s[pos2 - 1] = 'b'
	pl(s)


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__
import math

def gift():
	for _ in range(t):
		(a, b) = list(map(int, input().split()))
		pos1 = math.ceil((-1 + (1 + 8 * b) ** 0.5) / 2)
		pos2 = b - (pos1 ** 2 - pos1) // 2
		ans = ''
		ans += (a - pos2 - (pos1 - pos2 + 1)) * 'a'
		ans += 'b'
		ans += (pos1 - pos2) * 'a'
		ans += 'b'
		ans += (pos2 - 1) * 'a'
		yield ans
t = int(input())
ans = gift()
print(*ans, sep='\n')


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	s = ['a'] * n
	(a, b, i) = (0, 0, 0)
	while i < m:
		a += 1
		if i + a >= m:
			break
		i += a
	(s[a], s[m - i - 1]) = ('b', 'b')
	print(*s[::-1], sep='')


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	adder = 2
	c = 1
	prev_c = 0
	while 1:
		if k <= c:
			break
		prev_c = c
		c += adder
		adder += 1
	b1_pos = adder
	b2_pos = k - prev_c
	s = (n - b1_pos) * 'a' + 'b' + (b1_pos - b2_pos - 1) * 'a' + 'b' + 'a' * (b2_pos - 1)
	print(s)


import atexit
import io
import sys
_INPUT_LINES = sys.stdin.read().splitlines()
input = iter(_INPUT_LINES).__next__
_OUTPUT_BUFFER = io.StringIO()
sys.stdout = _OUTPUT_BUFFER

@atexit.register
def write():
	sys.__stdout__.write(_OUTPUT_BUFFER.getvalue())

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

def num():
	return int(input())
from itertools import repeat, count
from math import sqrt
t = num()
for _ in repeat(None, t):
	(n, k) = line()
	x = int((-1 + sqrt(8 * (k - 1) + 1)) / 2)
	q = x * (x + 1) // 2
	b = k - 1 - q
	ans = ['a'] * n
	ans[-1 - b] = 'b'
	ans[-2 - x] = 'b'
	print(''.join(ans))


def go():
	(n, k) = map(int, input().split())
	x = 1
	for i in range(n - 2, -1, -1):
		if k > n - 1 - i:
			k -= n - 1 - i
		else:
			ans = ['a'] * n
			ans[i] = 'b'
			ans[n - k] = 'b'
			return ''.join(ans)
t = int(input())
ans = []
for _ in range(t):
	ans.append(str(go()))
print('\n'.join(ans))


t = int(input())
for _ in range(t):
	(n, k) = [int(i) for i in input().split()]
	for p in range(max(n + 1, k + 1)):
		if (p - 1) * p / 2 >= k:
			break
	pos1 = n - p
	pos2 = n - (k - int((p - 1) * (p - 2) / 2))
	for i in range(n):
		if i == pos1 or i == pos2:
			print('b', end='')
		else:
			print('a', end='')
	print()


a = [0] * 10 ** 5
s = 1
for i in range(10 ** 5):
	s += i
	a[i] = s
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	ans = ['a'] * n
	(l, r) = (0, 10 ** 5)
	while r - l != 1:
		m = (l + r) // 2
		if a[m] > k:
			r = m
		else:
			l = m
	ans[-r - 1] = 'b'
	ans[-(k - a[l]) - 1] = 'b'
	print(''.join(ans))


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	arr = [i for i in range(n - 1, -1, -1)]
	for i in range(n - 2, -1, -1):
		arr[i] += arr[i + 1]
	ind = 0
	for i in range(n - 1):
		if k <= arr[i] and k > arr[i + 1]:
			ind = i
	s = ['a'] * n
	s[ind] = 'b'
	ind = n - (k - arr[ind + 1])
	s[ind] = 'b'
	print(''.join(s))


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	base = 0
	while k > 0:
		base += 1
		k -= base
	l = []
	for i in range(n):
		if i != n - base - 1 and i != n - base - 1 + 1 - k:
			l.append('a')
		else:
			l.append('b')
	print(''.join(l))


import math

def solve(n, k):
	l = 0
	num = math.comb(n, 2)
	for i in range(n - 2, -1, -1):
		if k <= n - i - 1:
			ans = ''
			for j in range(n):
				if j == n - k or j == i:
					ans += 'b'
				else:
					ans += 'a'
			return ans
		else:
			k -= n - i - 1
t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	print(solve(n, k))


for _ in range(int(input())):
	(t, k) = map(int, input().split())
	vals = [1]
	for i in range(2, t):
		vals.append(i + vals[i - 2])
	ind = 0
	for i in range(t - 1):
		if vals[i] == k:
			ind = i
			break
		if i > 0 and i < t - 1:
			if vals[i - 1] < k and vals[i] > k:
				ind = i
				break
	print('a' * (t - 2 - ind) + 'b' + 'a' * (vals[ind] - k) + 'b' + 'a' * (t - (t - 2 - ind) - (vals[ind] - k) - 2))


import sys
t = int(sys.stdin.readline())
for i in range(t):
	(n, k) = map(int, sys.stdin.readline().split())
	c = 1
	total = 0
	while total < k:
		total += c
		c += 1
	c -= 1
	b1 = n - c - 1
	b2 = b1 + 1 + (total - k)
	word = 'a' * b1 + 'b' + 'a' * (b2 - b1 - 1) + 'b' + 'a' * (n - 1 - b2)
	print(word)


t = int(input())
for i in range(0, t):
	(n, k) = map(int, input().split())
	temp = 0
	for j in range(1, k + 1):
		if j * (j + 1) / 2 >= k:
			temp = j
			break
	pos1 = n - temp - 1
	temp = temp - 1
	pos2 = n - int(k - temp * (temp + 1) / 2)
	ans = 'a' * n
	ans = ans[:pos1] + 'b' + ans[pos1 + 1:]
	ans = ans[:pos2] + 'b' + ans[pos2 + 1:]
	print(ans)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	z = 0
	summ = 0
	while summ < k:
		z += 1
		summ += z
	s = ['a'] * n
	s[n - z - 1] = 'b'
	prev = k - (summ - z)
	s[n - prev] = 'b'
	print(''.join(s))


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	x = 1
	if k == 1:
		print('a' * (n - 2) + 'b' * 2)
		continue
	while x * (x + 1) // 2 < k:
		x += 1
	x -= 1
	ans = ['a'] * n
	ans[n - 2 - x] = 'b'
	pos = k - x * (x + 1) // 2
	ans[n - pos] = 'b'
	print(''.join(ans))


import sys

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

def main():
	t = int(input())
	for _ in range(t):
		(n, k) = map(int, input().split())
		a = 1
		while a * (a + 1) // 2 < k:
			a += 1
		ans = ['a' for i in range(n)]
		ans[-a - 1] = 'b'
		ans[-(k - (a - 1) * a // 2)] = 'b'
		print(''.join(ans))
main()


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	k = k - 1
	if k == 0:
		print('a' * (n - 2) + 'bb')
	else:
		i = 1
		while i <= k:
			k = k - i
			i = i + 1
		i = -1 * i - 1
		j = -1 * k - 1
		lis = ['a'] * n
		lis[i] = 'b'
		lis[j] = 'b'
		print(''.join(lis))


from math import ceil

def f(n):
	return ceil((1 + (8 * n + 1) ** 0.5) * 0.5)

def findNumber(n):
	n -= 1
	i = 1
	while n >= 0:
		n -= i
		i += 1
	return n + i
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	s = ['a'] * n
	s[f(k) - 1] = 'b'
	s[findNumber(k) - 1] = 'b'
	print(''.join(s[::-1]))


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	x = -1 + 8 * k
	root = pow(x, 0.5)
	t = (1 + root) // 2
	l = t * (t - 1) / 2
	b1 = n - 1 - t
	b2 = n - k + l
	for i in range(n):
		if i == b1 or i == b2:
			print('b', end='')
		else:
			print('a', end='')
	print()


import math
t = int(input())
for i in range(t):
	a = []
	(n, k) = map(int, input().split())
	a = ['a' for i in range(n)]
	for i in range(n):
		if k <= i * (i + 1) / 2:
			break
	i = math.ceil(i)
	b1 = n - i - 1
	a[b1] = 'b'
	b2 = i * (i + 1) / 2 - k + b1 + 1
	a[int(b2)] = 'b'
	for j in range(n):
		print(a[j], end='')
	print()


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	i = n - 2
	while k > n - i - 1:
		k -= n - i - 1
		i -= 1
	indexOfFirst = n - (n - i - 1) - 1
	indexOfSec = n - k
	out = 'a' * n
	out = out[:indexOfFirst] + 'b' + out[indexOfFirst + 1:indexOfSec] + 'b' + out[indexOfSec + 1:]
	print(out)


from heapq import *
from collections import deque
import sys
sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep='\n')

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

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

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

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

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

def main():
	q = II()
	for _ in range(q):
		(n, k) = MI()
		ans = ['a'] * n
		w = 1
		while w * (w + 1) // 2 < k:
			w += 1
		ans[-w - 1] = 'b'
		k -= w * (w - 1) // 2
		ans[-k] = 'b'
		print(*ans, sep='')
main()


t = int(input())
while t:
	(n, k) = map(int, input().split())
	ls = ['a' for i in range(n)]
	for i in range(1, n + 1):
		if k <= i * (i + 1) // 2:
			ls[n - i - 1] = 'b'
			break
	ls[n - (k - i * (i - 1) // 2)] = 'b'
	print(''.join((str(x) for x in ls)))
	t -= 1


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	arr = ['a'] * n
	arr[-1] = 'b'
	arr[-2] = 'b'
	count = 1
	lol = 1
	for j in range(n - 3, -1, -1):
		if count + lol > k:
			break
		arr[j] = 'b'
		arr[j + 1] = 'a'
		count += lol
		lol += 1
	k -= count
	ind = n - 1
	for i in range(k):
		(arr[ind], arr[ind - 1]) = (arr[ind - 1], arr[ind])
		ind -= 1
	print(*arr, sep='')


kl = int(input())
for l in range(kl):
	(n, m) = map(int, input().split())
	t = 1
	while m > t * (t - 1) // 2:
		t += 1
	t -= 1
	t2 = m - t * (t - 1) // 2
	s = ''
	s = 'a' * (n - t - 1) + 'b' + 'a' * (t - t2) + 'b' + 'a' * (t2 - 1)
	print(s)


from sys import stdin, stdout
t = int(stdin.readline())
for query in range(t):
	nk = stdin.readline().split()
	n = int(nk[0])
	k = int(nk[1])
	cnt = 1
	while k - cnt > 0:
		k = k - cnt
		cnt = cnt + 1
	mylist = []
	for x in range(n):
		mylist.append('a')
	mylist[n - cnt - 1] = 'b'
	mylist[n - k] = 'b'
	mystring = ''
	if query == 0:
		stdout.write('\n')
	for x in mylist:
		stdout.write(x)
	stdout.write('\n')


for _ in range(int(input())):
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	for i in range(1, a):
		if b <= i * (i + 1) / 2:
			post1 = a - i
			post2 = int(a + 1 - (b - i * (i - 1) / 2))
			break
		else:
			continue
	count = 1
	ans = ''
	while count != a + 1:
		if count != post1 and count != post2:
			ans += 'a'
			count += 1
		else:
			ans += 'b'
			count += 1
	print(ans)


t = int(input())
out = list()
for item in range(t):
	nk_list = input().split()
	n = int(nk_list[0])
	k = int(nk_list[1])
	i = 0
	old = 0
	while True:
		i += 1
		new = old + i
		if k > old and k <= new:
			lb = n - i
			rb = new - k + 1
			break
		else:
			old = new
	out.append('a' * (lb - 1) + 'b' + 'a' * (rb - 1) + 'b' + 'a' * (n - lb - rb))
for item in out:
	print(item)


for x in range(int(input())):
	output = ''
	(length, order) = map(int, input().split())
	i = 1
	while i * (i + 1) < 2 * order:
		i += 1
	leftmost = length - 1 - i
	mid = i * (i + 1) // 2 - order
	print('a' * leftmost + 'b' + 'a' * mid + 'b' + 'a' * (i - 1 - mid))


t = int(input())
for it in range(t):
	(n, k) = [int(el) for el in input().split()]
	left_pos = 1
	i = 1
	while left_pos + i <= k:
		left_pos += i
		i += 1
	j = k - left_pos
	for k in range(n):
		if k + 1 == n - i or k + 1 == n - j:
			print('b', end='')
		else:
			print('a', end='')
	print()


from math import sqrt
for i in range(int(input())):
	(n, k) = map(int, input().split())
	d = 1 + 8 * k
	sq = int((-1 + sqrt(d)) / 2)
	k -= sq * (sq + 1) // 2
	if not k:
		id1 = n - 1 - sq
		id2 = n - sq
		s = ['a'] * n
		s[id1] = s[id2] = 'b'
		print(''.join(s))
		continue
	id1 = n - 2 - sq
	id2 = n - k
	s = ['a'] * n
	s[id1] = s[id2] = 'b'
	print(''.join(s))


from sys import stdin

def binary_search(data, val):
	highIndex = len(data) - 1
	lowIndex = 0
	while highIndex > lowIndex:
		index = (highIndex + lowIndex) // 2
		sub = data[index]
		if data[lowIndex] == val:
			return [lowIndex, lowIndex]
		elif sub == val:
			return [index, index]
		elif data[highIndex] == val:
			return [highIndex, highIndex]
		elif sub > val:
			if highIndex == index:
				return sorted([highIndex, lowIndex])
			highIndex = index
		else:
			if lowIndex == index:
				return sorted([highIndex, lowIndex])
			lowIndex = index
	return sorted([highIndex, lowIndex])
l = [1] * (10 ** 5 + 1)
for i in range(2, 10 ** 5 + 1):
	l[i] = i + l[i - 1]
for _ in range(int(stdin.readline().rstrip())):
	(n, k) = map(int, stdin.readline().rstrip().split(' '))
	r = ['a'] * n
	if k == 1:
		r[-1] = 'b'
		r[-2] = 'b'
	elif k == 2:
		r[-3] = 'b'
		r[-1] = 'b'
	else:
		se = binary_search(l, k)
		if se[0] == se[1]:
			start = se[0] + 1
			end = se[0]
		else:
			end = k - l[se[0]]
			start = se[0] + 2
		r[end * -1] = 'b'
		r[start * -1] = 'b'
	print(''.join(r))


import os
import sys
from io import BytesIO, IOBase

def main():
	for _ in range(int(input())):
		(n, k) = map(int, input().split())
		s = ''
		for _ in range(n):
			s += 'a'
		j = 0
		while j <= n:
			if j * (j - 1) // 2 >= k:
				break
			j += 1
		k -= (j - 1) * (j - 2) // 2
		s = s[:-j] + 'b' + s[-j + 1:]
		if k == 1:
			s = s[:-k] + 'b'
		else:
			s = s[:-k] + 'b' + s[-k + 1:]
		print(s)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

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

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

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

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

class IOWrapper(IOBase):

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


import math
t = int(input())
for i in range(t):
	(n, k) = list(map(int, input().split(' ')))
	k -= 1
	m = int((1 + math.sqrt(1 + 8 * k)) / 2)
	tri = int(m * (m - 1) / 2)
	s = k - tri
	s = 'a' * (n - m - 1) + 'b' + 'a' * (m - s - 1) + 'b' + 'a' * s
	print(s)


from math import floor, sqrt
t = int(input())
ans = []

def find_first(k):
	for i in range(k + 2):
		if i * (i - 1) / 2 >= k:
			return i

def find_second(k, first):
	return int(k - (first - 1) * (first - 2) / 2)
for _ in range(t):
	(n, k) = map(int, input().split())
	a = ['a' for i in range(n)]
	first = find_first(k)
	second = find_second(k, first)
	a[first - 1] = a[second - 1] = 'b'
	ans.append(''.join(reversed(a)))
print(*ans, sep='\n')


def main():
	t = int(input())
	for _ in range(t):
		(n, k) = map(int, input().split())
		k2 = k
		b0 = b1 = -1
		for i in range(2, n + 1):
			k2 -= i - 1
			if k2 <= 0:
				b0 = i
				break
		s_b0_2 = int(0.5 * (b0 - 1) * (b0 - 2))
		b1 = k - s_b0_2
		s = ''
		s += 'a' * (n - b0)
		s += 'b'
		s += 'a' * (b0 - 1 - b1)
		s += 'b'
		s += 'a' * (b1 - 1)
		print(s)
main()


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	string_ans = ''
	for j in range(n):
		string_ans = string_ans + 'a'
	string_ans_list = list(string_ans)
	tri = 0
	counter = 0
	while k - 1 > tri:
		counter += 1
		tri += counter
	if k == 1:
		string_ans_list[len(string_ans) - 1] = 'b'
		string_ans_list[len(string_ans) - 2 - counter] = 'b'
	elif (k - 1) % tri == 0:
		string_ans_list[len(string_ans) - 1] = 'b'
		string_ans_list[len(string_ans) - 2 - counter] = 'b'
	else:
		tri -= counter
		counter -= 1
		if tri == 1:
			position_2 = k - 2
		else:
			position_2 = (k - 1) % tri
		string_ans_list[len(string_ans) - 2 - counter] = 'b'
		string_ans_list[len(string_ans) - 1 - position_2] = 'b'
	ans = ''.join(string_ans_list)
	print(ans)


tests = int(input())
for asd in range(tests):
	(n, k) = map(int, input().split())
	r = int(n * (n - 1) / 2)
	c = n - 1
	while r - c >= k:
		r -= c
		c -= 1
	d = list('a' * n)
	d[c + (k - r - 1)] = 'b'
	d[c] = 'b'
	d.reverse()
	print(''.join(d))


from sys import stdin
summ = 0
list_sum = []
for i in range(100000):
	summ += i + 1
	list_sum.append(summ)
t = int(stdin.readline())
while t > 0:
	(n, k) = stdin.readline().split()
	n = int(n)
	k = int(k)
	st = ['-1'] * n
	for i in range(len(list_sum)):
		if k <= list_sum[i]:
			num = list_sum[i]
			index = i
			break
	if num != 1:
		diff = k - list_sum[index - 1]
		diff = n - diff
	else:
		diff = n - 1
	st[diff] = 'b'
	first = n - (index + 2)
	st[first] = 'b'
	s1 = ''
	for i in range(n):
		if st[i] != 'b':
			st[i] = 'a'
	s1 = ''.join(st)
	print(s1)
	t = t - 1


import sys
inp = sys.stdin.read().split()
inp.remove(inp[0])
inp = [int(i) for i in inp]
pairs = []
for i in range(int(len(inp) / 2)):
	pairs.extend([inp[i * 2:i * 2 + 2]])
for (m, n) in pairs:
	lst = ['a' for i in range(m)]
	s = list(range(1, m + 1))
	n1 = n
	l = 0
	while n1 > 0:
		n1 -= s[l]
		l += 1
	lst[abs(l)] = 'b'
	new = lst[:l + 1]
	new[n1 - 2] = 'b'
	print(''.join(lst[l + 1:]) + ''.join(new[::-1]))


cnt = [0]
for i in range(1, 10 ** 5 + 5):
	cnt.append(cnt[-1] + i)
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	ind = 0
	p = -1
	for i in range(1, 100004):
		if cnt[i - 1] < k <= cnt[i]:
			ind = i - 1
			p = cnt[i - 1]
			break
	ans = ['a'] * n
	ans[n - 2 - ind] = 'b'
	ans[n - (k - p)] = 'b'
	print(''.join(ans))


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	x = ((1 + 8 * k) ** (1 / 2) - 1) / 2
	if int(x) == x:
		x = int(x)
		print('a' * (n - x - 1) + 'bb' + 'a' * (x - 1))
	else:
		x = int(x)
		nm = k - x * (x + 1) // 2
		print('a' * (n - x - 2) + 'b' + 'a' * (x - nm + 1) + 'b' + 'a' * (nm - 1))


from collections import Counter
from collections import defaultdict
import math

def binarySearch(arr, l, r, x):
	ans = 1
	while l <= r:
		mid = l + (r - l) // 2
		if mid * (mid + 1) >= 2 * x:
			ans = mid
			r = mid - 1
		elif mid * mid + 1 < 2 * x:
			l = mid + 1
		else:
			r = mid - 1
	return ans
t = int(input())
for _ in range(0, t):
	(n, k) = list(map(int, input().split()))
	ans = binarySearch([], 1, k + 1, k)
	ans1 = ans * (ans + 1) // 2
	ans2 = ans1 - k + 1
	back1 = n - 1 - ans
	back2 = n - 1 - (ans - ans2)
	for i in range(0, n):
		if i == back1 or i == back2:
			print('b', end='')
		else:
			print('a', end='')
	print()


t = int(input())
while t:
	(n, k) = map(int, input().split())
	if k == 1:
		s = 'a' * (n - 2) + 'b' * 2
		print(s)
	else:
		sumq = 1
		j = 2
		i = 1
		while k > sumq:
			sumq += j
			j += 1
			i += 1
		sumq -= j - 1
		j = 0
		while k != sumq:
			sumq += 1
			j += 1
		s = 'a' * n
		s1 = s[:n - i - 1] + 'b' + s[n - i:n - j] + 'b' + s[n - j + 1:]
		print(s1)
	t -= 1


import sys
input = sys.stdin.readline
from sys import stdin, stdout
from math import sqrt, floor

def main():
	for _ in range(int(input())):
		(n, k) = [int(s) for s in input().split()]
		w = 1
		i = 1
		while k > w:
			i += 1
			w += i
		s = ['a'] * n
		s[i] = 'b'
		r = k - (w - i) - 1
		s[r] = 'b'
		print(''.join(s)[::-1])
main()


from math import *
T = int(input())
for _ in range(T):
	(n, k) = map(int, input().split())
	a = ['a'] * n
	count = 0
	for i in range(1, 1000000000):
		count += i
		if count == k:
			a[i] = 'b'
			a[i - 1] = 'b'
			break
		elif count > k:
			a[i] = 'b'
			a[k - count + i - 1] = 'b'
			break
	a = a[::-1]
	print(''.join(a))


from math import sqrt
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	x1 = -0.5 + sqrt(0.25 + 2 * b)
	if x1 // 1 == x1:
		x1 = x1 // 1
	else:
		x1 = x1 // 1
		x1 += 1
	x2 = x1 - 1
	x2 = x2 * (x2 + 1) // 2
	x2 = b - x2
	s = ['a'] * a
	s[a - 1 - int(x1)] = 'b'
	s[a - int(x2)] = 'b'
	print(*s, sep='')


import math
T = int(input())
while T:
	(n, k) = map(int, input().split())
	x = int((1 + math.sqrt(1 + 8 * (k - 1))) / 2)
	d = int(math.floor((-1 + math.sqrt(1 + 8 * k - 8)) / 2))
	b = d * (d + 1) / 2 + 1
	y = int(k - b)
	R = 'a' * (n - x - 1) + 'b' + 'a' * (x - y - 1) + 'b' + y * 'a'
	print(R)
	T = T - 1


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	init = ['a'] * n
	i = 1
	string = list(init)
	j = n - 2
	while j >= 0:
		if k <= n - j - 1:
			init[j] = 'b'
			init[n - k] = 'b'
			print(''.join(init))
			break
		k -= n - j - 1
		j -= 1


def solve(n, k):
	str1 = ['a' for i in range(n)]
	for i in range(n - 2, -1, -1):
		if k <= n - i - 1:
			str1[i] = 'b'
			str1[n - k] = 'b'
			print(''.join(str1))
			break
		k -= n - i - 1
tc = int(input())
for _ in range(tc):
	(n, k) = map(int, input().split())
	solve(n, k)


f = lambda x: 2 * (2 * x + 1 / 4) ** 0.5 - 1
g = lambda x: int(f(x - 1) / 2)
h = lambda x: x * (x + 1) / 2
t = lambda x: (x - 1) % h(g(x))
ceil = lambda x: x if int(x) == x else int(x + 1)
m1 = lambda x: int([0, 0, 1, 0, 1, 2][ceil(x) - 1] if 1 <= x <= 3 else t(x))
m2 = lambda x: int((2 * x) ** 0.5 + 0.5)

def final(x, length):
	s = list('a' * length)
	s[-m1(x) - 1] = 'b'
	s[-m2(x) - 1] = 'b'
	return ''.join(s)
print('\n'.join([final(*list(map(int, input().split(' ')[::-1]))) for i in range(int(input()))]))


from sys import stdin, stdout
for _ in range(int(stdin.readline())):
	(n, k) = map(int, stdin.readline().split())
	temp = 0
	old_k = 1
	check = -1
	lis = ['a'] * n
	for i in range(n - 2, -1, -1):
		temp += n - i - 1
		if temp >= k:
			check = i
			break
		else:
			old_k = temp
	lis[i] = 'b'
	lis[i + 1 + (temp - k)] = 'b'
	stdout.write(''.join(lis) + '\n')


t = int(input())
for _ in range(t):
	(n, k) = [int(x) for x in input().strip().split()]
	if k == 1:
		res = 'a' * (n - 2) + 'bb'
	else:
		s = 2
		i = 3
		prev = 2
		diff = 2
		while s < k:
			prev = s
			s = s + diff
			diff += 1
			i += 1
		if s > k:
			s = prev
			i -= 1
		rem = k - s
		res = ['a' for i in range(n)]
		res[n - i] = 'b'
		res[n - rem - 1] = 'b'
	print(''.join((r for r in res)))


t = int(input())
while t:
	t -= 1
	(n, k) = map(int, input().split())
	f = 1
	i = 1
	b1 = 1
	temp = 0
	while f <= k:
		temp = f
		f += i
		i += 1
		b1 += 1
	b2 = k % temp
	st = ['a'] * n
	st[-b1] = 'b'
	st[-b2 - 1] = 'b'
	print(''.join(st))


import math
t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	left = math.ceil((math.sqrt(8 * k + 1) - 1) / 2) + 1
	right = k - (left - 2) * (left - 1) // 2
	s = (n - left) * 'a' + 'b' + (left - right - 1) * 'a' + 'b' + (right - 1) * 'a'
	print(s)


from math import ceil, sqrt
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	i = int(ceil((-1 + sqrt(8 * k + 1)) / 2))
	k -= i * (i - 1) // 2 + 1
	print('a' * (n - i - 1) + 'b' + 'a' * (i - k - 1) + 'b' + 'a' * k)


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	s = ['a' for i in range(n)]
	sume = 0
	incr = 1
	firstpos = n
	done = False
	while sume <= k:
		if sume + incr > k:
			break
		sume += incr
		incr += 1
		if sume <= k:
			firstpos -= 1
		if sume == k:
			s[firstpos - 1] = 'b'
			s[firstpos] = 'b'
			print(''.join(s))
			done = True
			break
	if not done:
		firstpos -= 1
		secondpos = n
		for i in range(k - sume - 1):
			secondpos -= 1
		s[firstpos - 1] = 'b'
		s[secondpos - 1] = 'b'
		print(''.join(s))


import sys
from math import sqrt
inp = sys.stdin.readline
read = lambda : list(map(int, inp().split()))

def a():
	ans = ''
	for _ in range(int(inp())):
		(a, b) = read()
		if a % b == 0:
			ans += '0\n'
		else:
			ans += str((a // b + 1) * b - a) + '\n'
	print(ans)

def b():
	ans = ''
	for _ in range(int(inp())):
		(n, k) = read()
		(f1, f2) = (n - 2, n - 1)
		l = 1
		while (l + 1) * l // 2 < k:
			l += 1
		f1 -= l - 1
		f2 -= k - l * (l - 1) // 2 - 1
		res = ''
		for i in range(n):
			if i in (f1, f2):
				res += 'b'
			else:
				res += 'a'
		ans += res + '\n'
	print(ans)
b()


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	k -= 1
	s = ['a'] * n
	(x, y) = (1, 0)
	while k:
		t = min(x - y, k)
		y += t
		k -= t
		if x == y:
			x += 1
			y = 0
	s[x] = 'b'
	s[y] = 'b'
	s = ''.join(s)
	print(s[::-1])


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	i = 2
	while i * (i - 1) // 2 < k:
		i += 1
	i -= 1
	p = k - i * (i - 1) // 2
	s = 0
	s1 = ''
	while s < p - 1:
		s1 += 'a'
		s += 1
	s1 += 'b'
	s += 1
	while s < i:
		s1 += 'a'
		s += 1
	s1 += 'b'
	s += 1
	while s < n:
		s1 += 'a'
		s += 1
	s1 = s1[::-1]
	print(s1)


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	l = 1
	r = n
	ans = 0
	while l <= r:
		mid = (l + r) // 2
		if mid * (mid - 1) // 2 > k:
			r = mid - 1
		elif mid * (mid - 1) // 2 < k:
			ans = mid + 1
			l = mid + 1
		else:
			ans = mid
			break
	res = 'a' * (n - ans) + 'b' + 'a' * (ans * (ans - 1) // 2 - k) + 'b'
	res += 'a' * (n - len(res))
	print(res)


from math import floor, sqrt
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	pos = (1 + floor(sqrt(1 + 8 * (k - 1)))) // 2 + 1
	palavra = ['a'] * pos
	palavra[0] = 'b'
	pos1 = pos * (pos - 1) // 2 - k + 1
	palavra[pos1] = 'b'
	print(''.join(palavra).rjust(n, 'a'))


import math

def kbs(n, k):
	seg = math.ceil((-1 + (1 + 8 * k) ** 0.5) / 2)
	pre_seg = seg - 1
	pre_k = int(pre_seg * (pre_seg + 1) / 2)
	pos1 = seg
	pos2 = k - (pre_k + 1)
	arr = ['a'] * n
	arr[n - 1 - pos2] = 'b'
	arr[n - 1 - pos1] = 'b'
	return ''.join(arr)
ts = int(input())
for t in range(ts):
	(n, k) = list(map(int, input().split()))
	print(kbs(n, k))


import math
t = int(input())
for test in range(t):
	(n, k) = [int(i) for i in input().split()]
	firstpos = int(math.ceil(((1 + 8 * k) ** 0.5 - 1) / 2))
	secondpos = k - int(firstpos * (firstpos - 1) / 2)
	ans = ['a'] * n
	ans[n - 1 - firstpos] = 'b'
	ans[n - secondpos] = 'b'
	print(''.join(ans))


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	c = 0
	z = 1
	while z < k:
		c += 1
		z += c
	if k != z:
		z = z - c
		c = c - 1
	q = k - z
	ans = 'a' * q
	ans += 'b'
	ans += 'a' * (c - q)
	ans += 'b'
	ans += 'a' * (n - 2 - c)
	print(ans[::-1])


t = int(input())
for i in range(t):
	(n, k) = [int(x) for x in input().split()]
	cur_sum = 0
	ans = ['a' for i in range(n)]
	for i in range(len(ans)):
		if cur_sum < k:
			cur_sum += i + 1
		else:
			ans[n - 1 - i] = 'b'
			ans[n - i + (cur_sum - k)] = 'b'
			print(*ans, sep='')
			break


import math
for i in range(int(input())):
	(n, k) = map(int, input().split())
	X = math.ceil((math.sqrt(8 * k + 1) - 1) / 2)
	Ideal = X * (X + 1) // 2
	first = int(X + 1)
	second = first - int(Ideal - k + 1)
	S = []
	for i in range(n):
		S.append('a')
	S[-first] = 'b'
	S[-second] = 'b'
	print(''.join(S))


def find_step(n, p):
	r = 0
	for i in range(1, n):
		r += i
		if r >= p:
			return (i, (i - 1) * i // 2 + 1)
n = int(input())
for _ in range(n):
	(a, b) = map(int, input().split())
	(step, head) = find_step(a, b)
	s = ['a'] * a
	s[a - step - 1] = 'b'
	s[a - b + head - 1] = 'b'
	print(''.join((i for i in s)))


def main():
	T = int(input())
	for _ in range(T):
		(n, k) = map(int, input().split())
		for i in range(1, n + 1):
			if i * (i + 1) // 2 >= k:
				tmp = i
				break
		num = k - tmp * (tmp - 1) // 2 - 1
		ans = ['a'] * n
		ans[num] = 'b'
		ans[tmp] = 'b'
		print(''.join(reversed(ans)))
main()


import sys
input = sys.stdin.readline
t = int(input())
while t:
	t -= 1
	(n, k) = map(int, input().split())
	i = n - 2
	sb = 0
	c = 0
	while i >= 0:
		sb += n - 1 - i
		if sb == k:
			jj = i + 1
			break
		elif sb > k:
			gap = sb - k
			jj = i + gap + 1
			break
		else:
			i -= 1
	print('a' * i + 'b' + 'a' * (jj - i - 1) + 'b' + 'a' * (n - 1 - jj))


count = int(input())
for i in range(count):
	massiv = input().split(' ')
	n = int(massiv[0])
	k = int(massiv[1])
	number = 1
	step = 2
	while number < k:
		number += step
		step += 1
	b1 = step - 1 - (number - k)
	b2 = step
	result = ''
	for j in range(n, 0, -1):
		if j == b1 or j == b2:
			result += 'b'
		else:
			result += 'a'
	print(result)


from time import time
from bisect import bisect_left
import sys
breakpoints = [1]
cur = 1
for i in range(2, 1000000):
	cur += i
	breakpoints.append(cur)
t = input()
for line in sys.stdin:
	(n, k) = map(int, line.strip().split())
	out = ['a'] * n
	if k == 1:
		out[-2:] = ['b', 'b']
		print(''.join(out))
	else:
		ind = bisect_left(breakpoints, k)
		first_b = n - 2 - ind
		second_b = n - (k - breakpoints[ind - 1])
		out[first_b] = 'b'
		out[second_b] = 'b'
		print(''.join(out))


from math import floor
t = int(input())
for i2 in range(t):
	(n, k) = map(int, input().split())
	p = floor((k * 2) ** (1 / 2))
	if p * (p + 1) // 2 < k:
		p += 1
	ans = [n - 1 - p, n - p + p * (p + 1) // 2 - k]
	for i in range(n):
		if i == ans[0] or i == ans[1]:
			print('b', end='')
		else:
			print('a', end='')
	print('')


t = int(input())

def solve():
	(n, k) = map(int, input().split())
	index = 1
	count = 1
	accum = 1
	while accum < k:
		count += 1
		accum += count
		index += 1
	accum -= count
	count -= 1
	string = ['a' for i in range(n)]
	string[-index - 1] = 'b'
	string[-(k - accum)] = 'b'
	for i in string:
		print(i, end='')
	print()
while t > 0:
	solve()
	t -= 1


n = int(input())
for _ in range(n):
	(n, k) = map(int, input().split())
	(primary_offset, cumul) = (1, 0)
	ans = ['a'] * n
	while cumul < k:
		cumul += primary_offset
		primary_offset += 1
	ans[n - primary_offset] = 'b'
	secondary_offset = cumul - k + 1
	ans[n - primary_offset + secondary_offset] = 'b'
	print(''.join(ans))


from itertools import permutations
t = int(input())
for _ in range(t):
	(n, k) = input().split()
	n = int(n)
	k = int(k)
	count = 0
	i = 0
	while count < k:
		i = i + 1
		count = count + i
	count = count - i
	loc1 = -i - 1
	loc2 = -(k - count)
	string = ['a'] * n
	string[loc1] = 'b'
	string[loc2] = 'b'
	string = ''.join(map(str, string))
	print(string)


import math
for i in range(int(input())):
	(a, b) = map(int, input().split())
	tmp = int(math.sqrt(b * 2))
	s = ''
	if tmp * (tmp + 1) >= b * 2:
		s += 'a' * (a - tmp - 1) + 'b'
	else:
		s += 'a' * (a - tmp - 2) + 'b'
	cnt = b - (a - len(s) - 1) * (a - len(s)) // 2
	s += 'a' * (a - len(s) - cnt) + 'b'
	s += (a - len(s)) * 'a'
	print(s)


for _ in range(int(input())):
	(n, k) = list(map(int, input().split()))
	l = ['a'] * n
	(a, b, d) = (n - 2, n - 1, 0)
	for i in range(n):
		d = (i + 1) * (i + 2) // 2
		x = k - d
		if x == 0:
			a -= i
			b -= i
			break
		elif x < 0:
			z = k - i * (i + 1) // 2
			a -= i
			b -= z - 1
			break
	(l[a], l[b]) = ('b', 'b')
	print(''.join(l))


n = int(input())
for i in range(n):
	(stl, k) = list(map(int, input().split()))
	seg = 0
	count = 1
	prev_count = 0
	i = 1
	while count < k:
		seg = i
		i = i + 1
		prev_count = count
		count += i
	p = seg + 1
	posi = k - prev_count
	st = ''
	newst = str(bin(2 ** p + 2 ** (posi - 1)))[2:]
	for j in range(len(newst)):
		if newst[j] == '0':
			st += 'a'
		else:
			st += 'b'
	diff = stl - len(newst)
	st = 'a' * diff + st
	print(st)


for qq in range(int(input())):
	(a, b) = map(int, input().split())
	ans = ['a'] * a
	for i in range(1, a):
		if b - i <= 0:
			ans[i] = ans[b - 1] = 'b'
			break
		b -= i
	print(''.join(ans)[::-1])


for _testcases_ in range(int(input())):
	(n, k) = map(int, input().split())
	i1 = n - 1
	i2 = n - 1
	n2 = k
	for i in range(1, n):
		if n2 - i <= 0:
			break
		n2 -= i
		i1 -= 1
	if n2 > 0:
		i1 -= 1
		i2 = n - n2
	for i in range(n):
		if i == i1 or i == i2:
			print('b', end='')
		else:
			print('a', end='')
	print()


for _ in range(int(input())):
	s = input().split(' ')
	n = int(s[0])
	k = int(s[1])
	su = 0
	ans = 0
	for i in range(0, n - 1):
		su = su + (i + 1)
		if k <= su:
			ans = i
			break
	s = ''
	c = 0
	for i in range(0, n - 2 - ans):
		s = s + 'a'
		c = c + 1
	s = s + 'b'
	for i in range(0, su - k):
		s = s + 'a'
		c = c + 1
	s = s + 'b'
	for i in range(0, n - 2 - c):
		s = s + 'a'
	print(s)


t = int(input())
for j in range(t):
	(n, k) = [int(i) for i in input().split()]
	p = 0
	PSum = 0
	NSum = 0
	ans = ''
	for i in range(1, n):
		NSum = NSum + i
		if NSum >= k:
			break
		PSum = PSum + i
	pos1 = n - 1 - i
	for x in range(n - 1, -1, -1):
		PSum = PSum + 1
		if k == PSum:
			pos2 = x
	for i in range(n):
		if i == pos1 or i == pos2:
			ans = ans + 'b'
		else:
			ans = ans + 'a'
	print(ans)


def calc(n, k):
	k -= 1
	(a, b) = (0, 1)
	for i in range(1, n + 2):
		if k - i >= 0:
			k -= i
			b += 1
		else:
			break
	a += k
	return ''.join(['b' if i == a or i == b else 'a' for i in range(n)[::-1]])
T = int(input())
for _ in range(T):
	(n, k) = list(map(int, input().split()))
	print(calc(n, k))


import math
t = int(input())
while t != 0:
	(n, k) = map(int, input().split())
	b1pos = math.ceil(math.sqrt(0.25 + 2 * k) - 0.5)
	preceedingACount = n - 1 - b1pos
	middleACount = b1pos * (b1pos + 1) / 2 - k
	trailingACount = n - 2 - preceedingACount - middleACount
	print(preceedingACount * 'a', end='')
	print('b', end='')
	print(int(middleACount) * 'a', end='')
	print('b', end='')
	print(int(trailingACount) * 'a')
	t -= 1


def f1():
	import math as m
	T = int(input())
	while T != 0:
		T = T - 1
		Array = [int(i) for i in input().split(' ')]
		A = Array[0]
		B = Array[1]
		Mult = m.ceil(A / B)
		print(B * Mult - A)

def f2():
	import math as m
	T = int(input())
	while T != 0:
		T = T - 1
		Array = [int(i) for i in input().split(' ')]
		N = Array[0]
		K = Array[1]
		if K == 1:
			li = ['a' for i in range(0, N - 2)]
			str1 = ''.join(li)
			str1 = str1 + 'bb'
			print(str1)
		else:
			li = ['a' for i in range(0, N)]
			POS = m.ceil((-1 + m.sqrt(1 + 4 * 2 * K)) / 2)
			till = (POS - 1) * POS / 2
			K = K - till
			POS2 = int(K - 1)
			li[N - 1 - int(POS)] = 'b'
			li[N - 1 - POS2] = 'b'
			print(''.join(li))
f2()


t = int(input())
for i in range(t):
	(n, k) = list(map(int, input().split()))
	b1 = n - 1
	b2 = n
	no = 1
	if k == 1:
		s = 'a' * (n - 2) + 'bb'
		print(s)
		continue
	while no < k:
		if b2 - b1 == 1:
			b1 -= 1
			b2 = n
			no += 1
		elif b2 - b1 < k - no:
			no += b2 - b1
			b1 -= 1
			b2 = n
		else:
			b2 -= 1
			no += 1
	s = 'a' * n
	s = [i for i in s]
	s[b1 - 1] = 'b'
	s[b2 - 1] = 'b'
	print(''.join(s))


import sys

class BKThBeautifulString:

	def solve(self):
		for _ in range(int(input())):
			(n, k) = [int(_) for _ in input().split()]
			x = 0
			for x in range(n - 1, -1, -1):
				if (n - x) * (n - x - 1) // 2 >= k:
					break
			a_after = (n - x) * (n - x - 1) // 2 - k
			rest = n - 2 - a_after - x
			ans = 'a' * x + 'b' + 'a' * a_after + 'b' + 'a' * rest
			print(ans)
solver = BKThBeautifulString()
input = sys.stdin.readline
solver.solve()


t = int(input())
for q in range(t):
	(n, k) = map(int, input().split())
	cur = 1
	while k > cur:
		k -= cur
		cur += 1
	ind2 = k - 1
	lis = ['a'] * n
	lis[n - 1 - cur] = 'b'
	lis[n - 1 - ind2] = 'b'
	for i in lis:
		print(i, end='')
	print('')


def nCr(n, r):
	m = 1
	for i in range(n, n - r, -1):
		m *= i
	return int(m // 2)
for i in range(int(input())):
	(n, k) = map(int, input().split())
	ans = ['a' for j in range(n)]
	for j in range(n):
		cur = nCr(n - j, 2)
		val = cur - (n - j) + 1
		if k <= val:
			continue
		else:
			ans[j] = 'b'
			if k > 1:
				ans[-(k - val)] = 'b'
			else:
				ans[-1] = 'b'
			break
	print(''.join(ans))


for _ in range(int(input())):
	l = list(map(int, input().rstrip().split()))
	a = l[0]
	b = l[1]
	i = int((-1 + (1 + 8 * (b - 1)) ** 0.5) / 2) + 1
	temp = (i * i + i) // 2
	j = b + i - temp
	i += 1
	l = ['a' for i in range(a)]
	l[-i] = 'b'
	l[-j] = 'b'
	print(''.join(l))


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = 0
	i = 1
	for i in range(1, n + 1):
		s += i
		if s >= k:
			break
	p1 = n - 1 - i
	s -= i
	p2 = n - 1 - (k - s) + 1
	ans = ['a' for i in range(n)]
	ans[p1] = 'b'
	ans[p2] = 'b'
	print(''.join(ans))


import sys, math
input = sys.stdin.readline

def next(arr, target):
	start = 0
	end = len(arr) - 1
	ans = -1
	while start <= end:
		mid = (start + end) // 2
		if arr[mid] < target:
			start = mid + 1
		else:
			ans = mid
			end = mid - 1
	return ans
t = int(input())
for r in range(t):
	(n, k) = map(int, input().split())
	arr = [1]
	for i in range(2, n):
		arr.append(arr[i - 2] + i)
	ansindex = next(arr, k)
	ans = arr[ansindex]
	s = ['a'] * n
	if ansindex == 0:
		s[-1] = 'b'
		s[-2] = 'b'
		print(''.join(map(str, s)))
	elif ansindex == n - 1:
		s[0] = 'b'
		s[-1] = 'b'
		print(''.join(map(str, s)))
	else:
		x = len(arr) - ansindex - 1
		y = n - 1 - (k - arr[ansindex - 1] - 1)
		s[x] = 'b'
		s[y] = 'b'
		print(''.join(map(str, s)))


t = int(input())

def solve(n, k):
	choices = 1
	s = 1
	string = ['a'] * n
	while s < k:
		choices += 1
		if s + choices >= k:
			index1 = n - 1 - choices
			index2 = index1 + 1 + (s + choices - k)
			string[index1] = 'b'
			string[index2] = 'b'
			break
		else:
			s += choices
	return ''.join(string)
for i in range(t):
	(n, k) = [int(item) for item in input().strip().split()]
	if k == 1:
		print('a' * (n - 2) + 'bb')
	else:
		print(solve(n, k))


t = int(input())
for i in range(t):
	(N, K) = [int(i) for i in input().split(' ')]
	a = int((1 + 8 * K) ** 0.5 / 2 - 0.5)
	b = K - a * (a + 1) // 2
	if b == 0:
		print('a' * (N - a - 1) + 'bb' + 'a' * (a + 1 - 2))
	else:
		print('a' * (N - a - 2) + 'b' + 'a' * (a - b + 1) + 'b' + 'a' * (b - 1))


T = int(input())
for t in range(1, T + 1):
	(n, k) = map(int, input().split())
	K = 1
	Kadd = 1
	while K + Kadd <= k:
		K += Kadd
		Kadd += 1
	answer = ['a' for x in range(n)]
	answer[n - Kadd - 1] = 'b'
	answer[n - k % K - 1] = 'b'
	print(''.join(answer))


t = int(input())
for i in range(t):
	(n, k) = [int(j) for j in input().split()]
	k = n * (n - 1) // 2 - k + 1
	(a, b) = (0, 0)
	for j in range(1, n):
		if n - j >= k:
			(a, b) = (j, j + k)
			break
		else:
			k -= n - j
	res = 'a' * (a - 1) + 'b' + 'a' * (b - a - 1) + 'b' + 'a' * (n - b)
	print(res)


t = int(input())
for _ in range(t):
	(n, b) = list(map(int, input().split()))
	i = 1
	a = ['a' for __ in range(n)]
	while i < n:
		if b <= i * (i + 1) // 2:
			break
		i = i + 1
	a[n - i - 1] = 'b'
	a[n - (i - i * (i + 1) // 2 + b - 1) - 1] = 'b'
	print(''.join(a))


for _ in range(int(input())):
	(x, y) = map(int, input().split())
	li = ['a'] * x
	for i in range(x - 2, -1, -1):
		if y <= x - i - 1:
			li[i] = 'b'
			li[x - y] = 'b'
			break
		y -= x - i - 1
	print(''.join(li))


def f(l):
	k = 1
	c = 1
	while k < l:
		k += c + 1
		c += 1
	return (c, k - l)
t = int(input())
for test in range(t):
	(n, k) = map(int, input().split())
	(a, b) = f(k)
	print('a' * (n - a - 1) + 'b' + 'a' * b + 'b' + 'a' * (n - (2 + b + n - a - 1)))


from itertools import permutations
lis = [0] * 100001
lis[1] = 1
for i in range(2, 100001):
	lis[i] = lis[i - 1] + (i - 1)
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	c = 0
	for i in range(100001):
		if k < lis[i]:
			c = i - 1
			break
	ans = ['a'] * n
	ans[n - c - 1] = 'b'
	rem = k - lis[c]
	ans[n - rem - 1] = 'b'
	print(''.join(ans))


def kth_string(n, k):
	i = 1
	while k > i * (i - 1) / 2:
		i += 1
	string = 'a' * n
	string = string[:n - i] + 'b' + string[n - i + 1:]
	diff = k - (i - 1) * (i - 2) // 2
	if diff == 0:
		string = string[:n - i + 1] + 'b' + string[n - i + 2:]
	else:
		string = string[:n - diff] + 'b' + string[n - diff + 1:]
	return string
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	print(kth_string(n, k))


import math
t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	s = list(n * 'a')
	r = round(math.sqrt(2 * k)) - 1
	s[r + 1] = 'b'
	t = k - r * (r + 1) // 2
	s[t - 1] = 'b'
	print(''.join(s[::-1]))


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	x = ''
	xk = 0
	b = ['a'] * n
	for i in range(n - 2, -1, -1):
		if xk + (n - i - 1) >= k:
			j = k - xk
			(b[i], b[-j]) = ('b', 'b')
			x = ''.join(b)
			break
		xk += n - i - 1
	print(x)


import math
t = int(input())
for _t in range(t):
	(n, p) = [int(x) for x in input().strip().split()]
	count = 0
	i = 0
	while count < p:
		i += 1
		count += i
	ans = ['a'] * n
	ans[n - i - 1] = 'b'
	ans[n - i + count - p] = 'b'
	print(*ans, sep='')


import sys, math

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

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

def lmii():
	return list(mii())

def main():
	for _ in range(ii()):
		(n, k) = mii()
		flag = 0
		s = ['a'] * n
		for i in range(1, 100000):
			flag += i
			if flag >= k:
				s[n - i - 1] = 'b'
				s[n - (k - flag + i)] = 'b'
				break
		print(''.join(s))
main()


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

def case():
	(n, k) = li()
	s = 0
	i = 1
	ans = ['a'] * n
	while s + i <= k:
		s += i
		i += 1
	if s == k:
		ans[-i + 1] = 'b'
		ans[-i] = 'b'
	else:
		ans[-i - 1] = 'b'
		ans[s - k] = 'b'
	print(''.join(map(str, ans)))
for _ in range(int(input())):
	case()


from math import sqrt, ceil
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	ans = ['a'] * n
	x = ceil((sqrt(8 * k + 1) - 1) / 2)
	ans[n - x - 1] = 'b'
	r = x * (x + 1) // 2 - k
	ans[n - x + r] = 'b'
	print(''.join(ans))


t = int(input())
ans = []
for i in range(t):
	(n, k) = map(int, input().split())
	p = int((2 * k) ** 0.5) + 1
	if p * (p - 1) < 2 * k:
		p += 1
	r = p * (p - 1) // 2
	z = 'a' * (n - p) + 'b' + 'a' * (r - k) + 'b' + 'a' * (p + k - r - 2)
	ans.append(z)
for i in ans:
	print(i)


l = int(input())
for _ in range(l):
	x = list(map(int, input().split()))
	d = ['a'] * x[0]
	k = abs(1 - (1 + 4 * 1 * x[1] * 2) ** 0.5) / 2
	j = int(k)
	m = k - j
	if m == 0:
		(d[-j], d[-j - 1]) = ('b', 'b')
	else:
		n = x[1] - j * (j + 1) / 2
		n = int(n)
		(d[-j - 2], d[-n]) = ('b', 'b')
	print(''.join(d))


c = int(input())
for i in range(c):
	(a, b) = map(int, input().split())
	f = []
	for i in range(a):
		f.append('a')
	g = 0
	k = 1
	while g <= b:
		g += k
		k += 1
		if g == b:
			f[-k] = 'b'
			f[-k + 1] = 'b'
			break
		if g > b:
			k -= 1
			g -= k
			f[-k - 1] = 'b'
			k - 1
			f[-(b - g)] = 'b'
			break
	h = str()
	for i in f:
		h += str(i)
	print(h)


t = int(input())
while t:
	t -= 1
	(n, k) = [int(c) for c in input().split()]
	leftpos = 0
	for i in range(n - 2, -1, -1):
		if k <= n - i - 1:
			leftpos = i
			rightpos = k
			break
		k -= n - i - 1
	ans = ['a'] * n
	ans[leftpos] = 'b'
	ans[-rightpos] = 'b'
	print(''.join(ans))


z = int(input())
for i in range(z):
	(n, k) = map(int, input().split())
	i = 1
	answer = 1
	r = 1
	while answer < k:
		i += 1
		answer += i
	firstPosition = -(i + 1)
	secondPosition = -(k - (answer - i))
	mas = ['a'] * n
	mas[firstPosition] = 'b'
	mas[secondPosition] = 'b'
	print(''.join(mas))


n = int(input())
l = []
for i in range(0, 100001):
	l.append(i * (i + 1) // 2)
for i in range(0, n):
	p = input().rstrip().split(' ')
	if int(p[1]) == 1:
		print('a' * (int(p[0]) - 2), end='')
		print('b' * 2)
	else:
		I = 0
		J = len(l) - 1
		G = int(p[1])
		while I <= J:
			m = (I + J) // 2
			if l[m] == G:
				H = m
				break
			elif l[m] < G:
				I = m + 1
			else:
				H = m
				J = m - 1
		V = H * (H + 1) // 2
		N = V - int(p[1])
		W = ['a'] * int(p[0])
		W.reverse()
		W[H] = 'b'
		W[H - N - 1] = 'b'
		W.reverse()
		print(''.join(W))


from sys import stdin, stdout

def read():
	x = stdin.readline().rstrip()
	return x

def __main__():
	t = int(read())
	for t0 in range(t):
		y = read()
		(n, k) = map(int, y.split())
		delta = 1
		s2 = 1
		summ = s2
		while summ < k:
			delta += 1
			summ += delta
		res1 = 'a' * (n - delta - 1) + 'b'
		d2 = k - (summ - delta)
		r = bin(2 ** (d2 - 1))[2:]
		res2 = r.replace('0', 'a').replace('1', 'b')
		res = res1 + 'a' * (n - len(res1) - len(res2)) + res2 + '\n'
		stdout.write(res)
__main__()


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	su = 0
	i = 1
	while su + i < k:
		su += i
		i += 1
	i += 1
	no = k - su
	st = 'b' + 'a' * (i - 1)
	ans = st[:i - no] + 'b' + st[i - no + 1:]
	rest = n - len(ans)
	ans = 'a' * rest + ans
	print(ans)


t = int(input())
d = {}
diff = 1
i = 1
while i < 2 * 10 ** 9:
	d[i] = diff + 1
	i += diff
	diff += 1
for _ in range(t):
	(n, k) = [int(x) for x in input().split()]
	offset = 0
	while k not in d:
		offset += 1
		k -= 1
	res = ['a' for _ in range(n)]
	res[-d[k]] = 'b'
	res[-(offset + 1)] = 'b'
	print(''.join(res))


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	string = ['a'] * n
	num = 0
	count = 0
	while True:
		if k <= 0:
			break
		k -= num
		num += 1
		count += 1
	string[n - count] = 'b'
	string[n - count - k + 1] = 'b'
	print(''.join(string))


def find(ind, x):
	s = 0
	f = len(ind) - 1
	mid = (s + f) // 2
	while s < f:
		if x <= ind[mid + 1] and x > ind[mid]:
			return mid + 2
		elif x < ind[mid + 1]:
			f = mid
		elif x > ind[mid + 1]:
			s = mid + 1
		mid = (f + s) // 2
	if f == s:
		return mid + 1

def Power(a, n):
	if n == 0:
		return 1
	ans = a
	while n > 1:
		ans = ans * ans
		if n % 2 == 1:
			ans = ans * a
		n = n // 2
	return ans
ind = [0]
pos = 2
for i in range(1, 10 ** 5 + 1):
	ind.append(i * (i + 1) // 2)
T = int(input())
for t in range(T):
	(n, k) = map(int, input().split())
	arr = ['a'] * n
	temp = find(ind, k)
	arr[-temp] = 'b'
	k = k - ind[temp - 2]
	arr[-k] = 'b'
	print(''.join(arr))


t = int(input())
for i in range(t):
	(n, k) = [int(x) for x in input().split()]
	x = 0
	while x * (x + 1) // 2 < k:
		x += 1
	x -= 1
	ans = ['a'] * n
	second = k - x * (x + 1) // 2
	ans[len(ans) - 1 - x - 1] = 'b'
	ans[len(ans) - second] = 'b'
	print(''.join(ans))


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	(l, r) = (1, n + 1)
	while r - l > 1:
		m = (l + r) // 2
		if m * (m - 1) // 2 < k:
			l = m
		else:
			r = m
	p = k - l * (l - 1) // 2 - 1
	ans = ['a'] * n
	ans[n - l - 1] = 'b'
	ans[n - p - 1] = 'b'
	print(''.join(ans))


from bisect import bisect_left
n = int(input())
for x in range(n):
	(a, b) = map(int, input().split())
	t_wyj = ['a' for z in range(a)]
	pos_a = 0
	pos_b = 0
	t_s = [1]
	m = 2
	licz = 0
	while m <= a * (a - 1) / 2:
		t_s.append(t_s[licz] + m)
		licz += 1
		m += 1
		if t_s[-1] >= a * (a - 1) / 2:
			break
	pos_a = bisect_left(t_s, b)
	if pos_a == 0:
		diff = 0
	else:
		diff = b - t_s[pos_a - 1] - 1
	t_wyj[pos_a + 1] = 'b'
	t_wyj[diff] = 'b'
	t_wyj = t_wyj[::-1]
	print(''.join(t_wyj))


n = int(input())
h = []
for i in range(n):
	t = list(map(int, input().rstrip().split()))
	j = t[1]
	b = int(t[0] * (t[0] - 1) / 2)
	for a in range(1, t[0]):
		if j > int(a * (a + 1)) / 2 and j <= int((a + 1) * (a + 2)) / 2:
			d = a + 1
			break
		elif j == int(a * (a + 1)) / 2 and j <= int((a + 1) * (a + 2)) / 2:
			d = a
			break
	c = d * (d + 1) / 2
	c = c - t[1]
	c = c + 1
	d = t[0] - d
	for e in range(1, t[0] + 1):
		if e == d:
			h.append('b')
		elif e == d + c:
			h.append('b')
		else:
			h.append('a')
	h.append('*')
g = 0
while g < len(h):
	if h[g] == '*':
		print()
	else:
		print(h[g], end='')
	g = g + 1


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	low = 1
	high = n - 1
	ans = n
	while low <= high:
		mid = (high + low) // 2
		temp = mid * (mid + 1) // 2
		if temp >= k:
			ans = min(ans, mid)
			high = mid - 1
		else:
			low = mid + 1
	temp = ans * (ans + 1) // 2 - k
	result = ['a'] * n
	result[n - ans - 1] = 'b'
	result[n - ans + temp] = 'b'
	print(''.join(result))


import sys
import os
import time
import collections
from collections import Counter, deque
import itertools
import math
import timeit
import random
import string

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=1):
	divisors = []
	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, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def flin(d, x, default=-1):
	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 ceil(n, k):
	return n // k + (n % k != 0)

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

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

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

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

def prr(a, sep=' '):
	print(sep.join(map(str, a)))

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)
for _ in range(ii()):
	(n, k) = mi()
	r = f = 0
	for i in range(1, n + 1):
		if r + i >= k:
			f = i
			break
		r += i
	res = ['a'] * n
	res[n - (k - r)] = 'b'
	res[n - f - 1] = 'b'
	prr(res, '')


from math import sqrt, floor
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	x = floor((1 + sqrt(1 + 8 * (k - 1))) / 2)
	p = x * (x - 1)
	p /= 2
	p = int(p + 1)
	s = ['a'] * x
	s[x - (k - p) - 1] = 'b'
	d = 'a' * (n - x - 1)
	print(d, end='')
	print('b', end='')
	print(''.join(s))


def get_presum(i):
	return i * (i - 1) // 2

def find(l, r, query):
	m = (l + r) // 2
	prev_sum = get_presum(m - 1)
	curr_sum = get_presum(m)
	next_sum = get_presum(m + 1)
	if query > prev_sum and query <= curr_sum:
		return m - 1
	elif query > curr_sum and query <= next_sum:
		return m + 1 - 1
	elif query <= prev_sum:
		return find(l, m - 1, query)
	elif query > next_sum:
		return find(m + 1, r, query)
T = int(input())
for _ in range(T):
	(n, k) = list(map(int, input().split()))
	p = find(1, n * (n - 1) // 2 - 1, k)
	ans = ['a'] * n
	i1 = -(p + 1)
	i2 = -(k - get_presum(p - 1 + 1))
	ans[i1] = 'b'
	ans[i2] = 'b'
	print(''.join(ans))


def get_kth(n, k):
	first_idx = n - 2
	snd_b_options = 1
	while k > snd_b_options:
		k -= snd_b_options
		first_idx -= 1
		snd_b_options += 1
	second_idx = n - k
	as_array = ['a'] * n
	as_array[first_idx] = 'b'
	as_array[second_idx] = 'b'
	return ''.join(as_array)
number_of_tests = int(input())
for _ in range(number_of_tests):
	(n, k) = [int(x) for x in input().split()]
	result = get_kth(n, k)
	print(result)


def T(n):
	return n * (n + 1) / 2

def Tm(x):
	n = 1
	while T(n) < x:
		n += 1
	return n - 1

def run(k):
	b1 = Tm(k)
	b2 = int(k - T(b1))
	return [b1 + 2, b2]

def func(n, k):
	s = ['a'] * n
	(b1, b2) = run(k)
	s[n - b1] = 'b'
	s[n - b2] = 'b'
	return ''.join(s)
i = int(input())
for j in range(i):
	(n, k) = [int(x) for x in input().split()]
	print(func(n, k))


from copy import copy
n = int(input())
for i in range(n):
	(a, b) = (int(j) for j in input().split())
	t = copy(b)
	j = 1
	while t > j:
		t -= j
		j += 1
	second = j
	first = t - 1
	print(f"{'a' * first}b{'a' * (second - first - 1)}b{'a' * (a - second - 1)}"[::-1])


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	k -= 1
	for i in range(n - 2, -1, -1):
		if k < n - i - 1:
			pos1 = i
			pos2 = n - 1 - k
			break
		k -= n - i - 1
	for i in range(n):
		if i == pos1 or i == pos2:
			print('b', end='')
		else:
			print('a', end='')
	print(' ')


t = int(input())
import math
for _ in range(t):
	(n, k) = map(int, input().split())
	res = ['a' for x in range(n)]
	i = math.ceil((math.ceil(math.sqrt(1 + 8 * k)) - 1) / 2)
	j = k - (i ** 2 - i + 2) // 2
	(res[i], res[j]) = ('b', 'b')
	print(''.join(res)[::-1])


def findkpos(k):
	l = 0
	h = 10 ** 5
	while l < h:
		m = (l + h) // 2
		if d[m] == k:
			return (m, True)
		elif d[m] < k:
			l = m + 1
		else:
			h = m
	return (l, False)
d = [1 + (i + 1) * (i + 2) // 2 for i in range(10 ** 5)]
cases = int(input())
for t in range(cases):
	(n, k) = list(map(int, input().split()))
	s = ['a'] * n
	if k == 1:
		s[-1] = 'b'
		s[-2] = 'b'
	else:
		(pos, bl) = findkpos(k)
		if bl:
			s[-1] = 'b'
			dist = -3 - pos
			s[dist] = 'b'
		else:
			pos -= 1
			dist = -3 - pos
			s[dist] = 'b'
			pos2 = k % d[pos]
			dist = -1 - pos2
			s[dist] = 'b'
	print(''.join(s))


import sys

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

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

def input():
	return sys.stdin.readline().strip()
for _ in range(int(input())):
	(n, k) = get_ints()
	m = n
	j = n - 1
	n = n * (n - 1) // 2
	while n >= k:
		n -= j
		j -= 1
	j += 1
	diff = k - n
	first = m - 1 - j
	sec = m - diff
	s = ''
	for i in range(m):
		if i == first or i == sec:
			s += 'b'
		else:
			s += 'a'
	print(s)


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

def get_str():
	return input().decode().strip()

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

def oint():
	return int(input())
t = oint()
for _ in range(t):
	(n, k) = rint()
	for i in range(10 ** 10):
		if i * (i + 1) // 2 >= k:
			j = k - i * (i - 1) // 2
			ii = i
			jj = j - 1
			ans = 2 ** i + 2 ** jj
			ans = list(str(bin(ans)))
			pp = []
			for i in range(1, len(ans)):
				if ans[i] == '0':
					pp.append('a')
				elif ans[i] == '1':
					pp.append('b')
			pp = 'a' * (n - len(pp)) + ''.join(pp)
			print(pp)
			break


import math
lenN = int(input())
for j in range(lenN):
	(n, k) = map(int, input().split())
	posb1 = int(math.sqrt(2 * k)) + 1
	posb2 = (2 * k - posb1 * (posb1 - 1)) / 2
	if posb2 < 1 or posb1 * (posb1 - 1) / 2 + posb2 != k:
		posb1 -= 1
		posb2 = (2 * k - posb1 * (posb1 - 1)) / 2
	posb1 = n - posb1 - 1
	posb2 = n - posb2
	for i in range(n):
		if i == posb1 or i == posb2:
			print('b', end='')
		else:
			print('a', end='')
	if j != lenN - 1:
		print()


import sys
input = sys.stdin.readline
for f in range(int(input())):
	(n, k) = map(int, input().split(' '))
	placedPos = 1
	string = []
	while placedPos <= n:
		u = (n - placedPos) * (n - placedPos - 1) / 2
		if k > u:
			string.append('b')
			pos = k - u
			for j in range(n - placedPos):
				if j != n - placedPos - pos:
					string.append('a')
				else:
					string.append('b')
			print(''.join(string))
			placedPos = n + 1
		else:
			string.append('a')
			placedPos = placedPos + 1


for t in range(int(input())):
	NK = input().split()
	n = int(NK[0])
	k = int(NK[1])
	arr = 'a' * (n - 2) + 'b' * 2
	arr = [i for i in arr]
	if k == 1:
		print(''.join(arr))
	else:
		num = 1
		iterator = 1
		first_b = n - 2
		while num < k:
			if num + iterator > k:
				break
			num += iterator
			iterator += 1
			first_b -= 1
		rem = n - 1 - first_b
		RN = k - num
		second_b = n - 1 - RN
		arr = ['a' for i in range(n)]
		arr[first_b] = 'b'
		arr[second_b] = 'b'
		print(''.join(arr))


num_tests = input()
num_tests = int(num_tests)

def beautiful_string(var1, var2):
	cnt = 1
	while True:
		pointer = cnt * (cnt + 1) // 2
		if var2 <= pointer:
			first = cnt + 1
			second = first - (pointer - var2 + 1)
			break
		else:
			cnt += 1
	answer = var1 * ['a']
	answer[-first] = 'b'
	answer[-second] = 'b'
	answer = ''.join(answer)
	return answer
for i in range(num_tests):
	(var1, var2) = input().split(' ')
	var1 = int(var1)
	var2 = int(var2)
	answer = beautiful_string(var1, var2)
	print(answer)


def nval(x):
	return (1 + (1 + 4 * 2 * x) ** 0.5) / 2
temp = ['a'] * 100090
for _ in range(int(input())):
	(n, k) = list(map(int, input().split()))
	x = nval(k)
	if x == int(x):
		a = x - 1
		b = a
	else:
		a = int(x)
		b = int((x - int(x)) * int(x))
	(p, q) = (int(n - a) - 1, int(n - b))
	ans = temp[:n].copy()
	ans[p] = 'b'
	ans[q] = 'b'
	ans = ''.join(ans)
	print(ans)


import math

def f(n):
	h = (math.sqrt(1 + 8 * n) + 1) / 2
	g = int(math.floor(h))
	if h == g:
		return g
	else:
		return g + 1

def g(n, k):
	d = f(k)
	if d == 2:
		return 'a' * (n - 2) + 'b' * 2
	else:
		d1 = k - (d - 2) * (d - 1) // 2
		return 'a' * (n - d) + 'b' + 'a' * (d - d1 - 1) + 'b' + 'a' * (d1 - 1)
t = int(input())
for i in range(t):
	nk = list(map(int, input().rstrip().split()))
	n = nk[0]
	k = nk[1]
	print(g(n, k))


from sys import stdin, stdout
q = int(input())
for j in range(q):
	(n, k) = list(map(int, stdin.readline().split()))
	sum1 = 0
	for i in range(n):
		sum1 = sum1 + i
		if sum1 >= k:
			sum1 = sum1 - i
			break
	s = ['a'] * n
	s[i] = 'b'
	s[k - sum1 - 1] = 'b'
	for i in s[::-1]:
		print(i, end='')
	print()


t = int(input())
for i in range(t):
	(l, t) = map(int, input().split())
	s = [0] * l
	i = 1
	tsum = 1
	while tsum < t:
		i += 1
		tsum = i * (i + 1) / 2
	upper = i
	s[l - upper - 1] = 1
	lower = t - int((i - 1) * i / 2) - 1
	s[l - lower - 1] = 1
	u = ''
	for i in s:
		if i == 1:
			u += 'b'
		else:
			u += 'a'
	print(u)


test = int(input())
for index in range(0, test):
	(n, k) = [int(num) for num in input().split()]
	list1 = []
	(x, y) = (n - 2, 2)
	for index1 in range(1, n + 1):
		tt = n - index1
		if y == 1:
			rr = tt
		elif y == 2:
			rr = tt * (tt - 1) // 2
		if y == 0:
			list1.append('a')
		elif x == 0:
			list1.append('b')
		elif rr < k:
			list1.append('b')
			y = y - 1
			k = k - rr
		else:
			list1.append('a')
			x = x - 1
	result = ''
	for index1 in list1:
		result = result + index1
	print(result)


t = int(input())
for i in range(t):
	(n, k) = [int(x) for x in input().split()]
	if k == 1:
		print('a' * (n - 2) + 'bb')
	else:
		j = 2
		while j * (j - 1) < 2 * k:
			j += 1
		print('a' * (n - j) + 'b' + 'a' * (j - 1 - (k - (j - 1) * (j - 2) // 2)) + 'b' + 'a' * (k - (j - 1) * (j - 2) // 2 - 1))


from bisect import bisect_left as bl
from bisect import bisect_right as br
from heapq import heappush, heappop
import math
from collections import *
from functools import reduce, cmp_to_key
import sys
input = sys.stdin.readline
M = mod = 998244353

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

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

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

def st():
	return input().rstrip('\n')

def val():
	return int(input().rstrip('\n'))

def li2():
	return [i for i in input().rstrip('\n')]

def li3():
	return [int(i) for i in input().rstrip('\n')]
for _ in range(val()):
	(n, k) = li()
	curr = (n - 1) * n // 2
	secondb = 0
	minus = n - 1
	while k <= curr - minus and minus:
		curr -= minus
		minus -= 1
		secondb += 1
	firstb = secondb + (curr - k) + 1
	s = ['a'] * n
	s[firstb] = 'b'
	s[secondb] = 'b'
	print(*s, sep='')


from sys import stdin, stdout
rl = lambda : stdin.readline()
rll = lambda : stdin.readline().split()

def main():
	t = int(rl())
	for _ in range(t):
		(n, k) = (int(x) for x in rll())
		ans = ['a' for __ in range(n)]
		(prev, curr_max, add, i) = (0, 1, 2, 1)
		while curr_max < k:
			prev = curr_max
			curr_max += add
			add += 1
			i += 1
		ans[n - 1 - i] = 'b'
		diff = k - (prev + 1)
		ans[n - 1 - diff] = 'b'
		ans_str = ''.join((x for x in ans))
		stdout.write(ans_str)
		stdout.write('\n')
	stdout.close()
main()


import math
entrada = int(input())
val1 = 0
val2 = 0
saida = ''
arr = []
result = ''

def resultString(n, k, val1, val2, arr):
	val1 = int((-1 + math.sqrt(1 + 4 * (2 * (k - 1)))) / 2)
	val2 = val1 * (val1 + 1) / 2
	arr[math.ceil(n - 1 - val1 - 1)] = 'b'
	arr[math.ceil(n - (k - val2))] = 'b'
	return arr

def returnResult(arr, saida):
	for i in range(len(arr)):
		saida += arr[i]
	return saida
for i in range(entrada):
	(n, k) = map(int, input().split(' '))
	arr = ['a'] * n
	result = resultString(n, k, val1, val2, arr)
	saida = returnResult(result, saida)
	print(saida)
	saida = ''


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if k == 1:
		print(''.join(['a'] * (n - 2) + ['bb']))
	else:
		x = 1
		i = 2
		while x <= n * (n + 1) / 2 and i <= n:
			if k >= x and k <= x + i:
				l = ['a'] * (n - i - 1) + ['b'] + ['a'] * (x + i - k) + ['b'] + ['a'] * (k - x - 1)
				break
			x += i
			i += 1
		print(''.join(l))


n = int(input())
for i in range(n):
	(x, y) = map(int, input().split())
	j = 0
	k = y
	while k > 0:
		j += 1
		if k - j <= 0:
			break
		else:
			k -= j
	for _ in range(x - j - 1):
		print('a', end='')
	print('b', end='')
	for _ in range(j - k):
		print('a', end='')
	print('b', end='')
	for _ in range(k - 1):
		print('a', end='')
	print()


import sys
input = sys.stdin.readline

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

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

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

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

def find_string(n, k):
	(first_b, rank_covered) = find_first_b(n, k)
	second_b = find_second_b(rank_covered, k, first_b + 1)
	res = ['a' for _ in range(n)]
	res[first_b] = 'b'
	res[second_b] = 'b'
	return ''.join(res)

def find_first_b(n, k):
	rank_covered = 1
	cur_index = 1
	while rank_covered < k:
		cur_index += 1
		rank_covered += cur_index
	return (n - cur_index - 1, rank_covered)

def find_second_b(rank_covered, k, first_b):
	diff = rank_covered - k
	return first_b + diff
num_rows = inp()
for _ in range(num_rows):
	arr = inlt()
	n = arr[0]
	k = arr[1]
	print(find_string(n, k))


for _ in range(int(input())):
	liStr = input().split()
	n = int(liStr[0])
	k = int(liStr[1])
	s = []
	for i in range(0, n):
		s.append('a')
	val = 1
	toAdd = 1
	for i in range(n - 2, -1, -1):
		if k <= val:
			s[i] = 'b'
			break
		toAdd += 1
		val += toAdd
	val -= toAdd
	rem = k - val
	s[n - rem] = 'b'
	for i in s:
		print(i, end='')
	print()


import sys
input = sys.stdin.readline

def main():
	t = int(input())
	for _ in range(t):
		(N, K) = [int(x) for x in input().split()]

		def isOK(mid):
			x = 1 + (mid - 1) * (1 + mid - 1) // 2
			if x <= K:
				return True
			else:
				return False
		ok = 0
		ng = 10 ** 10
		while abs(ok - ng) > 1:
			mid = (ok + ng) // 2
			if isOK(mid):
				ok = mid
			else:
				ng = mid
		x = 1 + ok * (ok - 1) // 2
		ok2 = K - x
		print('a' * (N - ok - 1) + 'b' + 'a' * (ok - ok2 - 1) + 'b' + 'a' * ok2)
main()


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split(' '))
	ar = ['a'] * n
	c = 0
	var = 0
	store = 0
	for i in range(1, n + 1):
		store = c
		c += i
		if k > store and k <= c:
			var = i
			break
	ar[-(var + 1)] = 'b'
	if var == 1:
		ar[-1] = 'b'
	else:
		ar[-(k - store)] = 'b'
	print(''.join(ar))


def sumP(n):
	return (1 + n) * n // 2
t = int(input())
for tt in range(t):
	(n, k) = [int(i) for i in input().split()]
	l = 0
	r = 1000000
	while l + 1 < r:
		m = (l + r) // 2
		sm = sumP(m)
		if k <= sm:
			r = m
		else:
			l = m
	st = ['a'] * n
	st[r] = 'b'
	am = k - (sumP(r - 1) + 1)
	st[am] = 'b'
	st.reverse()
	for x in st:
		print(x, end='')
	print()


def answer(n, k):
	count = 1
	lpos = 2
	rpos = 1
	while count < k:
		count += 1
		if rpos == lpos - 1:
			lpos += 1
			rpos = 1
		else:
			rpos += 1
	s = ['a'] * n
	s[n - lpos] = 'b'
	s[n - rpos] = 'b'
	return s

def clist(n):
	lst = []
	sum = 0
	for i in range(n):
		sum += i
		lst.append(sum)
	return lst

def answer2(n, k):
	count = 1
	lpos = 2
	rpos = 1
	while count < k:
		if k - count > lpos - rpos - 1:
			count += lpos - rpos
			lpos += 1
		else:
			rpos += k - count
			count += k - count
	s = ['a'] * n
	s[n - lpos] = 'b'
	s[n - rpos] = 'b'
	return s

def main():
	t = int(input())
	n = [0] * t
	k = [0] * t
	for j in range(t):
		(n[j], k[j]) = [int(i) for i in input().split()]
	for j in range(t):
		print(''.join(answer2(n[j], k[j])))
main()


dic = {}
temp = 1
for i in range(1, 10 ** 5):
	dic[temp] = i
	temp = temp + i
t = int(input())
while t != 0:
	(n, k) = map(int, input().split())
	for key in dic:
		if key > k:
			first_pos = dic[key] - 1
			break
	second_pos = first_pos - key + k
	ans = ['a'] * n
	ans[n - 1 - first_pos] = 'b'
	ans[n - 1 - second_pos] = 'b'
	for i in range(n):
		print(ans[i], end='')
	print()
	t = t - 1


t = int(input())
i1 = 0
i2 = 0
for i in range(t):
	(n, k) = map(int, input().split())
	j = 0
	s = 0
	while s < k:
		j += 1
		s += j
	i1 = k - (s - j + 1)
	i2 = j
	for j in range(n - 1, -1, -1):
		if j == i1 or j == i2:
			print('b', end='')
		else:
			print('a', end='')
	print('')


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	s = 'a' * n
	l = list(s)
	d = 0
	x = 0
	if k == 1:
		print('a' * (n - 2) + 'b' * 2)
	else:
		while k > x:
			x = x + d
			d += 1
		l[n - d] = 'b'
		if k == x:
			l[n - d + 1] = 'b'
		else:
			l[n - d + x - k + 1] = 'b'
		print(''.join(l))


import sys
input = sys.stdin.readline
t = int(input())
while t > 0:
	(n, k) = map(int, input().split())
	s = list('a' * n)
	l = n - 2
	r = n - 1
	curr = 1
	while curr <= n:
		if k > curr:
			k -= curr
			l -= 1
		else:
			r -= k - 1
			break
		curr += 1
	s[l] = 'b'
	s[r] = 'b'
	print(''.join(s))
	t -= 1


import math
for w in range(int(input())):
	a = list(map(int, input().split()))
	soma = int(a[0] * (a[0] - 1) / 2)
	cont = 1
	total = 1
	for i in range(a[0]):
		if total < a[1]:
			total += i + 2
			cont += 1
		else:
			break
	st = list('a' * a[0])
	st[-(cont + 1)] = 'b'
	st[-(cont - (total - a[1]))] = 'b'
	print(''.join(st))


import math
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	q = math.ceil((-1 + (1 + 8 * k) ** 0.5) / 2)
	l_pos = n - q - 1
	qq = q * (q - 1) / 2
	r_pos = n - (k - qq)
	for i in range(n):
		if i in [l_pos, r_pos]:
			print('b', end='')
		else:
			print('a', end='')
	print()


import sys
readLine = lambda : sys.stdin.readline()
readInt = lambda : int(sys.stdin.readline())
readInts = lambda : [int(x) for x in sys.stdin.readline().split(' ')]

def main():
	t = readInt()
	for _ in range(t):
		(n, k) = readInts()
		i = k - 1
		count = 0
		firstPlace = 2
		while i > count:
			firstPlace += 1
			count += 1
			i -= count
		secondPlace = i + 1
		arr = ['a' for x in range(n)]
		arr[-firstPlace] = 'b'
		arr[-secondPlace] = 'b'
		print(''.join(arr))
main()


from collections import defaultdict, deque
from itertools import permutations
from sys import stdin, stdout
from bisect import bisect_left, bisect_right
from copy import deepcopy
import heapq
int_input = lambda : int(stdin.readline())
string_input = lambda : stdin.readline().split()
multi_int_input = lambda : map(int, stdin.readline().split())
multi_input = lambda : stdin.readline().split()
list_input = lambda : list(map(int, stdin.readline().split()))
string_list_input = lambda : list(string_input())
MOD = pow(10, 9) + 7
arr = []
test = int_input()
sum = 0
n = 1
for i in range(100001):
	sum += n
	n += 1
	arr.append(sum)
for _ in range(test):
	(n, k) = multi_int_input()
	freq = 0
	sum = 0
	for i in arr:
		if i >= k:
			sum = i
			break
		freq += 1
	frtbpos = n - 2 - freq
	if k == sum:
		secondbpos = frtbpos + 1
	else:
		secondbpos = frtbpos + sum - k + 1
	strng = ''
	for i in range(n):
		if i == frtbpos or i == secondbpos:
			strng += 'b'
		else:
			strng += 'a'
	print(strng)


cases = int(input())
while cases > 0:
	(n, k) = map(int, input().split())
	p = 1
	while p * (p + 1) / 2 < k:
		p += 1
	p1 = k - p * (p - 1) / 2
	p1 -= 1
	for i in range(n - 1, -1, -1):
		if i == p or i == p1:
			print('b', end='')
		else:
			print('a', end='')
	print('')
	cases -= 1


int_input_list = lambda : list(map(int, input().split()))
int_input = lambda : int(input())
for _ in range(int_input()):
	(n, k) = int_input_list()
	x = k
	c = 0
	for i in range(1, n):
		x -= i
		if x <= 0:
			c = i + 1
			break
	d = k - (c - 2) * (c - 1) // 2
	ans = 'a' * (n - c) + 'b' + 'a' * (c - d - 1) + 'b' + 'a' * (d - 1)
	print(ans)


start = int(input())
for _ in range(start):
	(x, y) = map(int, input().split())
	i = 1
	while y > i:
		y = y - i
		i = i + 1
	ans = []
	for xx in range(x):
		ans.append('a')
	ans[-y] = 'b'
	ans[-(i + 1)] = 'b'
	str = ''
	for e in ans:
		str = str + e
	print(str)


import math as m
for t in range(int(input())):
	(n, k) = map(int, input().split())
	a = m.floor((m.sqrt(1 + 8 * k) - 1) / 2)
	y = k - a * (a + 1) // 2
	if y == 0:
		for i in range(n - a - 1):
			print('a', end='')
		print('bb', end='')
		for i in range(a - 1):
			print('a', end='')
		print(' ')
	else:
		for i in range(n - a - 2):
			print('a', end='')
		print('b', end='')
		o = a + 1
		for i in range(o - y):
			print('a', end='')
		print('b', end='')
		for i in range(y - 1):
			print('a', end='')
		print(' ')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if n == 2:
		print('bb')
		continue
	pos = 1
	cnt = 1
	if k == 1:
		pos2 = 0
	else:
		for i in range(2, n):
			cnt += i
			pos += 1
			if cnt >= k:
				break
		pos2 = pos - (cnt - k) - 1
	l = []
	for i in range(n):
		if i == n - pos - 1 or i == n - pos2 - 1:
			l.append('b')
		else:
			l.append('a')
	print(''.join(l))


import sys
import heapq

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

def iinput():
	return int(input())

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

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

def main():
	(n, k) = rinput()
	res = ['a'] * n
	n += 1
	for i in range(1, n):
		if k < i:
			res[i] = 'b'
			res[k - 1] = 'b'
			break
		elif k == i:
			res[i] = 'b'
			res[i - 1] = 'b'
			break
		k -= i
	print(''.join(reversed(res)))
for i in range(iinput()):
	main()


t = int(input())
for q in range(t):
	(n, k) = map(int, input().split())
	pi = 0
	x = 0
	while pi < k:
		x += 1
		pi += x
	list = []
	for i in range(0, n):
		list.append('a')
	for j in range(0, n):
		if j == x:
			list[n - j - 1] = 'b'
	for j in range(0, n):
		if j == x - (pi - k):
			list[n - j] = 'b'
	str = ''
	for x in list:
		str += x
	print(str)


import math
t = int(input())
for _ in range(t):
	(n, m) = map(int, input().split())
	l = 0
	r = 2 * n
	while r - l > 1:
		me = (r + l) // 2
		if me * (me + 1) // 2 >= m:
			r = me
		else:
			l = me
	p = r * (r + 1) // 2 - m
	a = ['a'] * n
	a[n - r - 1] = 'b'
	a[n - r + p] = 'b'
	print(''.join(a))


def findString(n, k):
	rank = 1
	b1 = 2
	b2 = 1
	while rank != k:
		difference = 0
		difference = b1 - b2
		if rank + difference > k:
			if b1 == b2 + 1:
				b1 += 1
				b2 = 1
			else:
				b2 += 1
			rank += 1
		else:
			b1 += 1
			b2 = 1
			rank += difference
	newList = ['a'] * n
	newList[n - b1] = 'b'
	newList[n - b2] = 'b'
	return ''.join(newList)
t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	print(findString(n, k))


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	ch = 2
	while ch * (ch - 1) // 2 < k:
		ch += 1
	if ch * (ch - 1) // 2 == k:
		print('a' * (n - ch) + 'bb' + 'a' * (ch - 2))
	else:
		k -= (ch - 1) * (ch - 2) // 2
		print('a' * (n - ch) + 'b' + 'a' * (ch - 1 - k) + 'b' + 'a' * (k - 1))


def solve(n, k):
	low = 1
	high = n - 1
	mid = (low + high) // 2
	while True:
		mid = (low + high) // 2
		if (mid - 1) * mid / 2 < k and k <= mid * (mid + 1) / 2:
			break
		if mid * (mid + 1) / 2 < k:
			low = mid + 1
		else:
			high = mid - 1
	first = mid
	second = k - mid * (mid - 1) / 2 - 1
	first = n - 1 - first
	second = n - 1 - second
	ans = ['a'] * n
	ans[int(first)] = 'b'
	ans[int(second)] = 'b'
	print(''.join(ans))
t = int(input())
for i in range(0, t):
	nums = list(map(lambda n: int(n), input().split()))
	solve(nums[0], nums[1])


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	l = ['a'] * n
	r = 0
	i = 1
	while r + i < k:
		r += i
		i += 1
	l[-i - 1] = 'b'
	l[r - k] = 'b'
	print(''.join(l))


t = int(input())
for i in range(t):
	(n, k) = list(map(int, input().split()))
	p1 = 0.5 + 0.5 * pow(1 + 8 * k, 1 / 2)
	if p1 % 1 != 0:
		p1 = int(p1)
	else:
		p1 = int(p1 - 1)
	p2 = int(k - p1 * (p1 - 1) / 2 - 1)
	s = 'a' * (n - p1 - 1) + 'b' + 'a' * (p1 - p2 - 1) + 'b' + 'a' * p2
	print(s)


for _ in range(int(input())):
	(x, y) = map(int, input().split())
	counter = 0
	n = x - 1
	while y > 0:
		n -= 1
		v = x - n - 1
		if y - v < 0:
			break
		else:
			y -= v
			v += 1
	firstInd = n
	if y != 0:
		secInd = x - y
	elif y == 0:
		secInd = firstInd + 1
	else:
		secInd = x - y - 1
	out = 'a' * x
	out = out[:firstInd] + 'b' + out[firstInd + 1:secInd] + 'b' + out[secInd + 1:]
	print(out)


t = int(input())
al = []
for i in range(t):
	nl = input().split()
	n = int(nl[0])
	k = int(nl[1])
	m = 1
	while True:
		k -= m
		if k <= 0:
			break
		m += 1
	k -= 1
	b = m + k
	a = ''
	for e in range(n):
		if e == m:
			a = 'b' + a
		elif e == b:
			a = 'b' + a
		else:
			a = 'a' + a
	print(a)


import sys
for t in range(int(sys.stdin.readline().strip())):
	(n, k) = [int(j) for j in sys.stdin.readline().split()]
	a = n - 1
	k_ = n * (n - 1) // 2 - k
	ct = 0
	while k_ - a >= 0:
		k_ -= a
		a -= 1
		ct += 1
	l = ['a'] * n
	l[ct] = 'b'
	l[ct + k_ + 1] = 'b'
	ans = ''.join(l)
	sys.stdout.write(ans)
	sys.stdout.write('\n')


import math

def solve(n, k):
	j = 0
	sum = j
	while sum < k:
		j += 1
		sum += j
	sum = sum - j
	b1 = int(n - j)
	b2 = int(n - (k - sum - 1))
	s = 'a' * (b1 - 1) + 'b' + 'a' * (b2 - b1 - 1) + 'b' + 'a' * (n - b2)
	return print(s)
t = int(input())
for _n in range(0, t):
	(n, k) = map(int, input().split(' '))
	solve(n, k)


t = int(input())
for i in range(t):
	l = [int(x) for x in input().split()]
	(a, k, i, j, sol) = (l[0], l[1], 1, 0, '')
	if k == 1:
		print('a' * (a - 2) + 'bb')
	else:
		while j < k:
			j += i
			i += 1
		for u in range(a):
			if u == a - i or u == a - i + j - k + 1:
				sol += 'b'
			else:
				sol += 'a'
		print(sol)


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	arr = [0] * 10 ** 4
	for i in range(1, n + 1):
		k -= i
		if k < 0:
			break
		if k == 0:
			break
	if i == n and k == 0:
		a = 0
		b = 1
	elif k == 0:
		a = n - 1 - i
		b = a + 1
	elif k < 0:
		k += i
		a = n - 1 - i
		b = n - k
	s = ['a'] * n
	s[a] = 'b'
	s[b] = 'b'
	print(''.join(s))


t = int(input())
r = []
for i in range(t):
	(n, x) = [int(x) for x in input().split()]
	i = 1
	k = 2 * x
	while i * (i + 1) <= k:
		i += 1
	i -= 1
	m = (i + 1) * i // 2
	if n == 3:
		if x == 1:
			z = 'abb'
		elif x == 2:
			z = 'bab'
		else:
			z = 'bba'
	elif m == x:
		if i == n - 1:
			z = 'bb' + 'a' * (n - 2)
		else:
			z = 'a' * (n - i - 1) + 'bb' + 'a' * (i - 1)
	else:
		w = x - m
		z = 'a' * (n - i - 2) + 'b' + 'a' * (i + 1 - w) + 'b' + 'a' * (w - 1)
	r.append(z)
for i in r:
	print(i)


t = int(input())
while t:
	(n, k) = (int(i) for i in input().split())
	i = 1
	cum_sum = 0
	while cum_sum < k:
		cum_sum += i
		i += 1
	res = ['a'] * n
	res[n - i] = 'b'
	res[n - i + (cum_sum - k + 1)] = 'b'
	print(''.join(res))
	t -= 1


import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)

def in_int():
	return int(input())

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

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

def in_ints():
	return map(int, input().split())
import math
q = in_int()
for qq in range(q):
	(a, b) = in_ints()
	lvl = (int(math.sqrt(8 * (b - 1) + 1)) - 1) // 2
	s = ['a'] * a
	s[lvl + 1] = 'b'
	s[b - 1 - lvl * (lvl + 1) // 2] = 'b'
	for ss in s[::-1]:
		print(ss, end='')
	print()


import math
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	x = math.ceil((-1 + (1 + 8 * k) ** 0.5) / 2)
	ans = ['a'] * n
	temp = x * (x + 1) // 2
	temp = abs(temp - k - x)
	ans[max(n - x - 1, 0)] = 'b'
	ans[n - temp] = 'b'
	print(''.join(ans))


from bisect import *
b = []
p = 0
for i in range(1, int(100000.0 + 1)):
	p = i * (i - 1) // 2
	b.append(p)
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	ind = bisect_left(b, k)
	h = ind - 1
	s = []
	for i in range(n):
		s.append('')
	r = k - b[h]
	ind1 = n - 1 - ind
	ind2 = ind1 + (ind - r + 1)
	s[ind1] = 'b'
	s[ind2] = 'b'
	for i in range(n):
		if s[i] != 'b':
			s[i] = 'a'
	for i in s:
		print(i, end='')
	print()


t = int(input())
for _ in range(0, t):
	(n, k) = list(map(int, input().split()))
	x = 0
	s = 0
	back = True
	compt = k
	c = 0
	t = 0
	while compt > 0:
		c += 1
		t += c - 1
		compt = compt - c
	t = k - t - 1
	ch = 'a' * (n - (1 + c)) + 'b' + 'a' * (c - t - 1) + 'b' + t * 'a'
	print(ch)


t = int(input())
for x in range(t):
	small_list = []
	input_list = [int(a) for a in input().split()]
	n = input_list[0]
	k = input_list[1]
	b1_prime = (2 * k + 0.25) ** 0.5 - 0.5
	b1 = b1_prime
	if int(b1_prime) != b1_prime:
		b1 = int(b1_prime) + 1
	b2 = b1 - (b1 * (b1 + 1) / 2 - k) - 1
	aaa_list = 'a' * n
	print(aaa_list[int(b1) + 1:] + 'b' + aaa_list[int(b2) + 1:int(b1)] + 'b' + aaa_list[:int(b2)])


import math
ans_list = []
t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	From = math.ceil(-1 + (1 + 8 * k) ** 0.5) // 2
	To = math.floor(1 + (1 + 8 * k) ** 0.5) // 2 + 1
	for g in range(From, To):
		if g * (g - 1) // 2 <= k <= g * (g + 1) // 2:
			break
	string = ['a'] * n
	string[n - g - 1] = 'b'
	string[n - (k - g * (g - 1) // 2)] = 'b'
	ans_list.append(''.join(string))
for i in range(t):
	print(ans_list[i])


s = [1]
t = 1
i = 1
while i <= 100003:
	t += i
	s.append(t)
	i += 1
q = int(input())
for rewewre in range(q):
	(n, k) = map(int, input().split())
	for i in range(len(s)):
		if s[i] > k:
			b1 = i
			break
	b2 = k - s[b1 - 1]
	a = 'a' * n
	a = a[:b1] + 'b' + a[b1 + 1:]
	a = a[:b2] + 'b' + a[b2 + 1:]
	print(a[::-1])


def solve():
	A = list(map(int, input().split()))
	p1 = A[0] - 1
	p2 = A[0]
	fat = 1
	A[1] = A[1] - 1
	while A[1] >= fat:
		p1 = p1 - 1
		A[1] = A[1] - fat
		fat = fat + 1
	p2 = p2 - A[1]
	for i in range(1, A[0] + 1):
		if i == p1 or i == p2:
			print('b', end='')
		else:
			print('a', end='')
	print('')
T = int(input())
for i in range(T):
	solve()


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	s = ''
	if k == 1:
		print('a' * (n - 2) + 'b' + 'b')
	elif k == 2:
		print('a' * (n - 3) + 'b' + 'a' + 'b')
	else:
		for i in range(n - 1, 1, -1):
			j = i * (i - 1) // 2
			if k > j:
				for d in range(n):
					if d == n - i - 1 or d == n - k + j:
						s += 'b'
					else:
						s += 'a'
				break
			elif k == j:
				for d in range(n):
					if d == n - i or d == n - i + 1:
						s += 'b'
					else:
						s += 'a'
				break
		print(s)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	array = ['a' for i in range(n)]
	for i in range(1, n + 1):
		if i * (i + 1) // 2 >= k:
			array[-1 * i - 1] = 'b'
			d = k - i * (i - 1) // 2
			array[-1 * d] = 'b'
			print(''.join(array))
			break


for t in range(int(input())):
	(n, k) = map(int, input().split())
	b1 = round((k * 2) ** 0.5)
	b2 = k - b1 * (b1 - 1) // 2
	b2 -= 1
	for i in range(n - 1, -1, -1):
		if i == b1 or i == b2:
			print('b', end='')
		else:
			print('a', end='')
	print()


t = int(input())
import math
for i in range(t):
	(n, k) = input().split()
	(n, k) = (int(n), int(k))
	l = int(1 + 8 * k)
	l = int(math.sqrt(l) / 2)
	while k >= l * (l - 1) / 2 + 1:
		l += 1
	r = int(n - (k - 1 - (l - 1) * (l - 2) / 2) - 1)
	l = n - l
	v = 'a' * l + 'b' + 'a' * (r - l - 1) + 'b' + 'a' * (n - r - 1)
	print(v)


from math import *
for _ in ' ' * int(input()):
	(n, k) = map(int, input().split())
	x1 = ((1 + 8 * k) ** 0.5 - 1) / 2
	m = n - ceil(x1)
	mm = n - m - 1
	o = (mm * mm + mm) // 2
	b = n - k + o + 1
	a = 'a' * (m - 1) + 'b' + 'a' * (b - m - 1) + 'b' + 'a' * (n - b)
	print(a)


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	count = 1
	ans = 1
	while ans < k:
		count += 1
		ans += count
	res = ''
	for j in range(n - count - 1):
		res += 'a'
	res += 'b'
	for j in range(ans - k):
		res += 'a'
	res += 'b'
	for j in range(n - len(res)):
		res += 'a'
	print(res)


from math import sqrt, ceil
tests = int(input())
for _ in range(tests):
	(n, k) = [int(x) for x in input().split()]
	pos1 = ceil((sqrt(4 * k * 2 + 1) - 1) / 2)
	index = pos1 * (pos1 - 1) // 2
	pos2 = k - index
	res = ['a' for x in range(n)]
	res[pos1] = 'b'
	res[pos2 - 1] = 'b'
	print(''.join(res[::-1]))


t = int(input())
for hh in range(0, t):
	(n, k) = [int(x) for x in input().split()]
	acount = n - 2
	bcount = 2
	s = []
	for i in range(1, n + 1):
		rem = n - i
		if bcount == 2:
			nc2 = rem * (rem - 1) // 2
		elif bcount == 1:
			nc2 = rem
		if bcount == 0:
			s.append('a')
		elif acount == 0:
			s.append('b')
		elif nc2 < k:
			s.append('b')
			bcount -= 1
			k = k - nc2
		else:
			s.append('a')
			acount -= 1
	ans = ''
	for i in s:
		ans += i
	print(ans)


import math
t = int(input())
for xx in range(t):
	(n, k) = map(int, input().split())
	sol = math.ceil((-1 + (1 + 8 * k) ** 0.5) / 2)
	nn = sol * (sol + 1) // 2
	nn = nn - k
	ans = ['a'] * n
	ans[-1 - sol] = 'b'
	ans[-1 - sol + nn + 1] = 'b'
	print(''.join(ans))


import math

def foo(k):
	cat = (1 + math.sqrt(1 + 8 * (k - 1))) // 2
	last_term = cat * (cat + 1) // 2
	cat -= 1
	return [int(cat), int(last_term - k)]
t = int(input())
for i in range(t):
	(l, k) = map(int, input().split())
	a = l - 2
	ans = foo(k)
	one = a - ans[0]
	two = ans[1]
	print('a' * one + 'b' + 'a' * two + 'b' + 'a' * (a - one - two))


for m in range(int(input())):
	(n, k) = map(int, input().split())
	x = 1
	while (x + 1) * x / 2 < k:
		x += 1
	x -= 1
	y = k - int((x + 1) * x / 2)
	first_b = n - x - 2
	secon_b = n - y
	row = ''
	for j in range(n):
		if j == first_b:
			row += 'b'
		elif j == secon_b:
			row += 'b'
		else:
			row += 'a'
	print(row)


t = int(input())
for T in range(t):
	(n, k) = [int(x) for x in input().split()]
	ans = ''
	ind = 1
	while ind * (ind + 1) // 2 < k:
		ind += 1
	front = n - (ind + 1)
	mid = ind * (ind + 1) // 2 - k
	ans += 'a' * front
	ans += 'b'
	ans += 'a' * mid
	ans += 'b'
	ans += 'a' * (ind - (mid + 1))
	print(ans)


T = int(input())
for _ in range(T):
	(n, k) = [int(i) for i in input().split()]
	p = 0
	while k > p:
		(k, p) = (k - p, p + 1)
	(b_1, b_2) = (n - p - 1, n - k)
	print(f"{'a' * b_1}b{'a' * (b_2 - b_1 - 1)}b{'a' * (n - b_2 - 1)}")


from sys import stdin, stdout
from math import *
input = stdin.readline
a = [1]
x = 2
for i in range(200005):
	a.append(x + a[-1])
	x += 1

def fl(a, n):
	l = 0
	r = len(a)
	ans = -1
	while l <= r:
		m = (l + r) // 2
		if a[m] < n:
			ans = m
			l = m + 1
		else:
			r = m - 1
	return ans
for __ in range(int(input())):
	(n, m) = map(int, input().split())
	if m == 1:
		print('a' * (n - 2) + 'b' * 2)
	else:
		f = fl(a, m)
		ans = 'b'
		temp = m - a[f]
		ans2 = 'b' + 'a' * (temp - 1)
		ans += 'a' * (a[f + 1] - m)
		rslt = ans + ans2
		rslt = (n - len(rslt)) * 'a' + rslt
		print(rslt)


def main_function():
	t = int(input())
	for i in range(t):
		(n, k) = list(map(int, input().split(' ')))
		prev = 0
		for j in range(1, n):
			prev += j
			if k <= prev:
				b1 = n - j - 1
				b2 = b1 + prev % k + 1
				print('a' * b1 + 'b' + 'a' * (b2 - b1 - 1) + 'b' + 'a' * (n - b2 - 1))
				break
main_function()


t = int(input())
for i in range(t):
	(n, k) = list(map(int, input().split()))
	comb = []
	convo: str
	for j in range(n):
		comb.append('a')
	for l in range(n - 2, -1, -1):
		if k <= n - l - 1:
			comb[l] = 'b'
			comb[n - k] = 'b'
			convo = ''.join(map(str, comb))
			print(convo)
			break
		k -= n - l - 1


s = int(input())
for i in range(0, s):
	a = input().split()
	c = int(a[0])
	n = list(range(2, int(a[0]) + 1))
	b = int(a[1])
	for j in n:
		div = j * (j - 1) // 2
		if (b // div == 1) & (b % div == 0):
			print('a' * (c - j) + 'bb' + 'a' * (j - 2))
			break
		elif b // div == 0:
			print('a' * (c - j) + 'b' + 'a' * (div - b) + 'b' + 'a' * (j - 2 + b - div))
			break


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if k == 1:
		s = 'a' * (n - 2) + 'bb'
	else:
		x = int((2 * k) ** 0.5) + 1
		y = x - 1
		N_lower = y * (y + 1) // 2
		if N_lower >= k:
			x = y
			y -= 1
		N_lower = y * (y + 1) // 2
		s = 'a' * (n - x - 1) + 'b'
		y = k - N_lower
		s += 'a' * (x - y) + 'b' + 'a' * (y - 1)
	print(s)


def val(x):
	return (x + 1) * x // 2
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	k -= 1
	l = 0
	r = n - 1
	l1 = val(l)
	r1 = val(r)
	while r - l > 1:
		m = (l + r) // 2
		m1 = val(m)
		if l1 <= k < m1:
			r = m
		else:
			l = m
	s = 'a' * (n - 2 - l)
	s += 'b'
	k -= val(l)
	if l - k > 0:
		s += 'a' * (l - k)
	s += 'b'
	if k > 0:
		s += 'a' * k
	print(s)


t = int(input())
for x in range(t):
	(n, k) = map(int, input().split())
	b = 2
	g = int((k * 2) ** 0.5)
	if g * (g + 1) // 2 >= k:
		g -= 1
	b += g
	a = k - g * (g + 1) // 2
	c = ['a'] * n
	c[n - (a - 1) - 1] = 'b'
	c[n - (b - 1) - 1] = 'b'
	print(''.join(c))


t = int(input())
for _ in range(t):
	(a, b) = map(int, input().split())
	ct = 0
	sum = 0
	while 1:
		ct += 1
		sum += ct
		if sum >= b:
			break
	sum = sum - b
	ans = 'b'
	for i in range(ct):
		if sum == i:
			ans += 'b'
		else:
			ans += 'a'
	a = a - (ct + 1)
	if a > 0:
		temp = str()
		for i in range(a):
			temp += 'a'
		ans = temp + ans
	print(ans)


def func(l, m):
	arr = ['a'] * l
	x = 0
	for i in range(l * (l - 1)):
		if i * (i + 1) // 2 >= m:
			x = i
			break
	arr[-(x + 1)] = 'b'
	temp = x - 1
	res = temp * (temp + 1) // 2
	res = m - res
	arr[-res] = 'b'
	g = ''.join(arr)
	print(g)
t = int(input())
for _ in range(t):
	(l, m) = map(int, input().split())
	func(l, m)


for t in range(int(input())):
	(n, k) = map(int, input().split())
	s = [0] * n
	p = 2
	while k > p - 1:
		k -= p - 1
		p += 1
	s[n - p] = 1
	s[n - k] = 1
	print(''.join(['b' if i else 'a' for i in s]))


t = int(input())
a = []
for i in range(0, t):
	b = [int(z) for z in input().split()]
	a.append(b)
x1 = ['aab', 'aba', 'baa']
x2 = ['abb', 'bab', 'bba']
for i in range(0, t):
	n = a[i][0]
	k = a[i][1]
	n3 = n - 2
	n1 = 0
	n2 = 0
	step = 0
	while n > 3:
		if step == 0:
			total = int(n * (n - 1) / 2)
			th1 = total - n + 1
		elif step >= 1:
			th1 = n - 1
			total = n
		if k < th1:
			if n1 < n3:
				print('a', end='')
				n1 = n1 + 1
			else:
				print('b', end='')
				n2 = n2 + 1
		elif k > th1:
			step = step + 1
			if k > th1:
				k = k - th1
			if n2 < 2:
				print('b', end='')
				n2 = n2 + 1
			else:
				print('a', end='')
				n1 = n1 + 1
		elif k == th1:
			step = step + 1
			if n1 < n3:
				print('a', end='')
				n1 = n1 + 1
			else:
				print('b', end='')
				n2 = n2 + 1
		n = n - 1
	z1 = int(k % 3 - 1)
	if n3 - n1 == 3:
		print('aaa')
	elif n3 - n1 == 2:
		print(x1[z1])
	elif n3 - n1 == 1:
		print(x2[z1])


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	res = ['a'] * n
	h = [(n - i - 1, n - 1) for i in range(1, n)]
	for j in range(len(h)):
		if k > j + 1:
			k = k - (j + 1)
		else:
			res[h[j][0]] = 'b'
			res[h[j][1] - (k - 1)] = 'b'
			print(''.join(res))
			break


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	(pos1, pos2, val, s) = (a - 1, a, 1, 0)
	while s <= b:
		if s + val >= b:
			break
		s += val
		val += 1
		pos1 -= 1
	rem = b - s
	pos2 = a - rem + 1
	for i in range(1, a + 1):
		if i == pos1 or i == pos2:
			print('b', end='')
		else:
			print('a', end='')
	print()


def solve(n):
	arr[1] = 1
	arr[2] = 2
	for i in range(3, n + 1):
		arr[i] = 2 * arr[i - 1] - arr[i - 2] + 1
	return arr[n]
t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	arr = [False] * (n + 1)
	x = solve(n)
	if k in arr:
		p = arr.index(k)
		print('a' * (n - (p + 1)) + 'b' + 'a' * (p - 1) + 'b')
	else:
		for j in range(len(arr)):
			if arr[j] > k:
				a = k - arr[j - 1]
				b = arr[j - 1]
				p = j - 1
				break
		print('a' * (n - (p + 1)) + 'b' + 'a' * (p + 1 - (a + 1) - 1) + 'b' + 'a' * a)


from sys import stdin, stdout
ps = lambda x: x * (x - 1) // 2
out = ['a'] * int(100000.0 + 5)

def get_first(val):
	(lo, hi) = (1, val)
	first = val
	while lo <= hi:
		mid = lo + (hi - lo) // 2
		if ps(mid + 1) >= val:
			hi = mid - 1
			first = mid
		else:
			lo = mid + 1
	return first
t = int(stdin.readline())
while t:
	(n, k) = map(int, stdin.readline().split(' '))
	ret = out[:n]
	gf = get_first(k)
	f = n - gf - 1
	second = ps(gf)
	ret[f] = 'b'
	ret[n - (k - second)] = 'b'
	stdout.write(''.join(ret))
	stdout.write('\n')
	t -= 1


from sys import stdin, stdout
input = stdin.readline
t = int(input())
for _ in range(t):
	(n, k) = list(map(int, input().split()))
	s = ['a'] * n
	ii = 0
	arr = []
	while 1:
		if k <= (n * n - 3 * n + 2) // 2:
			ii += 1
			n -= 1
		else:
			k -= (n * n - 3 * n + 2) // 2
			arr = [ii, ii + n - k]
			break
	s[arr[0]] = 'b'
	s[arr[1]] = 'b'
	stdout.write(''.join(s) + '\n')


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	m = n
	x = n * (n - 1) // 2
	while x >= k:
		n -= 1
		x = n * (n - 1) // 2
	g = n * (n + 1) // 2
	d = g - k
	ans = 'a' * (m - n - 1) + 'b' + 'a' * d + 'b'
	l = len(ans)
	ans += 'a' * (m - l)
	print(ans)


t = int(input())
while t:
	(n, m) = map(int, input().split())
	s = 0
	ans = n * (n - 1) // 2
	ctr = 1
	while s < m:
		s += ctr
		ctr += 1
	ctr -= 1
	ans = 'a' * (n - 1 - ctr) + 'b'
	if s == m:
		ans += 'b' + 'a' * (ctr - 1)
	else:
		yahan = s - m
		temp = list('a' * ctr)
		temp[yahan] = 'b'
		ans += ''.join(temp)
	print(ans)
	t -= 1


arr = [0, 1]
while arr[-1] <= 2000000000:
	arr.append(arr[-1] - arr[-2] + arr[-1] + 1)
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = ['a'] * n
	lo = 0
	hi = len(arr) - 1
	while lo <= hi:
		mid = (lo + hi) // 2
		if arr[mid] < k <= arr[mid + 1]:
			lo = hi + 1
		elif arr[mid] < k:
			lo = mid + 1
		else:
			hi = mid - 1
	s[n - mid - 2] = 'b'
	s[n - k + arr[mid]] = 'b'
	print(''.join(s))


def solve(n, k):
	i = 0
	while i * (i + 1) // 2 < k:
		i += 1
	j = k - i * (i - 1) // 2 - 1
	ret = ['a'] * n
	ret[i] = 'b'
	ret[j] = 'b'
	return ''.join(ret[::-1])

def main():
	inp_i = lambda : int(input())
	inp_a = lambda : [int(x) for x in input().split()]
	tc = inp_i()
	for _ in range(tc):
		(n, k) = inp_a()
		print(solve(n, k))
main()


import os
from io import BytesIO, IOBase
import sys
from collections import defaultdict, deque, Counter
from bisect import *
from math import sqrt
import math
from itertools import permutations

def main():
	for _ in range(int(input())):
		(n, k) = map(int, input().split())
		if k == 1:
			print('a' * (n - 2) + 'bb')
		else:
			ans = []
			i = 3
			while k > i * (i - 1) // 2 and i <= n:
				i += 1
			for j in range(n - i):
				ans.append('a')
			ans.append('b')
			t = n - len(ans)
			k = k - t * (t - 1) // 2
			ans.append('a' * (t - k) + 'b' + 'a' * (k - 1))
			print(''.join(ans))
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

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

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

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

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

class IOWrapper(IOBase):

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


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	t = k
	c = 0
	while t >= 0:
		c += 1
		t -= c
	t += c
	s = ['a' for i in range(n)]
	if t != 0:
		s[-1 * (c + 1)] = 'b'
		s[-t] = 'b'
	else:
		s[-c] = 'b'
		s[-1 * (c - 1)] = 'b'
	ans = ''.join(s)
	print(ans)


import sys
T = int(sys.stdin.readline().strip())
for t in range(0, T):
	(n, k) = list(map(int, sys.stdin.readline().strip().split()))
	i = 0
	while i * (i - 1) // 2 < k:
		i = i + 1
	(x, y) = (i, k - (i - 1) * (i - 2) // 2)
	ans = ['a' for i in range(0, n)]
	ans[x - 1] = 'b'
	ans[y - 1] = 'b'
	ans.reverse()
	print(''.join(ans))


t = int(input())
for i in range(t):
	(n, k) = list(map(int, input().split()))
	l = ['a'] * n
	for j in range(n - 2, -1, -1):
		if k <= n - j - 1:
			l[j] = 'b'
			l[n - k] = 'b'
			print(''.join(l))
			break
		k -= n - j - 1


from sys import stdin, stdout
Pi = lambda x: stdout.write(str(x) + '\n')
S = lambda x: x * (x + 1) // 2
I = lambda x: 1 + 2 * x
R = lambda : stdin.readline()
Ri = lambda x: map(int, x.split())
Rs = lambda x: map(str, x.split())
Rf = lambda x: map(float, x.split())

def bs(n):
	(l, r) = (0, 1000000)
	while r - l > 1:
		m = (l + r) // 2
		if S(m) > n:
			r = m
		else:
			l = m
	return l

def main():
	t = int(R())
	for x in range(t):
		(n, b) = Ri(R())
		if b != 1:
			b -= 1
			c = bs(b)
			d = b - S(c)
			for i in range(1, n + 1):
				if i == n - c - 1 or i == n - d:
					print('b', end='')
				else:
					print('a', end='')
			print()
		else:
			s = 'a' * (n - 2)
			print(s + 'bb')
main()


import math

def solve():
	(n, k) = map(int, input().split())
	if k == 1:
		v = 'a' * (n - 2) + 'b' * 2
		print(v)
	else:
		x = -1 + pow(8 * k, 0.5)
		x = math.floor(x / 2)
		c = x * (x + 1) // 2
		z = k - c
		if z == 0:
			r = x + 1
			v = 'a' * (n - r) + 'b' * 2 + 'a' * r
			print(v)
		else:
			r = x + 2
			v = 'a' * (n - r) + 'b' + 'a' * (r - z - 1) + 'b' + 'a' * (z - 1)
			print(v)
for _ in range(int(input())):
	solve()


NT = int(input())
n = []
k = []
for i in range(NT):
	vs = input().split()
	n.append(int(vs[0]))
	k.append(int(vs[1]))
for eNT in range(NT):
	i = 0
	h = 0
	while True:
		h = h + 1
		d = 0
		i = i + h
		if k[eNT] <= i:
			d = abs(i - k[eNT])
			if d >= h:
				h = h - 1
				d = abs(d - h)
			d = abs(h - d - 1)
			break
	ans = ['a'] * n[eNT]
	ans[n[eNT] - h - 1] = 'b'
	ans[n[eNT] - d - 1] = 'b'
	print(''.join(ans))


temp = ['a'] * 100005
for _ in range(int(input())):
	(n, k) = list(map(int, input().split()))
	avs = 0
	for i in range(n - 2, -1, -1):
		avs += n - i - 1
		if k <= avs:
			s = i + 1 + (avs - k)
			break
	ans = temp[:n]
	ans[i] = ans[s] = 'b'
	print(''.join(ans))


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	pt = n
	n = k
	c = 1
	while n - c > 0:
		n -= c
		c += 1
	s = 'a' * pt
	if n == 1:
		loc1 = pt - c - 1
		s = s[:loc1] + 'b' + s[loc1 + 1:]
		s = s[:-1] + 'b'
		print(s)
		continue
	loc1 = pt - c - 1
	s = s[:loc1] + 'b' + s[loc1 + 1:]
	k = pt - n
	s = s[:k] + 'b' + s[k + 1:]
	print(s)


from sys import exit as sys_return
queries = int(input())
for _ in range(queries):
	(size, number) = map(int, input().split())
	res = ['a' for i in range(size)]
	(power, variants) = (1, 1)
	while variants < number:
		power += 1
		variants += power
	res[power] = 'b'
	res[power - variants + number - 1] = 'b'
	for i in res[::-1]:
		print(i, end='')
	print()


T = int(input())
n = [0] * T
k = [0] * T
ns = [0] * T
for t in range(T):
	(n[t], k[t]) = [int(i) for i in input().split(' ')]

def nlt(n):
	if n == 1:
		return 0
	tr = int((2 * n) ** 0.5) + 1
	while tr * tr * 0.5 + 0.5 * tr >= n:
		tr -= 1
	return int(tr)

def ans(n, k):
	fa = nlt(k)
	ffa = int(fa * fa * 0.5 + 0.5 * fa)
	a = ['a'] * n
	a[fa + 1] = 'b'
	a[k - ffa - 1] = 'b'
	a.reverse()
	return ''.join(a)
for t in range(T):
	print(ans(n[t], k[t]))


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	q = ['a'] * n
	i = 2
	while i * (i - 1) // 2 < k:
		i += 1
	q[-1 * i] = 'b'
	r = i * (i - 1) // 2 - k
	q[-1 * i + 1 + r] = 'b'
	print(''.join(q))


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	li = ['a'] * n
	for i in range(2, n + 1):
		if i * (i - 1) // 2 > k:
			break
		elif i * (i - 1) // 2 == k:
			break
	if i * (i - 1) == k:
		li[-i] = 'b'
		li[-i + 1] = 'b'
		print(''.join(li))
	else:
		li[-i] = 'b'
		xx = (i - 1) * (i - 2) // 2
		xx = k - xx
		li[-xx] = 'b'
		print(''.join(li))


t = int(input())
for i in range(t):
	l = list(map(int, input().split()))
	m = [0]
	for i in range(l[0] - 1):
		temp = i + 1 + m[0]
		if temp > l[1]:
			x2 = l[0] - (l[1] - m[0])
			break
		elif temp == l[1]:
			x2 = l[0] - (l[1] - m[0])
			break
		m.insert(0, temp)
	x1 = l[0] - 2 - i
	s = 'a' * l[0]
	s = s[:x1] + 'b' + s[x1 + 1:x2] + 'b' + s[x2 + 1:]
	print(s)


import math
t = int(input())
for kikk in range(t):
	(n, k) = list(map(int, input().split()))
	pos1 = int(math.sqrt(8 * k + 1) / 2 + 1 / 2.0)
	c = pos1 * (pos1 - 1)
	c = int(c / 2)
	s = ' '
	if c == k:
		one = pos1 - 2
		s1 = 'a' * one
		s2 = 'a' * (n - pos1)
		s = s2 + 'bb' + s1
	else:
		pos2 = k - c
		one = pos2 - 1
		two = pos1 - pos2
		thr = n - pos1 - 1
		s1 = 'a' * one
		s2 = 'a' * two
		s3 = 'a' * thr
		s = s3 + 'b' + s2 + 'b' + s1
	print(s)


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	i = 1
	l = []
	for j in range(n):
		l.append('a')
	while k > 0:
		k = k - i
		i += 1
	z = n - i
	l[z] = 'b'
	l[z - k + 1] = 'b'
	z = ''.join(l)
	print(z)


from bisect import bisect_left
dp = []
x = 1
temp = 1
while temp <= 2 * 10 ** 9 + 1:
	dp.append(temp)
	temp += x
	x += 1
dp.append(temp)
for T in range(int(input())):
	(n, k) = list(map(int, input().split()))
	ind = bisect_left(dp, k)
	if k < dp[ind]:
		ind -= 1
	val = dp[ind]
	ind += 2
	p = n - ind
	diff = k - val
	j = n - 1 - diff
	final = ['a'] * n
	final[p] = 'b'
	final[j] = 'b'
	print(''.join(final))


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	i1 = 0
	while 1:
		i1 += 1
		if i1 * (i1 + 1) // 2 == k - 1:
			break
		if i1 * (i1 + 1) // 2 > k - 1:
			i1 -= 1
			break
	j = i1 * (i1 + 1) // 2
	z1 = n - 2 - i1
	if i1 == 0:
		z = n - 1
	elif j < k:
		z = n - (k - j)
	else:
		z = n - 1
	for i in range(0, n):
		if i == z or i == z1:
			print('b', end='')
		else:
			print('a', end='')
	print()


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if k == 1:
		print((n - 2) * 'a' + 'bb')
		continue
	for i in range(2, n + 1):
		if i * (i - 1) // 2 >= k:
			break
	if i * (i - 1) // 2 == k:
		print((n - i) * 'a' + 'bb' + (i - 1 - 1) * 'a')
	else:
		c = i * (i - 1) // 2 - k
		s = (n - i) * 'a' + 'b' + c * 'a' + 'b' + (i - 1 - c) * 'a'
		print(s[:n])


def I():
	return list(map(int, input().split()))
for __ in range(int(input())):
	(n, k) = I()
	pos1 = n
	sum1 = 0
	for i in range(2, n + 1):
		sum1 += i - 1
		if sum1 >= k:
			break
	pos1 = i
	pos2 = sum1 - k - i + 1
	s = ['a'] * n
	s[-pos1] = 'b'
	s[pos2] = 'b'
	ans = ''
	for i in range(n):
		ans += s[i]
	print(ans)


from collections import defaultdict, OrderedDict, Counter
from sys import stdin, stdout
from bisect import bisect_left, bisect_right
from queue import Queue, PriorityQueue
from heapq import heapify, heappop, heappush
from statistics import median
from math import gcd, sqrt, floor, factorial, ceil, log2, log10
import fractions
import copy
from copy import deepcopy
import sys
sys.setrecursionlimit(10 ** 7)
import math
import os
import bisect
import collections
mod = pow(10, 9) + 7
import random
from random import random, randint, randrange

def ncr(n, r, p=mod):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p

def normalncr(n, r):
	r = min(r, n - r)
	count = 1
	for i in range(n - r, n + 1):
		count *= i
	for i in range(1, r + 1):
		count //= i
	return count
inf = float('inf')
adj = defaultdict(set)
visited = defaultdict(int)

def addedge(a, b):
	adj[a].add(b)
	adj[b].add(a)

def bfs(v):
	q = Queue()
	q.put(v)
	visited[v] = 1
	while q.qsize() > 0:
		s = q.get_nowait()
		print(s)
		for i in adj[s]:
			if visited[i] == 0:
				q.put(i)
				visited[i] = 1

def dfs(v, visited):
	if visited[v] == 1:
		return
	visited[v] = 1
	print(v)
	for i in adj[v]:
		dfs(i, visited)

def reverse_bisect_right(a, x, lo=0, hi=None):
	if lo < 0:
		raise ValueError('lo must be non-negative')
	if hi is None:
		hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if x > a[mid]:
			hi = mid
		else:
			lo = mid + 1
	return lo

def reverse_bisect_left(a, x, lo=0, hi=None):
	if lo < 0:
		raise ValueError('lo must be non-negative')
	if hi is None:
		hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if x >= a[mid]:
			hi = mid
		else:
			lo = mid + 1
	return lo

class MaxHeap:

	def _init_(self, maxsize):
		self.maxsize = maxsize
		self.size = 0
		self.Heap = [0] * (self.maxsize + 1)
		self.Heap[0] = sys.maxsize
		self.FRONT = 1

	def parent(self, pos):
		return pos // 2

	def leftChild(self, pos):
		return 2 * pos

	def rightChild(self, pos):
		return 2 * pos + 1

	def isLeaf(self, pos):
		if pos >= self.size // 2 and pos <= self.size:
			return True
		return False

	def swap(self, fpos, spos):
		(self.Heap[fpos], self.Heap[spos]) = (self.Heap[spos], self.Heap[fpos])

	def maxHeapify(self, pos):
		if not self.isLeaf(pos):
			if self.Heap[pos] < self.Heap[self.leftChild(pos)] or self.Heap[pos] < self.Heap[self.rightChild(pos)]:
				if self.Heap[self.leftChild(pos)] > self.Heap[self.rightChild(pos)]:
					self.swap(pos, self.leftChild(pos))
					self.maxHeapify(self.leftChild(pos))
				else:
					self.swap(pos, self.rightChild(pos))
					self.maxHeapify(self.rightChild(pos))

	def insert(self, element):
		if self.size >= self.maxsize:
			return
		self.size += 1
		self.Heap[self.size] = element
		current = self.size
		while self.Heap[current] > self.Heap[self.parent(current)]:
			self.swap(current, self.parent(current))
			current = self.parent(current)

	def Print(self):
		for i in range(1, self.size // 2 + 1):
			print(' PARENT : ' + str(self.Heap[i]) + ' LEFT CHILD : ' + str(self.Heap[2 * i]) + ' RIGHT CHILD : ' + str(self.Heap[2 * i + 1]))

	def extractMax(self):
		popped = self.Heap[self.FRONT]
		self.Heap[self.FRONT] = self.Heap[self.size]
		self.size -= 1
		self.maxHeapify(self.FRONT)
		return popped

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

def get_str_list_in_int():
	return [int(i) for i in list(input())]

def get_str_list():
	return list(input())

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

def input_int():
	return int(input())

def matrix(a, b):
	return [[0 for i in range(b)] for j in range(a)]

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

def find_gcd(l):
	a = l[0]
	for i in range(len(l)):
		a = gcd(a, l[i])
	return a

def is_prime(n):
	sqrta = int(sqrt(n))
	for i in range(2, sqrta + 1):
		if n % i == 0:
			return 0
	return 1

def prime_factors(n):
	sqrta = int(sqrt(n))
	for i in range(2, sqrta + 1):
		if n % i == 0:
			return [i] + prime_factors(n // i)
	return [n]
nc = 'NO'
yc = 'YES'
ns = 'No'
ys = 'Yes'
t = input_int()
for i in range(t):
	(n, k) = get_map()
	str = ['a'] * n
	position1 = 1
	count = 1
	while count < k:
		position1 += 1
		count += position1
	position2 = count - k
	str[position1] = 'b'
	str[position1 - position2 - 1] = 'b'
	str.reverse()
	str = ''.join(str)
	print(str)


t = int(input())
for test_case in range(t):
	(n, k) = map(int, input().split(' '))
	iF = 1
	for i in range(n):
		if k <= i * (i + 1) // 2:
			iF = i
			break
	b1 = iF + 1
	b2 = k - iF * (iF - 1) // 2
	print((n - b1) * 'a' + 'b' + (b1 - b2 - 1) * 'a' + 'b' + (b2 - 1) * 'a')


import sys
from collections import Counter

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

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

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

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

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

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

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

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

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7

def bisearch_max(mn, mx, func):
	ok = mn
	ng = mx
	while ok + 1 < ng:
		mid = (ok + ng) // 2
		if func(mid):
			ok = mid
		else:
			ng = mid
	return ok

def get_sum(a, d, n):
	return (2 * a + (n - 1) * d) * n // 2

def check(m):
	return get_sum(1, 1, m) < K
for _ in range(INT()):
	(N, K) = MAP()
	res = bisearch_max(0, N, check)
	a = N - res - 2
	sm = get_sum(1, 1, res)
	b = N - (K - sm)
	ans = ['a'] * N
	ans[a] = ans[b] = 'b'
	print(''.join(ans))


I = input
for _ in range(int(I())):
	(n, k) = map(int, I().split())
	ans = ['a' for i in range(n)]
	if k > 2:
		for i in range(n, 2, -1):
			t = (i - 1) * (i - 2) // 2
			t += 1
			u = i * (i - 1) // 2
			if t <= k <= u:
				d = k - t
				ans[n - i] = 'b'
				ans[n - d - 1] = 'b'
				break
		print(''.join(ans))
	elif k == 1:
		print('a' * (n - 2), end='')
		print('bb')
	else:
		print('a' * (n - 3), end='')
		print('bab')


t = int(input())

def bin_search(l, r, k):
	if l <= r:
		m = (l + r) // 2
		if m * (m + 1) // 2 >= k and m * (m - 1) // 2 < k:
			return m
		if m * (m + 1) // 2 < k:
			return bin_search(m + 1, r, k)
		return bin_search(l, m - 1, k)
for i in range(t):
	(n, k) = map(int, input().split())
	m = bin_search(1, n, k)
	res = ['a' for i in range(n)]
	res[-(m + 1)] = 'b'
	sec = k - m * (m - 1) // 2
	res[-sec] = 'b'
	print(''.join(res))


for i in range(int(input())):
	(x, y) = map(int, input().split())
	n = 0
	k = 1
	while n + k < y:
		n = n + k
		k += 1
	z = y - n - 1
	k = x - 1 - k
	z = x - 1 - z
	for i in range(x):
		if i == k or i == z:
			print('b', end='')
		else:
			print('a', end='')
	print('')


for i in range(int(input())):
	(n, k) = map(int, input().split())
	l1 = ['a'] * n
	count = 1
	inc = 1
	while k >= count:
		if count + inc >= k:
			last = count
		count = count + inc
		inc += 1
	l1[n - inc] = 'b'
	l1[n - 1 - (k - last)] = 'b'
	print(''.join(l1))


from math import sqrt, ceil
t = int(input())
for i in range(t):
	(n, k) = tuple(map(int, input().split()))
	tmp = ceil((-1 + sqrt(1 + 8 * k)) / 2)
	first_a_pos = n - tmp
	between = int(tmp * (tmp + 1) / 2 - k)
	str = '{}{}{}{}{}'.format('a' * (first_a_pos - 1), 'b', 'a' * between, 'b', 'a' * (n - first_a_pos - between - 1))
	print(str)


from math import sqrt
for i in range(int(input())):
	(n, k) = map(int, input().split())
	pos1 = int((sqrt(1 + k * 8) - 1) / 2)
	pos2 = k - (pos1 - 1) * pos1 // 2 - 1
	while pos2 >= pos1:
		pos1 += 1
		pos2 = k - (pos1 - 1) * pos1 // 2 - 1
	ans = ['a'] * n
	ans[pos1] = 'b'
	ans[pos2] = 'b'
	print(*ans[::-1], sep='')


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	L = ['a'] * a
	for i in range(a - 2, -1, -1):
		if b <= a - i - 1:
			L[i] = 'b'
			L[a - b] = 'b'
			print(''.join(L))
			break
		else:
			b -= a - i - 1


def give(x):
	y = 8 * (x - 1)
	y += 1
	y **= 0.5
	y += 1
	y /= 2
	return int(y)

def f(i):
	return 1 + i * (i - 1) // 2
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	a = ['a'] * n
	i = give(k)
	a[n - i - 1] = 'b'
	a[n - k % f(i) - 1] = 'b'
	s = ''.join(a)
	print(s)


import sys
import math
t = int(sys.stdin.readline())
ans_arr = []
for x in range(t):
	[n, k] = [int(i) for i in sys.stdin.readline().split()]
	low = 1
	high = n
	while low < high:
		mid = low + math.ceil((high - low) / 2)
		tmp = (mid - 1) * mid // 2
		if tmp <= k:
			low = mid
		else:
			high = mid - 1
	num = (low - 1) * low // 2
	pos = k - num
	if pos == 0:
		pos = low - 1
	else:
		low += 1
	arr = ['a'] * n
	arr[n - pos] = 'b'
	arr[n - low] = 'b'
	s = ''
	for d in range(n):
		s += arr[d]
	ans_arr.append(s)
print('\n'.join(ans_arr))


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	f = 0
	n = 1
	while f == 0:
		if n * (n + 1) < 2 * b:
			n += 1
		else:
			f += 1
	g = ''
	for i in range(a - (n + 1)):
		g += 'a'
	g += 'b'
	p = b - n * (n - 1) // 2
	for i in range(n - p):
		g += 'a'
	g += 'b'
	k = len(g)
	for i in range(a - k):
		g += 'a'
	print(g)


def pos(n, k):
	tup = ()
	i = n - 2
	while i >= 0:
		if k <= n - i - 1:
			tup += (i,)
			tup += (n - k,)
			break
		else:
			k -= n - i - 1
		i -= 1
	return tup

def solve(n, position):
	string = ''
	for i in range(n):
		if i == position[0] or i == position[1]:
			string += 'b'
		else:
			string += 'a'
	return string
t = int(input())
for case in range(t):
	(n, k) = map(int, input().split())
	position = pos(n, k)
	string = solve(n, position)
	print(string)


t = int(input())
for test in range(t):
	(a, b) = map(int, input().split())
	i = 1
	ans = 1
	r = 1
	while ans < b:
		i += 1
		ans += i
	f = -(i + 1)
	s = -(b - (ans - i))
	m = ['a'] * a
	m[f] = 'b'
	m[s] = 'b'
	print(''.join(m))


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	i = 1
	s = 1
	while s < k:
		i = i + 1
		s = s + i
	s1 = s - i
	b = k - s1
	a = i + 1
	arr = ['a'] * (n - a) + ['b'] + ['a'] * (a - b - 1) + ['b'] + ['a'] * (b - 1)
	print(''.join(list(map(str, arr))))


results = []
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	x = int((k * 2) ** 0.5)
	if x * (x + 1) >= k * 2:
		a = x
	else:
		a = x + 1
	x = a * (a + 1) // 2
	r = x - k
	line1 = 'a' * n
	line2 = line1[:n - a - 1] + 'b' + line1[n - a:n - a + r] + 'b' + line1[n - a + r + 1:]
	results.append(line2)
print('\n'.join(results))


t = int(input())
for i in range(t):
	ch = input()
	L = [int(i) for i in ch.split()]
	n = L[0]
	k = L[1]
	s = 'a' * n
	x = 1
	while k - x > 0:
		k = k - x
		x += 1
	s = ''
	for j in range(n):
		if j == n - x - 1 or j == n - k:
			s = s + 'b'
		else:
			s = s + 'a'
	print(s)


from math import *
from sys import stdin, stdout

def f(n):
	i = floor((sqrt(8 * n - 1) + 1) // 2)
	j = n - 1 - i * (i - 1) // 2
	return (1 << i) + (1 << j)

def bina(n, l):
	n = str(bin(n)[2:])
	n = n.replace('1', 'b').replace('0', 'a')
	lon = len(n)
	aux = ''
	if l != lon:
		aux = 'a' * (l - lon)
	stdout.write(aux + n + '\n')
for _ in range(int(stdin.readline())):
	(n, k) = map(int, stdin.readline().split())
	bina(f(k), n)


import math
t = int(input())
for x in range(t):
	(a, b) = map(int, input().split())
	pre = 0
	temp = 1
	k = 1
	i = 2
	for i in range(2, 2000000000):
		if b <= temp:
			break
		else:
			pre = temp
			temp = temp + i
	pos = b - pre
	ans1 = a - pos
	ans2 = a - i
	for i in range(a):
		if i == ans1 or i == ans2:
			print('b', end='')
		else:
			print('a', end='')
	print()


n = int(input())

def string_k(i):
	n = int(i[0])
	k = int(i[1])
	cntr = 0
	c = k
	for j in range(n):
		if c > 0:
			c = c - j
			cntr += 1
	rem = c
	cntr -= 1
	b1 = cntr
	b2 = cntr + rem - 1
	l = []
	for i in range(n):
		l.append('a')
	l[b1] = l[b2] = 'b'
	l.reverse()
	for i in range(len(l)):
		print(l[i], end='')
for _ in range(n):
	samples = input().split()
	string_k(samples)
	print()


a = int(input())
for i in range(a):
	(b, c) = map(int, input().split())
	firstb = b - 1
	secondb = b + 1
	for j in range(1, b):
		if c > j:
			c = c - j
			firstb -= 1
		else:
			secondb -= c
			break
	answer = str()
	if firstb == 1:
		answer = answer + 'b'
	else:
		for k in range(1, firstb):
			answer = answer + 'a'
		answer = answer + 'b'
	if firstb == secondb - 1:
		answer = answer + 'b'
	else:
		for k in range(firstb + 1, secondb):
			answer = answer + 'a'
		answer = answer + 'b'
	if secondb == b:
		print(answer)
	else:
		for k in range(secondb + 1, b + 1):
			answer = answer + 'a'
		print(answer)


def makeTheBase():
	base = []
	total = 1
	for i in range(1, 63247):
		total += i
		base.append(total)
	return base

def binSearch(num):
	left = 0
	right = 63247
	while abs(left - right) > 1:
		mid = (left + right) // 2
		if num >= base[left] and num <= base[mid]:
			right = mid
		else:
			left = mid
	return (left, right)

def positionOfB(n, k):
	if k == 1:
		b1 = n - 2
		b2 = n - 1
	else:
		(left, right) = binSearch(k)
		if base[right] == k:
			pos = right + 1
		else:
			pos = left + 1
		temp = base[pos - 1]
		dif = abs(temp - k)
		b1 = abs(pos - (n - 2))
		b2 = abs(dif - (n - 1))
	return (b1, b2)

def printMe(n, pos1, pos2):
	for i in range(n):
		if i == pos1 or i == pos2:
			print('b', end='')
		else:
			print('a', end='')
	print()
base = makeTheBase()
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	(pos1, pos2) = positionOfB(n, k)
	printMe(n, pos1, pos2)


from math import ceil
from math import sqrt
t = int(input())
for _ in range(t):
	(l, n) = [int(p) for p in input().split()]
	j = ceil((sqrt(1 + 8 * n) - 1) / 2)
	covered = j * (j - 1) // 2
	toCover = n - covered
	suffix = [''] * (j + 1)
	suffix[0] = 'b'
	suffix[len(suffix) - toCover] = 'b'
	for i in range(len(suffix)):
		if suffix[i] != 'b':
			suffix[i] = 'a'
	s = ['a'] * (l - len(suffix)) + suffix
	print(''.join(s))


import bisect
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	l = []
	for i in range(n - 1):
		if i == 0:
			l.append(1)
		else:
			l.append(l[-1] + (i + 1))
	r = bisect.bisect_right(l, k)
	pos = k - l[r - 1]
	if pos == 0:
		d = r
		if r - 2 < 0:
			g = 1
		else:
			g = k - l[r - 2]
	else:
		d = r + 1
		if r - 2 < 0:
			g = 1
		else:
			g = k - l[r - 1]
	print('a' * (n - d - 1) + 'b' + 'a' * (n - g + 1 - (n - d + 1)) + 'b' + 'a' * (g - 1))


import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
from decimal import *

class Scanner:

	@staticmethod
	def int():
		return int(sys.stdin.readline().rstrip())

	@staticmethod
	def string():
		return sys.stdin.readline().rstrip()

	@staticmethod
	def map_int():
		return [int(x) for x in Scanner.string().split()]

	@staticmethod
	def string_list(n):
		return [input() for i in range(n)]

	@staticmethod
	def int_list_list(n):
		return [Scanner.map_int() for i in range(n)]

	@staticmethod
	def int_cols_list(n):
		return [int(input()) for i in range(n)]

class Math:

	@staticmethod
	def gcd(a, b):
		if b == 0:
			return a
		return Math.gcd(b, a % b)

	@staticmethod
	def lcm(a, b):
		return a * b // Math.gcd(a, b)

	@staticmethod
	def divisor(n):
		res = []
		i = 1
		for i in range(1, int(n ** 0.5) + 1):
			if n % i == 0:
				res.append(i)
				if i != n // i:
					res.append(n // i)
		return res

	@staticmethod
	def round_up(a, b):
		return -(-a // b)

	@staticmethod
	def is_prime(n):
		if n < 2:
			return False
		if n == 2:
			return True
		if n % 2 == 0:
			return False
		d = int(n ** 0.5) + 1
		for i in range(3, d + 1, 2):
			if n % i == 0:
				return False
		return True

class PriorityQueue:

	def __init__(self, l=[]):
		self.q = l
		heapq.heapify(self.q)
		return

	def push(self, n):
		heapq.heappush(self.q, n)
		return

	def pop(self):
		return heapq.heappop(self.q)

def pop_count(x):
	x = x - (x >> 1 & 6148914691236517205)
	x = (x & 3689348814741910323) + (x >> 2 & 3689348814741910323)
	x = x + (x >> 4) & 1085102592571150095
	x = x + (x >> 8)
	x = x + (x >> 16)
	x = x + (x >> 32)
	return x & 127
MOD = int(1000000000.0) + 7
INF = int(1000000000000000.0)

def main():
	T = Scanner.int()
	for t in range(T):
		(n, k) = Scanner.map_int()
		(a, b) = (0, 0)
		a = math.ceil(math.sqrt(1 + 8 * k)) // 2
		b = a - 1 - (a * (a + 1) // 2 - k)
		ans = ''
		for i in reversed(range(n)):
			if i == a or i == b:
				ans += 'b'
			else:
				ans += 'a'
		print(ans)
main()


from sys import stdin
from math import log2
from math import ceil
inp = stdin.readline
t = int(inp())
for i in range(t):
	(n, k) = [int(x) for x in inp().split()]
	array = ['a'] * n
	b1 = 2
	b2 = 0
	counter = 1
	counterToAdd = 0
	while True:
		if counter >= k:
			if counter > k:
				b1 -= 1
				counter -= counterToAdd
				break
			else:
				break
		else:
			counterToAdd += 1
			counter += counterToAdd
			b1 += 1
	array[-1 * b1] = 'b'
	array[-1 * (k - counter + 1)] = 'b'
	print(''.join(array))


tt = int(input())
while tt != 0:
	(n, k) = map(int, input().split())
	term = (pow(1 + 8 * k, 0.5) - 1) / 2
	if term == int(term):
		temp = term
	else:
		term = int(term) + 1
	c = term * (term - 1) // 2
	t = k - c - 1
	s = ''
	for i in range(n):
		if i == term:
			s += 'b'
		elif i == t:
			s += 'b'
		else:
			s += 'a'
	s = s[::-1]
	print(s)
	tt -= 1


import sys
input = sys.stdin.readline
for ti in range(int(input().strip())):
	(n, k) = [int(x) for x in input().strip().split()]
	ans = []
	b = 2
	while n:
		if n == b:
			for ni in range(n):
				ans.append('b')
			break
		elif not b:
			for ni in range(n):
				ans.append('a')
			break
		else:
			cnt = 1
			n -= 1
			for bi in range(b):
				cnt *= n - bi
			for bi in range(b):
				cnt //= bi + 1
			if k <= cnt:
				ans.append('a')
			else:
				ans.append('b')
				k -= cnt
				b -= 1
	print(''.join(ans))


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

class FastIO(IOBase):
	newlines = 0

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

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

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

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

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
n = int(input())
import math
for i in range(n):
	(a, b) = map(int, input().split())
	s = ['a'] * a
	e = math.ceil((-1 + (1 + 8 * b) ** 0.5) / 2)
	a1 = a - e - 1
	r = e * (e + 1) // 2
	a2 = a - e + r - b
	s[a1] = 'b'
	s[a2] = 'b'
	print(*s, sep='')


from sys import stdin
input = stdin.readline
import bisect
import math
for xoxo in range(1):
	a = [0, 1]
	xx = 2
	while a[-1] < 5 * 10 ** 9:
		a.append(a[-1] + xx)
		xx += 1
	for _ in range(int(input())):
		(n, k) = map(int, input().split())
		l = bisect.bisect_left(a, k)
		nn = k - a[l - 1] - 1
		s = ''
		for i in range(n - 1, -1, -1):
			if i == l or i == nn:
				print('b', end='')
				continue
			print('a', end='')
		print()


t = int(input())
for j in range(t):
	(n, k) = map(int, input().split())
	placeB = [0] * n
	for i in range(1, n):
		placeB[i] = i
	cur = 0
	ind = 1
	while cur < k:
		cur += placeB[ind]
		ind += 1
	ind -= 1
	cur -= placeB[ind]
	s = ['a'] * n
	s[n - 1 - ind] = 'b'
	for i in range(n - 1, n - ind - 1, -1):
		cur += 1
		if cur == k:
			s[i] = 'b'
			break
	print(''.join(s))


t = int(input())
for i in range(t):
	(n, k) = tuple([int(x) for x in input().split()])
	b = 1
	while True:
		if b * (b + 1) / 2 >= k:
			break
		else:
			b += 1
	s = []
	for i in range(n):
		if i == b or i == k - b * (b - 1) / 2 - 1:
			s.append('b')
		else:
			s.append('a')
	print(''.join(s[::-1]))


def solve():
	(n, k) = map(int, input().split())
	t = 0
	for i in range(n):
		t += i
		if k <= t:
			t -= i
			print('a' * (n - i - 1), end='')
			print('b', end='')
			j = 0
			while t + j < k:
				j += 1
			print('a' * (i - j), end='')
			print('b', end='')
			print('a' * (j - 1), end='')
			print()
			return
q = int(input())
for i in range(q):
	solve()


import math
t = int(input())
for x in range(t):
	(n, k) = [int(x) for x in input().split()]
	ans = (-1 + math.sqrt(1 + 8 * k)) / 2
	l = [0] * n
	ans = math.ceil(ans)
	temp = int(ans * (ans + 1) / 2)
	l[ans] = 1
	l[ans - (temp - k + 1)] = 1
	l = l[::-1]
	for x in range(len(l) - 1):
		if l[x] == 0:
			print('a', end='')
		else:
			print('b', end='')
	if l[len(l) - 1] == 0:
		print('a')
	else:
		print('b')


def kth(a, k):
	n = 1
	seq = []
	tot = 0
	while True:
		if (n * n - n) / 2 >= k:
			tot = (n * n - n) / 2
			break
		n += 1
	for i in range(a):
		if i == a - n or i == a - n + tot - k + 1:
			seq.append('b')
		else:
			seq.append('a')
	return ''.join(seq)
test_cases = [list(map(int, input().split())) for _ in range(int(input()))]
for t in test_cases:
	print(kth(t[0], t[1]))


for i in range(int(input())):
	(n, k) = map(int, input().split())
	s = 'a' * (n - 2) + 'bb'
	c = 1
	if k == 1:
		print(s)
		continue
	if k != 1:
		s = 'a' * (n - 3) + 'bab'
		c = c + 1
		if k == 2:
			print(s)
			continue
	t = 1
	while t * (t + 1) // 2 < k:
		t = t + 1
	if t * (t + 1) // 2 == k:
		print('a' * (n - 2 - t + 1) + 'bb' + 'a' * (t - 1))
		continue
	s = 'a' * (n - 2 - t + 1) + 'b' + 'a' * (t - 1) + 'b'
	c = t * (t - 1) // 2 + 1
	while c != k:
		p = n - 1
		h = 0
		while s[p - 1] != s[p]:
			s = s[0:p - 1] + s[p] + s[p - 1] + s[p + 1:]
			c = c + 1
			p = p - 1
			if c == k:
				h = 1
				break
		if h == 1:
			break
		else:
			s = s[0:p - 2] + s[p - 1] + s[p - 2] + s[p + 1:] + s[p]
			c = c + 1
			if c == k:
				break
	print(s)


rr = lambda : input().strip()
rri = lambda : int(rr())
rrm = lambda : map(int, rr().split())
T = rri()
for i in range(T):
	(n, k) = rrm()
	(s, x) = (1, 1)
	S = list('a' * n)
	while k > s:
		x += 1
		s = int(x * (x + 1) / 2)
	z = x + 1
	S[-z] = 'b'
	x = -x + s - k
	S[x] = 'b'
	S = ''.join(S)
	print(S)


def solve():
	(n, k) = map(int, input().split())
	ans = ['a'] * n
	(i, j) = (0, 0)
	while j < k:
		i += 1
		j += i
	if j > k:
		i -= 1
		m = k - i * (i + 1) // 2
		ans[n - i - 2] = 'b'
		ans[n - m] = 'b'
	else:
		ans[n - i - 1] = 'b'
		ans[n - i] = 'b'
	print(''.join(ans))
for _ in range(int(input())):
	solve()


t = int(input())

def comb(n, j):
	if j == 2:
		return n * (n - 1) // 2
	elif j == 1:
		return n
	else:
		return 10 ** 6
for i in range(t):
	(n, k) = list(map(int, input().split()))
	s = ''
	nb = 2
	for j in range(n - 1, -1, -1):
		if k <= comb(j, nb):
			s += 'a'
		else:
			s += 'b'
			k -= comb(j, nb)
			nb -= 1
	print(s)


from itertools import permutations
t = int(input())
while t != 0:
	(n, m) = map(int, input().split())
	B = 'a'
	A = list(B * n)
	k = 2
	i1 = m - int(k * (k - 1) / 2)
	while k * (k - 1) / 2 < m:
		i2 = m - int(k * (k - 1) / 2)
		if i2 < i1 and i2 > 0:
			i1 = i2
		k += 1
	A[-k] = 'b'
	if i1 == 0:
		A[-k + 1] = 'b'
	else:
		A[-i1] = 'b'
	print(''.join(A))
	t -= 1


import sys

def solve():
	t = int(input())
	for i in range(0, t):
		(n, k) = [int(x) for x in input().split()]
		str = ['a'] * n
		for j in range(2, n + 1):
			if (2 * k - j * j + 3 * j - 2) % 2 == 0:
				ii = int((2 * k - j * j + 3 * j - 2) / 2)
				if ii < j:
					str[n - j] = 'b'
					str[n - ii] = 'b'
					break
		for c in str:
			print(c, end='')
		print()

def main():
	solve()
main()


import math
F = lambda c: c * (c + 1) // 2

def find(n):
	x = int(math.sqrt(2 * n))
	cal = F(x)
	if cal > n:
		x -= 1
		cal = F(x)
	return [n - cal, x]
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	fi = find(k - 1)
	f3 = max(fi[0], 0)
	f2 = max(fi[1] - f3, 0)
	f1 = max(n - 2 - f2 - f3, 0)
	ans = 'a' * f1 + 'b' + 'a' * f2 + 'b' + 'a' * f3
	print(ans)


T = int(input())
for test_case in range(T):
	the_inputs = [int(x) for x in input().split()]
	N = the_inputs[0]
	K = the_inputs[1]
	first = 0
	prime = (2 * K + 1 / 4) ** (1 / 2) - 1 / 2
	if int(prime) == prime:
		first = int(prime)
	else:
		first = int(prime) + 1
	second = int(first - (first * (first + 1) / 2 - K) - 1)
	f_string = 'a' * N
	print_string = f_string[first + 1:] + 'b' + f_string[second + 1:first] + 'b' + f_string[:second]
	print(print_string)


results = ''
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	x = int((k * 2) ** 0.5)
	if x * (x + 1) >= k * 2:
		a = x
	else:
		a = x + 1
	x = a * (a + 1) // 2
	r = x - k
	line = 'a' * (n - a - 1) + 'b' + 'a' * r + 'b' + 'a' * (a - r - 1)
	results += line + '\n'
print(results[:-1])


import math
for _ in range(int(input())):
	(n, k) = [int(s) for s in input().split()]
	xyz = int(3 + math.sqrt(9 - 4 * (4 - 2 * k))) // 2
	x = (xyz - 1) * (xyz - 2) // 2 + 1
	ans = 'a' * (n - xyz)
	ans += 'b'
	ans += 'a' * (xyz + x - k - 2)
	ans += 'b'
	ans += 'a' * (k - x)
	print(ans)


import math

def kthstr(n, k):
	m = math.sqrt(1 + 8 * k)
	m += 1
	if m % 2 == 0:
		x = int(m // 2)
	else:
		x = int(m // 2 + 1)
	r = int(x * (x - 1) / 2)
	l = int((x - 2) * (x - 1) / 2)
	z = []
	for i in range(l + 1, r + 1):
		z.append(i)
	for i in range(len(z)):
		if z[i] == k:
			y = i + 1
			break
	s = ''
	for i in range(n, 0, -1):
		if i == x or i == y:
			s = s + 'b'
		else:
			s = s + 'a'
	return s
a = int(input())
for i in range(a):
	s = input()
	s = s.split()
	n = int(s[0])
	k = int(s[1])
	ans = kthstr(n, k)
	print(ans)


t = int(input())
for q in range(t):
	(n, k) = map(int, input().split())
	p = [0]
	for i in range(1, n):
		p.append(p[-1] + i)
		if p[-1] >= k:
			x = n - i - 1
			break
	y = n - (k - p[-2])
	print('a' * x, 'b', 'a' * (y - x - 1), 'b', 'a' * (n - y - 1), sep='')


n = int(input())
for i in range(n):
	(s, k) = map(int, input().split(' '))
	k = int(k)
	(j, sum) = (0, 1)
	while sum <= k:
		sum += j
		j += 1
	ans = ['a' for p in range(s)]
	(p, q) = (j, k - (sum - j))
	ans[-p] = 'b'
	ans[-q] = 'b'
	print(''.join((str(r) for r in ans)))


import bisect
T = int(input())
A = [0]
for i in range(1, 10 ** 5):
	A.append(A[-1] + i)
for t in range(T):
	(n, k) = [int(i) for i in input().split()]
	i = bisect.bisect_left(A, k)
	if A[i] == k:
		right = i
		left = i - 1
	elif A[i - 1] < k:
		right = i
		left = k - A[i - 1] - 1
	left = n - 1 - left
	right = n - 1 - right
	print('a' * right + 'b' + 'a' * (left - right - 1) + 'b' + 'a' * (n - left - 1))


import math

def solve():
	(n, k) = map(int, input().split())
	min_v = 1
	max_v = n
	i = max_v // 2
	block = -1
	inblock = -1
	while True:
		up = (1 + i) * i / 2
		down = i * (i - 1) / 2
		if k <= up and k > down:
			block = i
			inblock = k - down - 1
			break
		elif k > up:
			min_v = i
			i += (max_v - i) // 2
			if i == min_v:
				i += 1
		elif k <= down:
			max_v = i
			i -= (i - min_v) // 2
			if i == max_v:
				i -= 1
	first = int(n - 2 - block + 1)
	last2 = int(inblock)
	last1 = int(n - 2 - first - last2)
	print('a' * first + 'b' + 'a' * last1 + 'b' + 'a' * last2)

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


import math
t = int(input())
for x in range(t):
	(n, k) = map(int, input().split())
	n -= 2
	l1 = (math.sqrt(1 + 8 * k) - 1) / 2
	l = math.floor(l1)
	ans = ['a'] * (n + 2)
	d = k - l * (l + 1) / 2
	if d == 0:
		ans[n - l + 1] = 'b'
		ans[n - l + 2] = 'b'
	else:
		ans[n - l] = 'b'
		ans[n + 2 - int(d)] = 'b'
	print(''.join(ans))


import math
n = int(input())
for i in range(n):
	(n, k) = map(int, input().split())
	dir = int(math.ceil((math.sqrt(8 * k + 1) - 1) / 2))
	fir = n - (dir + 1)
	sec = n - (k - int(dir * (dir - 1) / 2))
	for i in range(n):
		if i == fir or i == sec:
			print('b', end='')
		else:
			print('a', end='')
	print()


for _ in range(int(input())):
	(N, K) = map(int, input().split())
	TOTAL = N * (N - 1) // 2
	Min = -1
	for j in range(1, 10 ** 5 + 1):
		Min = j * (j + 1) / 2
		if Min >= K:
			break
	posb = j * (j - 1) // 2
	posb = K - posb - 1
	first = N - j
	second = N - posb
	string = ''
	for i in range(1, N + 1):
		if i == second or i == first:
			string += 'b'
		else:
			string += 'a'
	print(string)


def main():
	t = int(input())
	for i in range(t):
		nums = list(map(int, input().split()))
		(n, k) = (nums[0], nums[1])
		bpos = n - 2
		ls = ['a'] * n
		summ = 1
		i = 1
		while summ < k:
			i += 1
			summ += i
			bpos -= 1
		ls[bpos] = 'b'
		offset = summ - k + 1
		ls[bpos + offset] = 'b'
		print(''.join(ls))
main()


t = int(input())
while t:
	(n, k) = map(int, input().split())
	l = []
	for i in range(n):
		l.append('a')
	for i in range(n - 2, -1, -1):
		if k <= n - i - 1:
			l[i] = 'b'
			l[n - k] = 'b'
			break
		else:
			k -= n - i - 1
	print(''.join(l))
	t = t - 1


x = int(input())
for a in range(0, x):
	y = input().split()
	for b in range(0, 2):
		y[b] = int(y[b])
	st = ['a'] * y[0]
	val = int((y[0] ** 2 - y[0]) / 2)
	i = round((y[1] * 2) ** 0.5)
	while i * (i + 1) < y[1] * 2:
		i += 1
	st[y[0] - 1 - i] = 'b'
	st[y[0] - i + (int(i * (i + 1) / 2) - y[1])] = 'b'
	print(''.join(st))


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	num = int((2 * b) ** 0.5)
	if num * (num + 1) // 2 > b:
		while num * (num + 1) // 2 > b:
			num -= 1
	if num * (num + 1) // 2 == b:
		print('a' * (a - num - 1) + 'b' * 2 + 'a' * (num - 1))
	else:
		k = b - num * (num + 1) // 2
		print('a' * (a - num - 2) + 'b' + 'a' * (num + 1 - k) + 'b' + 'a' * (k - 1))


import math
t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	x = n * (n - 1) // 2
	l = [1]
	i = 1
	while l[-1] < x:
		l.append(l[-1] + i)
		i += 1
	l.pop(-1)
	for i in range(n - 2, -1, -1):
		if k >= l[i]:
			print('a' * (n - i - 2) + 'b' + 'a' * (l[i] + i - k) + 'b' + 'a' * (k - l[i]))
			break


def compute_kth_string(n, k):
	base_str = []
	for _ in range(n):
		base_str.append('a')
	r = 0
	i = 1
	lb = n - 2
	while lb >= 0:
		r += i
		if r - k >= 0:
			rb = lb + (r - k) + 1
			base_str[lb] = 'b'
			base_str[rb] = 'b'
			return ''.join(base_str)
		lb -= 1
		i += 1
	return ''.join(base_str)

def run_alg():
	num_cases = int(input())
	for _ in range(num_cases):
		line_data = input().split(' ')
		n = int(line_data[0])
		k = int(line_data[1])
		print(compute_kth_string(n, k))
run_alg()


for i in range(int(input())):
	(n, k) = map(int, input().split())
	t1 = 0
	c1 = 0
	tmp1 = 0
	for i in range(2, n + 1):
		t1 = i - 1
		tmp1 = t1 * i / 2
		if tmp1 > k:
			c1 = 1
			break
		elif tmp1 == k:
			c1 = 0
			break
	if c1 == 1:
		z = t1 * (t1 - 1) / 2
		tr1 = int(k - z)
		t1 += 1
		t1 = n - t1
		tr1 = n - tr1
		for i in range(n):
			if i == t1 or i == tr1:
				print('b', end='')
			else:
				print('a', end='')
	else:
		tr1 = t1
		tr1 += 1
		tr1 = n - tr1
		for i in range(n):
			if i == tr1 or i == tr1 + 1:
				print('b', end='')
			else:
				print('a', end='')
	print()


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	ini = 1
	i = 0
	for i in range(n - 1):
		ini += i + 1
		if ini > k:
			break
	s = list('a' * n)
	s[n - i - 2] = 'b'
	s[n - i - 2 + ini - k] = 'b'
	print(''.join(map(str, s)))


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	k -= 1
	for i in range(1, n):
		if k - i < 0:
			break
		k -= i
	ans = ['a'] * n
	ans[i] = 'b'
	ans[k] = 'b'
	ans.reverse()
	print(''.join([item for item in ans]))


from math import *

def func(n, k):
	t = (-3 + sqrt(9 + 8 * k)) / 2
	t = ceil(t)
	x = k - t * (t + 1) // 2
	if x == 0:
		s = 'b' + 'b' + (t - 1) * 'a'
		s = 'a' * (n - t - 1) + s
		return s
	else:
		s = 'b'
		t = t + 1
		for i in range(t):
			if t - i == x:
				s = s + 'b'
			else:
				s = s + 'a'
		s = 'a' * (n - t - 1) + s
		return s
t = int(input())
for _ in range(t):
	s = list(map(int, input().split()))
	(n, k) = (s[0], s[1])
	print(func(n, k))


for _ in ' ' * int(input()):
	(n, k) = map(int, input().split())
	i = 1
	s = 1
	while s + i <= k:
		s += i
		i += 1
	string = list('a' * n)
	string[n - i - 1] = 'b'
	string[n - k + s - 1] = 'b'
	print(''.join(string))


def getstrings(n, k):
	first_b = -1
	last_b = -1
	for i in range(1, n - 1):
		left = 1 + i * (i + 1) / 2
		p = i + 1
		right = 1 + p * (p + 1) / 2
		if k == left:
			first_b = n - i - 2
			last_b = n - 1
			break
		elif k > left and k < right:
			first_b = n - i - 2
			last_b = n - (k - left) - 1
			break
	if k == 1:
		first_b = n - 1
		last_b = n - 2
	output = ''
	for i in range(n):
		if i == first_b or i == last_b:
			output = output + 'b'
		else:
			output = output + 'a'
	print(output)

def main():
	t = int(input())
	while t > 0:
		(n, k) = map(int, input().split())
		getstrings(n, k)
		t = t - 1
main()


import sys
from random import choice, randint
inp = sys.stdin.readline
out = sys.stdout.write
flsh = sys.stdout.flush
sys.setrecursionlimit(10 ** 9)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def MI():
	return map(int, inp().strip().split())

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

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines().strip()]

def LI_():
	return [int(x) - 1 for x in inp().strip().split()]

def LF():
	return [float(x) for x in inp().strip().split()]

def LS():
	return inp().strip().split()

def I():
	return int(inp().strip())

def F():
	return float(inp().strip())

def S():
	return inp().strip()

def pf(s):
	return out(s + '\n')

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))

def main():
	t = I()
	l = []
	for _ in range(t):
		(n, k) = MI()
		s = 'a' * (n - 2) + 'bb'
		if k == 1:
			print(s)
		else:
			seg = 1
			s = 0
			for i in range(1, k + 1):
				s += i
				if k <= s:
					seg = i
					break
			s -= seg
			s += 1
			if k == s:
				ans = 'a' * (n - 2 - (seg - 1)) + 'b' + 'a' * (seg - 1) + 'b'
			else:
				shift = k - s
				ans = 'a' * (n - 2 - (seg - 1)) + 'b' + 'a' * (seg - 1 - shift) + 'b' + 'a' * shift
			print(ans)
main()


from math import *
from sys import stdin, stdout
from time import time

def invNatSum(n):
	return floor((-1 + sqrt(1 + 8 * n)) / 2)

def natSum(n):
	return n * (n + 1) / 2
t = int(stdin.readline())
for w in range(t):
	(n, k) = [int(x) for x in stdin.readline().split()]
	q = ['a' for i in range(n)]
	if k == 1:
		q[-1] = 'b'
		q[-2] = 'b'
	else:
		k -= 1
		b = invNatSum(k)
		c = k - natSum(b)
		q[int(-2 - b)] = 'b'
		q[int(-c - 1)] = 'b'
	ans = ''.join(q)
	stdout.write(ans + '\n')


def slove():
	(n, k) = map(int, input().split())
	summ = 0
	k -= 1
	i = 0
	s = ''
	while i >= 0:
		if summ + i + 1 > k:
			break
		summ = summ + i + 1
		i += 1
	k -= summ
	i += 1
	for j in range(n):
		if j == n - i - 1 or j == n - k - 1:
			s += 'b'
		else:
			s += 'a'
	print(s)

def main():
	t = int(input())
	while t > 0:
		slove()
		t -= 1
main()


def cal(n, k):
	first = 1
	while k > first:
		k -= first
		first += 1
	return 'a' * (n - first - 1) + 'b' + (first - k) * 'a' + 'b' + (k - 1) * 'a'
t = int(input())
for i in range(t):
	(_n, _k) = [int(x) for x in input().split()]
	print(cal(_n, _k))


from math import sqrt
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	a = sqrt(2 * k)
	a = int(a)
	while a * (a + 1) // 2 >= k:
		a -= 1
	a += 1
	b = k - a * (a - 1) // 2
	a += 1
	s = 'a' * (n - a) + 'b' + 'a' * (a - b - 1) + 'b' + 'a' * (b - 1)
	print(s)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	total = n * (n - 1) / 2
	b_string = ['a'] * n
	i = 1
	while k > 0:
		if k - i > 0:
			k = k - i
		else:
			break
		i += 1
	b_1 = n - 2 - (i - 1)
	b_2 = n - 1 - k + 1
	b_string[b_1] = 'b'
	b_string[b_2] = 'b'
	print(''.join(b_string))


from math import ceil, sqrt
n = int(input())
for i in range(n):
	(n, k) = map(int, input().split())
	w = ceil((sqrt(8 * k - 1) - 1) / 2)
	p = w * (w + 1) // 2
	b = p - w + 1
	index = w - (k - b) - 1
	ans = ['a' for j in range(n - w - 1)]
	ans.append('b')
	ans.append('a' * index)
	ans.append('b')
	ans.append('a' * (w - index - 1))
	print(*ans, sep='')


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	poslb = 0
	posrb = 0
	not_found = True
	for j in range(n):
		if k <= j * (j + 1) / 2 and not_found:
			poslb = n - (j + 1)
			posrb = j * (j - 1) // 2 - k
			not_found = False
	resposta = ['a'] * n
	resposta[int(poslb)] = 'b'
	resposta[int(posrb)] = 'b'
	rf = ''
	for j in range(n):
		rf += resposta[j]
	print(rf)


t = int(input())
for i in range(0, t):
	(n, k) = [int(x) for x in input().split()]
	index_first_b = -2
	for j in range(1, n):
		Sn = j * (j + 1) // 2
		if Sn >= k:
			break
		index_first_b = index_first_b - 1
	index_first_b = index_first_b + n
	index_gap = Sn - k
	index_sec_b = index_first_b + index_gap + 1
	x = []
	for k in range(0, n):
		x.append('a')
	x[index_first_b] = 'b'
	x[index_sec_b] = 'b'
	print(*x, sep='')


import math
test = int(input())
test_arr = []
for _ in range(test):
	(n, k) = map(int, input().split(' '))
	a = 1
	b = -1
	c = 2 * k
	d = b ** 2 - 4 * a * c
	d = abs(d)
	a1 = (-b - math.sqrt(d)) // 2 * a
	a2 = (-b + math.sqrt(d)) // 2 * a
	sol = int(max(a1, a2))
	term = (sol - 1) * sol // 2
	string = 'a' * n
	new_string = string[:n - sol - 1] + 'b' + string[n - sol:n - int(k - term)] + 'b' + string[n - int(k - term) + 1:]
	test_arr.append(new_string)
for t in test_arr:
	print(t)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	(l, r) = (0, 100000.0)
	while l < r - 1:
		m = (l + r) // 2
		if m * (m + 1) < 2 * k:
			l = m
		else:
			r = m
	res = (n - l - 1, n - k + l * (l + 1) // 2 + 1)
	s = []
	for i in range(1, n + 1):
		if i == res[0] or i == res[1]:
			s.append('b')
		else:
			s.append('a')
	print(''.join(s))


import math
t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	a = int(math.sqrt(2 * k))
	if a * (a + 1) // 2 < k:
		a += 1
	i1 = n - 1 - a
	i2 = i1 + 1 + a * (a + 1) // 2 - k
	s = 'a'
	if i1 == 0:
		s = 'b'
	for j in range(1, n):
		if j == i1 or j == i2:
			s += 'b'
		else:
			s += 'a'
	print(s)


import os
import heapq
import sys, threading
import math as mt
import operator
from copy import copy
from collections import defaultdict, deque
from io import BytesIO, IOBase
sys.setrecursionlimit(10 ** 5)

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

def inpt():
	return [int(k) for k in input().split()]

def main():
	for _ in range(int(input())):
		(n, k) = inpt()
		(sm, ct) = (0, 0)
		ans = ''
		for i in range(n - 1, 0, -1):
			ct += 1
			sm += ct
			if sm >= k:
				sm -= ct
				ans += 'a' * (i - 1)
				ans += 'b'
				temp = ''
				for j in range(n, i, -1):
					sm += 1
					if sm == k:
						temp = 'b' + temp
					else:
						temp = 'a' + temp
				ans += temp
				ans += 'a' * (n - len(ans))
				break
		print(ans)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

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

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

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

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

class IOWrapper(IOBase):

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


def solve():
	(n, k) = map(int, input().split())
	total = 0
	for i in range(1, n):
		total += i
		if total >= k:
			break
	pos1 = n - i
	pos2 = pos1 + 1 + (total - k)
	for i in range(1, pos1):
		print('a', end='')
	print('b', end='')
	for i in range(pos1 + 1, pos2):
		print('a', end='')
	print('b', end='')
	for i in range(pos2 + 1, n + 1):
		print('a', end='')
	print()

def main():
	t = int(input())
	for i in range(0, t):
		solve()
main()


import math
t = int(input())
for _ in range(t):
	(n, k) = (int(i) for i in input().split())
	N = math.ceil((-1 + (1 + 8 * k) ** (1 / 2)) / 2)
	ans = []
	m = N * (N + 1) // 2
	if m == k:
		for i in range(0, n):
			if i == N - 1 or i == N:
				ans.append('b')
				continue
			ans.append('a')
	else:
		mp = N - (m - k + 1)
		for i in range(0, n):
			if i == N or i == mp:
				ans.append('b')
				continue
			ans.append('a')
	for i in range(n - 1, -1, -1):
		print(ans[i], end='')
	print()


def solve():
	(n, k) = map(int, input().split())
	s = ['a'] * n
	for i in range(n - 2, -1, -1):
		if k <= n - i - 1:
			s[i] = 'b'
			s[n - k] = 'b'
			return ''.join(s)
		k -= n - i - 1
for i in range(int(input())):
	print(solve())


from math import sqrt
for _t in range(int(input())):
	(n, k) = map(int, input().strip().split())
	x = int((sqrt(8 * k + 1) - 1) // 2)
	m = int(x * (x + 1) // 2)
	if m == k:
		y = x - 1
	else:
		y = k - m - 1
		x += 1
	s = n * ['a']
	s[-x - 1] = s[-y - 1] = 'b'
	print(''.join(s))


def permutacoes(n, k):
	s = 'a' * n
	s = list(s)
	max = int(n * (n - 1) / 2)
	for i in range(n - 1, -1, -1):
		if k <= max:
			k += i
		else:
			index1 = n - i - 2
			index2 = n - (k - max)
			break
	s[index1] = 'b'
	s[index2] = 'b'
	return ''.join(s)

def main():
	t = int(input())
	for i in range(t):
		entrada = input()
		entrada = entrada.split(' ')
		n = int(entrada[0])
		k = int(entrada[1])
		print(permutacoes(n, k))
main()


for i in range(int(input())):
	(x, y) = map(int, input().split())
	p = 1
	i = 2
	a = ['a'] * x
	while y > p:
		p = p + i
		i += 1
	s = y - (p - (i - 1))
	a[-i] = 'b'
	a[-s] = 'b'
	print(''.join(a))


for _ in range(int(input())):
	(n, k) = map(int, input().split(' '))
	ans = ['a'] * n
	count = 0
	pos = n - 1
	while True:
		val = (pos - 1) * pos // 2
		if k > val:
			k -= val + 1
			ans[pos] = 'b'
			ans[k] = 'b'
			break
		pos -= 1
	print(*ans[::-1], sep='')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	l = 1
	while l < k:
		k -= l
		l += 1
	res = 'a' * (n - l - 1) + 'b' + 'a' * (l - k) + 'b' + 'a' * (k - 1)
	print(res)


from math import *
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	s = ['a'] * n
	for i in range(n - 2, -1, -1):
		c = n - i - 1
		if c >= k:
			s[i] = 'b'
			s[n - k] = 'b'
			break
		else:
			k = k - c
	e = ''
	print(e.join(s))


import math

class Read:

	@staticmethod
	def string():
		return input()

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

	@staticmethod
	def list(sep=' '):
		return input().split(sep)

	@staticmethod
	def list_int(sep=' '):
		return list(map(int, input().split(sep)))

def solve():
	(n, k) = Read.list_int()
	d = math.floor(math.floor(math.sqrt(1 + 8 * (k - 1)) + 1) / 2)
	i1 = n - d - 1
	t = d * (d - 1) / 2 + 1
	i2 = n - (k - t) - 1
	res = ''
	for i in range(n):
		if i == i1 or i == i2:
			res += 'b'
		else:
			res += 'a'
	print(res)
query_count = Read.int()
while query_count:
	query_count -= 1
	solve()


x = int(input())
for i in range(x):
	(n, y) = map(int, input().split())
	if y > 1000000007:
		j = (pow(8 * y, 1 / 2) - 1) / 2
	else:
		j = (pow(1 + 8 * y, 1 / 2) - 1) / 2
	i = int(j)
	if i * (i + 1) == 2 * y:
		y = i
		i = i - 1
	else:
		y = y - i * (i + 1) // 2
	if i > 1000000007:
		i = i % 1000000007
	ak = n - y
	bk = n - i - 2
	h = ''
	for i in range(n):
		if i == ak or i == bk:
			h += 'b'
		else:
			h += 'a'
	print(h)


from sys import stdin
import math
import operator as op
from functools import reduce

def ncr(n, r):
	r = min(r, n - r)
	numer = reduce(op.mul, range(n, n - r, -1), 1)
	denom = reduce(op.mul, range(1, r + 1), 1)
	return numer // denom
inp = lambda : stdin.readline().strip()
t = int(inp())
for _ in range(t):
	c = 1
	c2 = 1
	c3 = 0
	ans = 0
	pos = 0
	(n, k) = [int(x) for x in inp().split()]
	for i in range(n * (n - 1) // 2):
		if k < c:
			break
		else:
			ans = c
			pos = c3
		c += c2
		c2 += 1
		c3 += 1
	b1 = n - pos - 1
	b2 = n - (k - ans)
	string = []
	for i in range(n):
		if i == b1 - 1 or i == b2 - 1:
			string.append('b')
		else:
			string.append('a')
	print(''.join(string))


from math import factorial
for ii in range(int(input())):
	(n, k) = map(int, input().split())
	ans = ['a'] * n
	for i in range(n - 2, -1, -1):
		if k <= n - i - 1:
			ans[i] = 'b'
			ans[n - k] = 'b'
			break
		k -= n - i - 1
	for i in ans:
		print(i, end='')
	print()


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	a = (1 + (1 + 8 * k) ** 0.5) / 2
	if a == int(a):
		b = int(a) - 1
	else:
		b = int(a)
	c = b * (b + 1) // 2
	x = 'a' * (n - b - 1) + 'b' + 'a' * (c - k) + 'b' + 'a' * (b - 1 - c + k)
	print(x)


memo = [0 for i in range(100005)]
for i in range(1, 100005):
	memo[i] = memo[i - 1] + i
t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	l = 0
	r = n
	s = ''
	while l < r:
		mid = (l + r) // 2
		if memo[mid] >= k:
			r = mid
		elif memo[mid] < k:
			l = mid + 1
	pb = r
	sb = k - memo[r - 1] - 1
	s += 'a' * (n - pb - 1)
	s += 'b'
	s += 'a' * (pb - sb - 1)
	s += 'b'
	s += 'a' * sb
	print(s)


def get(*arg):
	if arg[0] == 0:
		cnt = int(input())
		flag = 1
	else:
		cnt = 1
		flag = 0
	lst = list()
	for i in range(cnt):
		lst2 = list()
		for ii in range(len(arg) - flag):
			if arg[ii + flag] == 1:
				t = input().split()
				tmp = list()
				for iii in t:
					tmp.append(int(iii))
			elif arg[ii + flag] == 2:
				tmp = input().split()
			else:
				tmp = input()
			lst2.append(tmp)
		lst.append(lst2)
	return lst
import math
a = get(0, 1)
for i in a:
	n = i[0][0]
	k = i[0][1]
	t = int(math.sqrt(k * 2)) - 1
	tt = t * (t - 1) // 2
	while tt < k:
		t += 1
		tt = t * (t - 1) // 2
	t -= 1
	res = ['a' for i in range(n)]
	res[n - t - 1] = 'b'
	res[n - (t - tt + k)] = 'b'
	print(''.join(res))


def ceil(a):
	if a // 1 == a:
		return int(a)
	else:
		return int(a) + 1

def findRoots(a, b, c):
	if a == 0:
		print('Invalid')
		return -1
	d = b * b - 4 * a * c
	sqrt_val = abs(d) ** 0.5
	return ceil((-b - sqrt_val) / (2 * a))
for _ in range(int(input())):
	(n, k) = list(map(int, input().split()))
	u = n * (n - 1) // 2
	u += 1
	r = n - 1
	fi = findRoots(1, 1 - 2 * n, 2 * (u - k))
	f = k - (u - (n * fi - fi * (fi + 1) // 2))
	s = ['a'] * n
	s[fi - 1] = 'b'
	s[n - f - 1] = 'b'
	print(''.join(s))


res = []
t = int(input())
for i in range(t):
	(n, k) = [int(x) for x in input().split()]
	curr = 1
	plus = 2
	while curr < k:
		curr += plus
		plus += 1
	index_1 = n - plus
	index_2 = index_1 + 1 + (curr - k)
	curr = 'a' * n
	curr = curr[:index_1] + 'b' + curr[index_1 + 1:]
	curr = curr[:index_2] + 'b' + curr[index_2 + 1:]
	res.append(curr)
for item in res:
	print(item)


from math import ceil, sqrt
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = ['a'] * n
	x = n - ceil((1 + sqrt(1 + 8 * k)) / 2)
	s[x] = 'b'
	x += 1
	b = n - x
	x1 = b * (b - 1) // 2
	b1 = n - k + x1
	s[b1] = 'b'
	print(''.join(s))


for tt in range(int(input())):
	(n, k) = input().split()
	(n, k) = (int(n), int(k))
	l = ['a'] * n
	for i in range(n - 2, -1, -1):
		if k <= n - 1 - i:
			l[i] = 'b'
			l[n - k] = 'b'
			break
		k -= n - i - 1
	for j in l:
		print(j, end='')
	print()


test_cases = int(input())
for z in range(test_cases):
	(n, k) = map(int, input().split())
	a = 0
	b = 0
	for i in range(n * (n - 1) // 2):
		a += 1
		c = b
		b += a
		if b >= k:
			b1 = n - a - 1
			b2 = n - k + c
			print('a' * b1 + 'b' + 'a' * (b2 - b1 - 1) + 'b' + 'a' * (n - 2 - b1 - (b2 - b1 - 1)))
			break


m = int(input())
for i in range(m):
	(n, k) = map(int, input().split())
	o = ['a'] * (n - 2)
	level = n * (n - 1) // 2 - k + 1
	(lower, upper) = (None, 0)
	for i in range(n - 1):
		lower = upper
		upper += n - 1 - i
		if lower <= level <= upper:
			o.insert(i, 'b')
			o.insert(level - lower + i, 'b')
			print(''.join(o))
			break


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	sm = 0
	for i in range(1, n):
		if k <= sm + i:
			x = i + 1
			break
		sm += i
	y = k - sm
	y = n - y
	x = n - x
	s = ''
	for i in range(n):
		if i == x or i == y:
			s += 'b'
		else:
			s += 'a'
	print(s)


t = int(input())

def cal(x):
	return x * (1 + x) // 2

def Bsearch(l, r, x):
	ans = -1
	while l <= r:
		mid = (l + r) // 2
		if cal(mid) >= x:
			ans = mid
			r = mid - 1
		else:
			l = mid + 1
	return ans
while t:
	t -= 1
	(n, k) = input().split()
	(n, k) = (int(n), int(k))
	s = list('a' * n)
	ans = Bsearch(1, int(100000.0), k)
	tmp = cal(ans) - k
	tmp = ans - tmp - 1
	s[ans] = 'b'
	s[tmp] = 'b'
	s.reverse()
	print(''.join(s))


from math import *
from copy import *
from string import *
from random import *
from bisect import *
from sys import stdin
from sys import maxsize
from operator import *
from itertools import *
from collections import Counter
from collections import defaultdict

def solve(n, k):
	ans = ['a'] * n
	i = (sqrt(1 + 8 * k) - 1) / 2
	if k == 1:
		i = 1
	zz = 0
	if int(i) != i:
		i = ceil(i)
		zz = (i + 1) * i // 2
	else:
		i = int(i)
		zz = i * (i + 1) // 2
	b = i - (zz - k) - 1
	ans[i] = ans[b] = 'b'
	return ''.join(ans)[::-1]
T = int(input())
for _ in range(T):
	(N, K) = list(map(int, stdin.readline().rstrip().split()))
	print(solve(N, K))


from bisect import *
l = [1]
for x in range(2, 100000):
	l.append(l[-1] + x)
l1 = set(l)
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	st = list('a' * a)
	if b not in l1:
		j = bisect_left(l, b)
		t2 = j + 1
		st[t2] = 'b'
		t1 = b - l[j - 1] - 1
		st[t1] = 'b'
		st = st[::-1]
	else:
		j = l.index(b)
		st[j] = 'b'
		st[j + 1] = 'b'
		st = st[::-1]
	print(''.join(st))


import sys, bisect
from math import gcd
input = sys.stdin.readline

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

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

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

def invr():
	return map(int, input().rstrip().split())
t = inp()
for _ in range(t):
	(n, k) = invr()
	ans = ['' for i in range(n)]
	sec = 0
	for i in range(1, n):
		if k <= i * (i + 1) // 2:
			sec = i
			break
	exc = k - (sec - 1) * sec // 2 - 1
	first = n - 1 - sec
	second = n - 1 - exc
	ans[first] = 'b'
	ans[second] = 'b'
	for i in range(n):
		if ans[i] != 'b':
			ans[i] = 'a'
	print(''.join(ans))


t = int(input())
for queries in range(t):
	(n, k) = list(map(int, input().split()))
	m = int(3 / 2 + (2 * k - 7 / 4) ** 0.5)
	p = k - (m - 1) * (m - 2) // 2
	print((n - m) * 'a' + 'b' + (m - p - 1) * 'a' + 'b' + (p - 1) * 'a')


t = input()
for _ in range(int(t)):
	a = input()
	a = a.split()
	n = int(a[0])
	k = int(a[1])
	my_str = ['a'] * n
	temp = int((1 + 8 * k) ** 0.5)
	cycle = (temp - 1) // 2
	if not temp * temp == 1 + 8 * k:
		cycle += 1
	my_str[len(my_str) - 1 - cycle] = 'b'
	cycle = cycle * (cycle + 1) // 2
	i = my_str.index('b')
	my_str[i + cycle - k + 1] = 'b'
	s = ''
	s = s.join(my_str)
	print(s)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	(lo, hi, ans) = (1, n - 1, 1)
	while lo <= hi:
		mid = (lo + hi) // 2
		if mid * (mid + 1) // 2 <= k:
			ans = mid
			lo = mid + 1
		else:
			hi = mid - 1
	k = k - ans * (ans + 1) // 2
	l = ['a'] * n
	if k == 0:
		l[-ans - 1] = 'b'
		l[-ans] = 'b'
	else:
		l[-ans - 2] = 'b'
		l[-k] = 'b'
	print(''.join(l))


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	k = (n - 1) * n // 2 - k
	cnt = 0
	pos1 = 0
	for i in range(n):
		if cnt + (n - 1 - i) > k:
			pos1 = i
			break
		cnt += n - 1 - i
	print('a' * pos1 + 'b' + 'a' * (k - cnt) + 'b' + 'a' * (n - 2 - (pos1 + (k - cnt))))


import math
for i in range(int(input())):
	(n, k) = list(map(int, input().split()))
	have = 0
	steps = 1
	while True:
		if have < k:
			have += steps
			steps += 1
		else:
			break
	sum = int((2 + 1 * (steps - 3)) * (steps - 2) / 2)
	out = ['a'] * n
	out[n - steps] = 'b'
	out[n - (k - sum)] = 'b'
	print(''.join(out))


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	totmax = n * (n - 1) / 2
	find = int(((8 * k - 7) ** 0.5 + 1) / 2)
	string = ''
	for i in range(n - find - 1):
		string = string + 'a'
	string = string + 'b'
	high = int(find * (find + 1) / 2 + 1)
	for i in range(high - k - 1):
		string = string + 'a'
	string = string + 'b'
	for i in range(find - high + k):
		string = string + 'a'
	print(string)


import sys
input = sys.stdin.readline
from collections import *
from math import *
t = int(input())
while t:
	t -= 1
	(n, k) = map(int, input().split())
	if k == n * (n - 1) // 2:
		print('b' * 2 + 'a' * (n - 2))
		continue
	if k == 1:
		print('a' * (n - 2) + 'bb')
		continue
	d = 1 + 4 * k * 2
	d = pow(d, 0.5)
	r = -1 + d
	r = r / 2
	r = ceil(r)
	s = 'a' * (n - r - 1) + 'b'
	ch = r * (r - 1) // 2
	ch = k - ch
	r1 = 'a' * (ch - 1) + 'b'
	r1 += 'a' * (n - (len(r1) + len(s)))
	s = s + r1[::-1]
	print(s)


import sys, os
from io import BytesIO, IOBase
import collections, itertools, bisect, heapq, math, string
BUFSIZE = 8192
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 main():
	t = int(input())
	for i in range(t):
		nk = list(map(int, input().split()))
		(n, k) = (nk[0], nk[1])
		ans = ['a'] * n
		(x, y) = (n - 2, n - 1)
		m = 1
		while True:
			if k - m <= 0:
				break
			k = k - m
			m = m + 1
		ans[x + 1 - m] = 'b'
		if m == k:
			ans[x + 2 - m] = 'b'
		else:
			ans[y - k % m + 1] = 'b'
		print(''.join(ans))
main()


arr = [0, 1, 3]
i = 4
while True:
	nth = i * (i - 1) // 2
	if nth > 2 * 1000000000.0:
		arr.append(nth)
		break
	arr.append(nth)
	i += 1
t = int(input())
for _ in range(t):
	(n, k) = list(map(int, input().split()))
	string = ['a'] * n
	chunk_no = -1
	for i in range(len(arr)):
		if arr[i] >= k:
			chunk_no = i
			break
	left_b = n - 1 - chunk_no
	right_b = k - arr[chunk_no - 1]
	string[left_b] = 'b'
	string[-right_b] = 'b'
	print(''.join(string))


import math

def solve():
	(n, k) = map(int, input().split())
	m = int(math.ceil(math.sqrt(2 * k + 0.25) - 0.5))
	ans = ['a'] * n
	ans[-m - 1] = 'b'
	i = int((m + 1) * m / 2) - k
	ans[-m + i] = 'b'
	print(*ans, sep='')
T = int(input())
for _ in range(T):
	solve()


def heart(x):
	temp = x
	val = 1
	while temp > 0:
		temp -= val
		val += 1
	start = x - temp - (val - 2)
	return (val, start)
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = 'a' * n
	(first, begin) = heart(k)
	last = k - begin + 1
	s = s[:n - first] + 'b' + s[n - first + 1:n - last] + 'b' + s[n - last + 1:]
	print(s)


import math

def s_2(n):
	z = 1000000007
	n1 = math.sqrt(1 + 8 * n) - 1
	m = math.ceil(n1 / 2)
	m1 = m - 1
	w = int(m1 * (m1 + 1) / 2)
	n2 = n - w - 1
	return (m, n2)
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	(x1, x2) = s_2(k)
	x1 = n - x1 - 1
	x2 = n - x2 - 1
	for i in range(n):
		if i == x1 or i == x2:
			print('b', end='')
		else:
			print('a', end='')
	print()


t = int(input())
for _ in range(t):
	(n, k) = [int(x) for x in input().split()]
	x = int((-1 + (1 + 8 * k) ** 0.5) / 2)
	if k == (1 + x) * x // 2:
		y = x - 1
	else:
		y = k - (1 + x) * x // 2 - 1
		x += 1
	ans = ['a'] * n
	ans[x] = 'b'
	ans[y] = 'b'
	ans.reverse()
	print(''.join(ans))


import math

def func(N, k):
	n = math.ceil(((1 + 8 * k) ** 0.5 - 1) / 2)
	(x, y) = (int(n) + 1, int(k - n * (n - 1) / 2))
	s = ['a'] * N
	(s[-1 * y], s[-1 * x]) = ('b', 'b')
	print(''.join(s))
for i in range(int(input())):
	(n, k) = list(map(int, input().split()))
	func(n, k)


from sys import stdin, stdout
t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	x = int(((8 * k) ** 0.5 + 1) // 2)
	y = x * (x - 1) // 2
	stdout.write('a' * (n - x - 1) + 'b' + 'a' * (x - k + y) + 'b' + 'a' * (k - y - 1) + '\n')


t = int(input())

def first_pos(k):
	(i, pos, add) = (1, 1, 2)
	while i < k:
		pos += 1
		i += add
		add += 1
	return pos
for i in range(t):
	(n, k) = map(int, input().split())
	if k == 1:
		print((n - 2) * 'a' + 'bb')
		continue
	if k == 2:
		print((n - 3) * 'a' + 'b' + 'a' + 'b')
		continue
	if k == 3:
		print((n - 3) * 'a' + 'bb' + 'a')
		continue
	fp = first_pos(k)
	final_one = n - fp - 1
	(starting_pos, to_add) = (2, 2)
	for j in range(fp - 2):
		starting_pos += to_add
		to_add += 1
	second_pos = k - starting_pos
	final_two = n - second_pos - 1
	ans = ''
	for j in range(n):
		if j == final_one or j == final_two:
			ans += 'b'
		else:
			ans += 'a'
	print(ans)


t = int(input())
for _ in range(t):
	[n, k] = [*map(int, input().split())]
	r = n - 1
	l = 0
	mid = 0
	prev = 0
	while l <= r:
		mid = l + (r - l) // 2
		pos = mid * (mid + 1) // 2
		prev = mid * (mid - 1) // 2
		if pos >= k:
			if prev < k:
				l = r + 1
			else:
				r = mid - 1
		else:
			l = mid + 1
	diff = k - prev - 1
	res = ['b' if i == diff or i == mid else 'a' for i in range(n)]
	print(''.join(res[::-1]))


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	(m, pos) = (0, 0)
	while pos < k:
		m += 1
		pos += m
	print('a' * (n - m - 1) + 'b' + 'a' * (pos - k) + 'b' + 'a' * (n - (n - m - 1) - (pos - k) - 2))


import math
L = lambda : list(map(int, input().split()))
M = lambda : map(int, input().split())
I = lambda : int(input())
t = I()
for i in range(t):
	(n, k) = M()
	i = 1
	c = 0
	x = 0
	while k > x:
		x += i
		i += 1
		c += 1
	B = x - k + 1
	A = n - c
	B = A + B
	print('a' * (A - 1) + 'b' + 'a' * (B - A - 1) + 'b' + 'a' * (n - B))


a = int(input())
for _ in range(a):
	(n, k) = map(int, input().split())
	ar = ['a'] * n
	v = 1
	g = 1
	for i in range(2, n + 1):
		g += i
		v += 1
		if g > k:
			break
	if g - v == k:
		ar[n - v] = 'b'
		ar[n - v + 1] = 'b'
	else:
		ar[n - 1 - v] = 'b'
		ar[n - 1 - v + (g - k) + 1] = 'b'
	for i in range(n):
		print(ar[i], end='')
	print()


a = []
i = 1
j = 0
while i <= 10000000000.0 + 5:
	i += j
	a.append(i)
	j += 1
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	ans = ['a'] * n
	j = 0
	while k >= a[j]:
		j += 1
	d = k - a[j - 1]
	ans[-d - 1] = 'b'
	ans[-j - 1] = 'b'
	print(''.join(ans))


import sys
import math
get_string = lambda : sys.stdin.readline().strip()
get_int_list = lambda : list(map(int, sys.stdin.readline().strip().split()))
get_int = lambda : int(sys.stdin.readline())
for _ in range(get_int()):
	(n, k) = get_int_list()
	i = 1
	while i * (i + 1) // 2 < k:
		i += 1
	if i * (i + 1) // 2 % k == 0:
		a = -i - 1
		b = a + 1
	else:
		a = -i - 1
		b = k - (i - 1) * i // 2
		b = -b
	res = list('a' * n)
	res[a] = 'b'
	res[b] = 'b'
	print(''.join(res))


import math
for _ in [0] * int(input()):
	(n, k) = map(int, input().split())
	i = math.ceil(((8 * k + 1) ** 0.5 - 1) / 2)
	r = ['a'] * n
	r[-i - 1] = r[i * (i - 1) // 2 - k] = 'b'
	print(''.join(r))


t = int(input())

def binom2(x):
	return x * (x - 1) // 2
for _ in range(t):
	(n, k) = tuple(map(int, input().split()))
	for x in range(1, n):
		if binom2(x) + 1 <= k and k <= binom2(x) + x:
			value = ['a' for _ in range(n)]
			value[n - 1 - x] = 'b'
			value[n - 1 - k + binom2(x) + 1] = 'b'
			print(''.join(value))


t = int(input())
summ = 1
pref = []
for i in range(1, 100001):
	pref.append(summ)
	summ += i
for i in range(t):
	(a, b) = map(int, input().split())
	left = 0
	right = a
	while left != right - 1:
		middle = (left + right) // 2
		if pref[middle] > b:
			right = middle
		else:
			left = middle
	print('a' * (a - 2 - left) + 'b' + 'a' * (pref[right] - b - 1) + 'b' + 'a' * (b - pref[left]))


def main():
	t = int(input())
	while t != 0:
		lst = list(map(int, input().strip().split()))
		n = lst[0]
		k = lst[1]
		count = 1
		sum = 0
		while sum < k:
			sum += count
			count += 1
		sum -= count
		count -= 1
		res = ''
		if n - count - 1 != 0:
			for i in range(0, n - count - 1):
				res += 'a'
			i += 1
		else:
			i = 0
		res += 'b'
		summation = count * (count - 1) // 2
		k -= summation
		for j in range(i + 1, n):
			if j == n - k:
				res += 'b'
			else:
				res += 'a'
		print(res)
		t -= 1
main()


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	pointer = 1
	currPos = 1
	prev = 1
	while True:
		if k <= currPos:
			break
		pointer += 1
		prev = currPos
		currPos += pointer
	secondElement = k - (prev + 1) if k != 1 else 0
	firstElement = pointer - 1
	if firstElement == 0 and secondElement == 0:
		print('a' * (n - 2) + 'bb')
	elif firstElement > 0 and secondElement == 0:
		print('a' * (n - 2 - firstElement) + 'b' + 'a' * (n - 2 - (n - 2 - firstElement)) + 'b')
	else:
		print('a' * (n - 2 - firstElement) + 'b' + 'a' * (n - 2 - (n - 2 - firstElement) - secondElement) + 'b' + 'a' * (n - 2 - (n - 2 - firstElement) - (n - 2 - (n - 2 - firstElement) - secondElement)))


t = int(input())
for _ in range(t):
	(n, k) = (int(x) for x in input().split())
	s = list('a' * n)
	for i in range(n - 2, -1, -1):
		if k <= n - i - 1:
			s[i] = s[n - k] = 'b'
			break
		k -= n - i - 1
	print(''.join(s))


import math
for i in range(int(input())):
	(n, k) = map(int, input().split())
	l = ['a'] * n
	x = math.ceil((math.sqrt(4 * 2 * k + 1) - 1) / 2)
	l[-(x + 1)] = 'b'
	c = x * (x + 1) / 2 - x
	k = k - c
	l[-int(k)] = 'b'
	m = ''.join(l)
	print(m)


t = int(input())
for testcase in range(t):
	(n, k) = map(int, input().split())
	l = 1
	while l * (l + 1) < 2 * k:
		l = l + 1
	d = k - (l - 1) * l // 2
	p = n - l - 1
	q = n - d
	s = 'a' * p + 'b' + 'a' * (q - p - 1) + 'b' + 'a' * (n - q - 1)
	print(s)


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

class FastIO(IOBase):
	newlines = 0

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

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

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

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

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
t = int(input())
li = [0]
for i in range(int(100000.0 + 10)):
	li.append(li[-1] + i + 1)
for ti in range(t):
	(a, b) = (int(i) for i in input().split(' '))
	l = 0
	r = len(li) - 1
	m = l + r >> 1
	flg = 1
	while r - l > 1:
		if li[m] >= b:
			r = m
			m = l + r >> 1
		else:
			l = m
			m = l + r >> 1
	rem = b - li[l]
	rem = a - rem
	for i in range(a):
		if i == a - r - 1:
			print('b', end='')
		elif i == rem:
			print('b', end='')
		else:
			print('a', end='')
	print()


t = int(input())
sol = []
while t:
	t -= 1
	(n, k) = input().split()
	n = int(n)
	k = int(k)
	s = ['a' for i in range(n)]
	d = 1
	poz = 0
	while k > d:
		k -= d
		d += 1
		poz += 1
	s[n - poz - 2] = 'b'
	s[n - k] = 'b'
	sol.append(s)
for i in sol:
	print(*i, sep='')


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	count = 1
	left = 1
	right = 0
	while count < k:
		left += 1
		count += left
	right = left - 1
	if count != k:
		right -= count - k
	res = n * ['a']
	res[-(left + 1)] = res[-(right + 1)] = 'b'
	print(''.join(res))


for i in range(int(input())):
	(n, k) = map(int, input().split())
	a = ((8 * k - 1) ** (1 / 2) - 1) / 2
	if int(a) < a:
		a = int(a)
		s = int(k - a * (a + 1) / 2 - 1)
		a = a + 1
		print('a' * (n - a - 1) + 'b' + 'a' * (a - 1 - s) + 'b' + 'a' * s)
	elif int(a) == a:
		print('a' * (n - a - 1) + 'b' + 'b' + 'a' * (a - 1))


import math
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	pos_a1 = math.ceil((-1 + math.sqrt(1 + 8 * b)) / 2)
	pos_a2 = b - (pos_a1 - 1) * pos_a1 // 2 - 1
	string = ''
	for i in reversed(range(a)):
		if i == pos_a1 or i == pos_a2:
			string += 'b'
		else:
			string += 'a'
	print(string)


def f(n, k):
	s = 'a' * (n - 2) + 'bb'
	if k == 1:
		return s
	su = 1
	for i in range(2, n):
		su += i
		if k <= su:
			s1 = 'a' * (n - i - 1) + 'b' + 'a' * (su - k) + 'b'
			s1 += 'a' * (n - len(s1))
			return s1

def main():
	t = int(input())
	for _ in range(t):
		(n, k) = [int(i) for i in input().split()]
		print(f(n, k))
main()


from math import ceil
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	cv = ceil((ceil(pow(1 + 4 * 2 * k, 1 / 2)) - 1) / 2)
	fbp = n - cv
	sv = (cv - 1) * (cv - 1 + 1) // 2
	sb = k - sv
	sbp = n - sb + 1
	s = ''
	a1 = 'a' * (fbp - 1) + 'b'
	a2 = 'a' * (sbp - fbp - 1) + 'b'
	a3 = 'a' * (n - sbp)
	print(a1 + a2 + a3)


x = int(input())

def func(n, k):
	i = 0
	val = 0
	s = ''
	while val < k:
		i += 1
		val += i
	val -= i
	j = 0
	while j < n - i - 1:
		s += 'a'
		j += 1
	s += 'b'
	j += 1
	while j < n:
		s += 'a'
		j += 1
	val1 = n - k + val
	s = s[:val1] + 'b' + s[val1 + 1:]
	return s
for i in range(x):
	list1 = list(map(int, input().split()))
	s = func(list1[0], list1[1])
	print(s)


def swap(l, a, b):
	t = l[a]
	l[a] = l[b]
	l[b] = t

def solve():
	(n, k) = [int(v) for v in input().split()]
	s = ['a'] * n
	s[-1] = s[-2] = 'b'
	steps = 0
	for i in range(2, n + 1):
		swap(s, -i, -(i - 1))
		if steps + (i - 1) >= k:
			j = 1
			while j <= i - 1 and steps < k:
				if j > 1:
					swap(s, -j, -(j - 1))
				j += 1
				steps += 1
			print(''.join(s))
			return
		else:
			steps += i - 1
t = int(input())
for _ in range(t):
	solve()


from math import sqrt, floor, ceil
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	N = ceil((-1 + sqrt(8 * k + 1)) / 2)
	l = ['a'] * n
	l[N] = 'b'
	N -= 1
	x = N * (N + 1) // 2
	l[k - x - 1] = 'b'
	print(''.join(l)[::-1])


def one_case():
	(n, k) = map(int, input().split())
	k -= 1
	(p0, x) = (0, 0)
	for i in range(n - 1):
		if k >= x:
			k = k - x
			(p0, x) = (p0 + 1, x + 1)
		else:
			break
	s = ['a'] * n
	s[n - p0 - 1] = 'b'
	s[n - k - 1] = 'b'
	print(''.join(s))
t = int(input())
for i in range(t):
	one_case()


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = 0
	fir = 1
	while s + fir < k:
		s += fir
		fir += 1
	sec = k - s
	ans = (n - 1 - fir) * 'a' + 'b' + 'a' * (fir - sec) + 'b' + 'a' * (sec - 1)
	print(ans)


import math
t = int(input())
while t:
	(n, k) = map(int, input().split())
	block = math.ceil((math.sqrt(1 + 8 * k) - 1) / 2)
	blockCount = block * (block + 1) / 2
	l = n - block
	r = l + 1
	diff = blockCount - k
	r += diff
	ans = ''
	for i in range(0, n):
		if i == l - 1 or i == r - 1:
			ans += 'b'
		else:
			ans += 'a'
	print(ans)
	t -= 1


def fx(n, k):

	def f(x):
		return (n * (n - 1) - (n - x + 1) * (n - x)) / 2
	(L, R, x) = (1, n - 1, 0)
	while L <= R:
		M = (L + R) // 2
		if f(M) < k:
			x = M
			L = M + 1
		else:
			R = M - 1
	return (x, int(f(x)))
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	k = n * (n - 1) // 2 - k + 1
	(x, f) = fx(n, k)
	y = k - f + x
	s = ['a'] * n
	s[x - 1] = s[y - 1] = 'b'
	print(''.join(s))


inptli = lambda : map(int, input().split())
for _ in range(int(input())):
	(n, k) = inptli()
	t = 0
	for i in range(1, n + 1):
		if i * (i + 1) // 2 >= k:
			t = i - 1
			break
	beutSt = ['a'] * n
	fpos = t + 2
	t = t * (t + 1) // 2
	spos = k - t
	beutSt[-fpos] = 'b'
	beutSt[-spos] = 'b'
	print(''.join(beutSt))


t = int(input())
for _ in range(t):
	(n, k) = [int(s) for s in input().split()]
	k = n * (n - 1) // 2 - k + 1
	for i in range(n - 1, 0, -1):
		if k <= i:
			p1 = n - 1 - i
			p2 = p1 + k
			break
		else:
			k -= i
	s = ['a'] * n
	s[p1] = 'b'
	s[p2] = 'b'
	print(''.join(s))


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	r = 0
	c = 1
	while r < k:
		r += c
		c += 1
	c -= 1
	r -= c
	d = k - r
	k1 = n - c - 1
	k2 = n - d
	rr = 'a' * k1 + 'b' + 'a' * (k2 - k1 - 1) + 'b' + 'a' * (n - k2 - 1)
	print(rr)


def sequence(N, V):
	Tsum = 0
	number = 0
	diff = 0
	run = True
	while run:
		number += 1
		Tsum += number
		diff = number - (Tsum - V)
		if Tsum >= V:
			run = False
	fb = -(number + 1)
	sb = -diff
	sec = ['a' for i in range(N)]
	(sec[fb], sec[sb]) = ('b', 'b')
	out = ''
	for i in sec:
		out += i
	return out
T = int(input())
outputs = []
for i in range(T):
	(N, V) = input().split(' ')
	(N, V) = (int(N), int(V))
	res = sequence(N, V)
	outputs.append(res)
for i in outputs:
	print(i)


t = int(input())
for i in range(t):
	(n, k) = input().strip().split(' ')
	(n, k) = [int(n), int(k)]
	p = n - 2
	s = 0
	for j in range(1, n - 1):
		s += j
		if s == k:
			break
		elif s > k:
			s -= j
			break
		else:
			p -= 1
	x = ['a' for _ in range(n)]
	x[p] = 'b'
	pp = k - s
	if pp == 0:
		xx = p + 1
	else:
		pp -= 1
		xx = n - 1 - pp
	x[xx] = 'b'
	print(''.join(x))


import math
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	temp = math.ceil((-1 + pow(1 + 8 * k, 0.5)) / 2)
	pos = n - temp - 1
	sub = (temp - 1) * temp // 2
	k -= sub
	l = ['a'] * n
	l[pos] = 'b'
	l[-k] = 'b'
	print(''.join(l))


import math
res = ''
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	x = math.ceil(((1 + 8 * k) ** 0.5 - 1) / 2)
	y = x - 1 - ((x + 1) * x // 2 - k)
	res += 'a' * (n - x - 1) + 'b' + 'a' * (x - y - 1) + 'b' + 'a' * y + '\n'
print(res)


n = int(input())
o = []
for i in range(n):
	(x, y) = [int(x) for x in input().split()]
	j = 1
	while j * (j - 1) // 2 < y:
		j += 1
	i = y - (j - 1) * (j - 2) // 2
	u = ['a'] * x
	u[x - i] = 'b'
	u[x - j] = 'b'
	o += [''.join(u)]
print('\n'.join(o))


import math
t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	j = 1
	l = 0
	while l < k:
		l += j
		j += 1
	print('a' * (n - j) + 'b' + 'a' * (l - k) + 'b' + 'a' * (k + j - 2 - l))


def foo(n, k):
	i = 0
	while i * (i - 1) // 2 + 1 <= k:
		i += 1
	bind2 = i - -1 * (k - i * (i - 1) // 2 - 1)
	for j in range(n):
		if j == n - i or j == n - bind2:
			print('b', end='')
		else:
			print('a', end='')
	print()
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	foo(n, k)


from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

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

def LS():
	return [list(x) for x in sys.stdin.readline().split()]

def S():
	res = list(sys.stdin.readline())
	if res[-1] == '\n':
		return res[:-1]
	return res

def IR(n):
	return [I() for i in range(n)]

def LIR(n):
	return [LI() for i in range(n)]

def SR(n):
	return [S() for i in range(n)]

def LSR(n):
	return [LS() for i in range(n)]
sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
	t = I()
	for _ in range(t):
		(n, k) = LI()
		f = 1
		p = 1
		while f <= k:
			f += p
			p += 1
		f -= p
		p -= 2
		k -= f
		p = n - p
		k = n - k
		ans = 'a' * (p - 2) + 'b' + 'a' * (k - p + 1) + 'b' + 'a' * (n - k - 1)
		print(ans)
	return

def __starting_point():
	solve()
__starting_point()


temp = ['a'] * 100090
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	t = 1
	i = 2
	while k > t:
		t += i
		i += 1
	t = i - 1 + k - t
	ans = temp[:n].copy()
	(ans[-i], ans[-t]) = ('b', 'b')
	print(''.join(ans))


import math
T = int(input())
for t in range(T):
	(n, k) = (int(i) for i in input().split(' '))
	ans = ['a' for _ in range(n)]
	l = math.floor(math.sqrt(2 * k - 2))
	while l * (l - 1) + 2 > 2 * k or l * (l + 1) < 2 * k:
		l += 1
	ans[n - l - 1] = 'b'
	ans[n - (k - l * (l - 1) // 2)] = 'b'
	print(''.join(ans))


T = int(input())
for _ in range(T):
	(n, m) = map(int, input().split())
	a = ['a'] * n
	p = -1
	i = 0
	while p < m:
		p = i * (i + 1) // 2
		i += 1
	i -= 1
	a[i] = 'b'
	i -= 1
	p = i * (i + 1) // 2
	a[m - p - 1] = 'b'
	a.reverse()
	a = ''.join(map(str, a))
	print(a)


from sys import stdin, stdout
from math import *
import itertools
import sys
for zz in range(int(input())):
	(n, k) = map(int, input().split())
	z = 0
	it = 1
	while z + it < k:
		z += it
		it += 1
	s = ['a'] * n
	s[n - it - 1] = 'b'
	s[n - (k - z)] = 'b'
	print(''.join(s))


cases = int(input())

def new_lexo(m, k):
	b1 = 1
	total = 1
	while total < k:
		b1 += 1
		total += b1
	b2 = b1 - total + k
	string = ''
	b1 = m - b1 - 1
	b2 = m - b2
	for x in range(m):
		if x == b1 or x == b2:
			string += 'b'
		else:
			string += 'a'
	return string
for _ in range(cases):
	vals = input().split(' ')
	print(new_lexo(int(vals[0]), int(vals[1])))


import math

def xx(a):
	return (math.sqrt(8 * a + 1) - 1) // 2

def yy(n):
	return (n + 1) * n // 2
for i in range(int(input())):
	(t, k) = map(int, input().split())
	l = []
	l += 'a' * t
	n = int(xx(k))
	if yy(n) == k:
		l[t - n - 1] = 'b'
		l[t - n] = 'b'
	else:
		val = int(k - yy(n))
		l[t - n - 2] = 'b'
		l[t - val] = 'b'
	print(''.join(l))


t = int(input())
for i in range(t):
	array = input().split()
	n = int(array[0])
	m = int(array[1])
	sum = 0
	store = 0
	for i in range(1, n):
		store += 1
		sum = sum + i
		if sum >= m:
			break
	place = store
	value = store - (sum - m) - 1
	result = []
	for i in range(0, n):
		if i == place or i == value:
			result.append('b')
		else:
			result.append('a')
	final = result[::-1]
	sum = '0'
	for i in range(0, len(final)):
		sum += final[i][0]
	print(sum[1:])


import math

def kthBeautifulString(n, k):
	s = ['a'] * n
	r_dash = (-0.5 + (0.5 ** 2 + 4 * 0.5 * k) ** 0.5) / (2 * 0.5)
	r = int(r_dash)
	if r == r_dash:
		(s[n - r], s[n - r - 1]) = ('b', 'b')
		return ''.join(s)
	a = r + 2
	b = k - int(r ** 2 * 0.5 + r * 0.5)
	s[n - a] = 'b'
	s[n - b] = 'b'
	return ''.join(s)
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	print(kthBeautifulString(n, k))


import sys
t = int(sys.stdin.readline())
for _ in range(t):
	(n, k) = map(int, sys.stdin.readline().split())
	if k == 1:
		for _ in range(n - 2):
			print('a', end='')
		print('bb')
		continue
	for i in range(1, n):
		temp = i * (i + 1) // 2
		if temp < k and (i + 1) * (i + 2) // 2 >= k:
			st = i
			k -= temp
			break
	last = (n - 2 - st, n - 1 - (k - 1))
	string = ['a'] * n
	for j in last:
		string[j] = 'b'
	print(''.join(string))


t = int(input())
while t:
	line = input().split()
	(n, k) = (int(line[0]), int(line[1]))
	c = 0
	while k > 0:
		c += 1
		k -= c
	if k <= 0:
		k += c
	s = ['a' for i in range(n)]
	s[n - c - 1] = 'b'
	s[n - k] = 'b'
	print(''.join(s))
	t -= 1


import sys
from operator import xor

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

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

def input():
	return sys.stdin.readline().strip()
import bisect
A = []
t = 0
mark = {}
for i in range(1, 100000):
	t += i
	A.append(t)
	mark[t] = i
for _ in range(int(input())):
	(a, b) = ilele()
	if b == 1:
		print('a' * (a - 2) + 'bb')
	else:
		S = 'a' * (a - 2) + 'bb'
		x = bisect.bisect_left(A, b)
		z = (a - mark.get(A[x], 0) - 1) * 'a' + 'b'
		y = A[x] - b
		z = z + 'a' * y + 'b'
		print(z + (a - len(z)) * 'a')


n = int(input())
for i in range(n):
	(n, k) = map(int, input().split())
	count_b = 2
	while count_b * (count_b - 1) // 2 < k:
		count_b += 1
	(count_b, count_a) = (n - count_b, n - count_b + (count_b * (count_b - 1) // 2 - k + 1))
	for i in range(n):
		if i == count_a or i == count_b:
			print('b', end='')
		else:
			print('a', end='')
	print()


import math
t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	k -= 1
	w = math.ceil((2 * k) ** 0.5) - 1
	if 2 * k >= w * (w + 1) and 2 * k <= (w + 1) * (w + 2):
		w = w
	else:
		w = w - 1
	s = w * (w + 1) // 2
	x = k - s
	if k == 0:
		print('a' * (n - 2) + 'bb')
	else:
		w += 1
		m = min(w, x)
		ma = max(w, x)
		s = (n - (n - m)) * 'a'
		s = 'b' + s
		s = (ma - len(s)) * 'a' + s
		s = 'b' + s
		s = (n - len(s)) * 'a' + s
		print(s)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	l = ['a'] * a
	j = 1
	while b > 0:
		if int((2 * b - 1) / (j * (j + 1))) == 0:
			l[-j - 1] = 'b'
			b = b - int(j * (j - 1) / 2)
			break
		else:
			j = j + 1
	l[-b] = 'b'
	if l.count('b') == 1:
		l[-1] = 'b'
	l = ''.join(l)
	print(l)


for q in range(int(input())):
	(n, m) = map(int, input().split())
	i = 1
	while m > i:
		m -= i
		i += 1
	print('a' * (n - i - 1) + 'b' + 'a' * (i - m) + 'b' + 'a' * (m - 1))


def bin(x):
	i = 1
	while x > i:
		x -= i
		i += 1
	return [i, x, 0]
t = int(input())
for i in range(t):
	(a, b) = map(int, input().split(' '))
	s = 'a'
	s *= a
	aux = list(s)
	v = bin(b)
	aux[-1 * v[0] - 1] = 'b'
	aux[-1 * v[1]] = 'b'
	print(''.join(aux))


import io
import os
from collections import Counter, defaultdict, deque

def solve(N, K):
	K -= 1
	skip = 0
	ans = []
	for i in range(N):
		if skip + i <= K:
			skip += i
		else:
			j = K - skip
			assert i != j
			temp = ['a'] * N
			temp[i] = 'b'
			temp[j] = 'b'
			return ''.join(reversed(temp))
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
T = int(input())
for t in range(T):
	(N, K) = [int(x) for x in input().split()]
	ans = solve(N, K)
	print(ans)


def choose(n, k):
	if n < k:
		return 0
	if k == 1:
		return n
	return n * (n - 1) // 2

def combination(n, k, m):
	result = []
	a = n
	b = k
	x = choose(n, k) - 1 - m
	for i in range(0, k):
		a = a - 1
		while choose(a, b) > x:
			a = a - 1
		result.append(n - 1 - a)
		x = x - choose(a, b)
		b = b - 1
	return result
output = []
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	(b1, b2) = combination(n, 2, n * (n - 1) // 2 - k)
	output.append('{1}{0}{2}{0}{3}'.format('b', 'a' * b1, 'a' * (b2 - b1 - 1), 'a' * (n - b2 - 1)))
for line in output:
	print(line)


t = int(input())
for i in range(t):
	(n, k) = list(map(int, input().split()))
	for j in range(n):
		if j * (j - 1) // 2 < k and j * (j + 1) / 2 >= k:
			break
	c = k - (j * (j - 1) // 2 + 1)
	a = 'a'
	b = 'b'
	print(a * (n - j - 1) + b + (j - c - 1) * a + b + a * c)


t = int(input())
n = []
k = []
for i in range(t):
	a = input().split(' ')
	n.append(int(a[0]))
	k.append(int(a[1]))
for i in range(t):
	if k[i] == 1:
		resultado = ''
		for l in range(n[i]):
			if l == n[i] - 1 or l == n[i] - 2:
				resultado += 'b'
			else:
				resultado += 'a'
		print(resultado)
	else:
		suma = 0
		j = 0
		while suma <= k[i]:
			j += 1
			suma = 1 + j * (j + 1) / 2
		j -= 1
		suma = 1 + j * (j + 1) / 2
		resultado = ''
		for l in range(n[i]):
			if l == n[i] - 2 - j or l == n[i] - 1 - (k[i] - suma):
				resultado += 'b'
			else:
				resultado += 'a'
		print(resultado)


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

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

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

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

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

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

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

def si():
	return stdin.readline()
res = ['YES', 'NO']
for _ in range(ii()):
	(n, k) = mi()
	a = 0
	i = 1
	while a < k:
		a += i
		i += 1
	ans = 'a' * (n - i) + 'b' + 'a' * (a - k) + 'b' + 'a' * (k + i - a - 2)
	print(ans)


from math import sqrt
from math import ceil
t = int(input())
for T in range(t):
	s = []
	s = input().split()
	n = int(s[0])
	k = int(s[1])
	p1 = 1 + sqrt(1 + 8 * k)
	p1 = ceil(p1 / 2)
	p2 = 1 - sqrt(1 + 8 * k)
	p2 = ceil(p2 + 1)
	p = max(p1, p2)
	sx = p - 2
	pri = (1 + sx) * sx
	pri = int(pri / 2)
	p2 = k - pri
	if k == 1:
		p2 = 1
		p = 2
	for i in range(n):
		j = n - i
		if j == p or j == p2:
			print('b', end='')
		else:
			print('a', end='')
	print('')


t = int(input())
for i in range(t):
	(a, b) = (int(x) for x in input().split(' '))
	l = list('a' * a)
	sum = 0
	s = 0
	while sum < b:
		s = s + 1
		sum = sum + s
	l[-(s + 1)] = 'b'
	l[-(b - (sum - s))] = 'b'
	c = ''.join(l)
	print(c)


a = int(input())
for x in range(a):
	(b, c) = map(int, input().split())
	p = [y for y in range(1, b)]
	j = 'a' * (b - 2) + 'b' * 2
	if c == 1:
		print(j)
	else:
		h = ['a' for y in range(b)]
		i = 1
		d = c
		while d > i:
			d -= i
			i += 1
		for y in range(b):
			if y == b - i - 1 or y == b - d:
				h[y] = 'b'
		t = ''.join(h)
		print(t)


def main():
	T = int(input())
	for i in range(T):
		(n, k) = list(map(int, input().split()))
		out = ['a' for j in range(n)]
		v = 0
		for j in range(1, n + 1):
			if v + j >= k:
				out[n - 1 - j] = 'b'
				out[n - 1 - (k - v - 1)] = 'b'
				break
			v += j
		for j in out:
			print(j, sep='', end='')
		print('')
main()


import sys
T = int(sys.stdin.readline())
for _ in range(T):
	(n, k) = map(int, sys.stdin.readline().split())
	res = ['a'] * n
	second_b = k - 1
	for first_b in range(1, n):
		if first_b <= second_b:
			second_b -= first_b
		else:
			break
	res[n - first_b - 1] = 'b'
	res[n - second_b - 1] = 'b'
	print(''.join(res))


import sys
import math as m
input = sys.stdin.readline
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	x = m.ceil((-1 + (1 + 4 * 2 * k) ** 0.5) / 2)
	y = x * (x + 1) // 2 - k
	print('a' * (n - x - 1) + 'b' + 'a' * y + 'b' + 'a' * (n - (n - x - 1 + 1 + y + 1)))


import math
q = int(input())
for i in range(q):
	(l, k) = map(int, input().split())
	n = math.ceil((1 + math.pow(1 + 8 * k, 1 / 2)) / 2) - 1
	print('a' * (l - n - 1), end='b')
	mines = n * (n - 1) / 2
	newb = k - mines
	for i in range(n):
		if i == n - newb:
			print('b', end='')
		else:
			print('a', end='')
	print()


f = int(input())
for q in range(f):
	(n, m) = map(int, input().split())
	m -= 1
	c = 0
	for i in range(2, 99999999):
		if m >= i:
			m -= i
			c += 1
		else:
			break
	s = ['a' for i in range(n)]
	if m > 0:
		s[n - 3 - c] = 'b'
		s[n - (m - 1) - 1] = 'b'
	else:
		s[n - 2 - c] = 'b'
		s[n - 1 - c] = 'b'
	for i in range(n):
		print(s[i], end='')
	print()


from sys import stdin, stdout
import math
n = int(stdin.readline())
for i in range(n):
	ar = [int(x) for x in stdin.readline().split()]
	strr = ['a'] * ar[0]
	n = 0.5 + 0.5 * math.sqrt(1 + 8 * ar[1])
	n = int(math.ceil(n))
	N = n - 1
	strr[-1 * n] = 'b'
	sum = N * (N - 1) / 2
	shift = ar[1] - int(sum)
	strr[-1 * shift] = 'b'
	strr = ''.join(strr)
	stdout.write(strr + '\n')


from collections import defaultdict
from itertools import zip_longest
from math import ceil, sqrt
for i in range(int(input())):
	(n, k) = map(int, input().split())
	s = ['a'] * n
	KK = k
	k -= 1
	yy = 0
	if k == 0:
		pass
	else:
		yy = (1 + sqrt(1 + 8 * k)) / 2
		yy = int(yy) - 1
	yy = min(n - 2, yy)
	pos = n - 2 - yy
	s[pos] = 'b'
	tt = n - 2 - pos
	tt = tt * (tt + 1) // 2
	k = max(0, k - tt)
	tt = 0
	if k == 0:
		pass
	else:
		tt = k
	pos1 = n - 1 - tt
	s[pos1] = 'b'
	print(''.join(s))


import sys
input = sys.stdin.buffer.readline
tests = int(input())
for _ in range(tests):
	(n, k) = map(int, input().split())
	cnt1 = n - 2
	cnt2 = 2
	ans = ['#' for i in range(n)]
	for i in range(n):
		if cnt1 == 0:
			ans[i] = 'b'
			continue
		elif cnt2 == 0:
			ans[i] = 'a'
			continue
		if cnt2 == 2:
			j = n - i - 1
			val = j * (j - 1) // 2
			if val >= k:
				ans[i] = 'a'
				cnt1 -= 1
			else:
				k -= val
				ans[i] = 'b'
				cnt2 -= 1
		else:
			j = n - i - 1
			if j >= k:
				ans[i] = 'a'
				cnt1 -= 1
			else:
				k -= j
				ans[i] = 'b'
				cnt2 -= 1
	print(*ans, sep='')


entrada = int(input())
for k in range(entrada):
	(n, k) = list(map(int, input().split()))
	k -= 1
	indum = 0
	inddois = 0
	for i in range(n - 2, -1, -1):
		if k < n - 1 - i:
			indum = i
			inddois = n - 1 - k
			break
		k -= n - 1 - i
	string = ''
	for j in range(n):
		if j == indum or j == inddois:
			string += 'b'
		else:
			string += 'a'
	print(string)


def func(n):
	return n * (n + 1) // 2
t = int(input())
while t:
	(n, k) = map(int, input().split())
	for i in range(1, n):
		if func(i) >= k:
			ans = (k - func(i - 1), i)
			break
	one = n - 1 - ans[1]
	two = n - ans[0]
	ans = ''
	for i in range(n):
		if i == one or i == two:
			ans += 'b'
		else:
			ans += 'a'
	print(ans)
	t -= 1


from math import sqrt
t = int(input())
for _ in range(t):
	q = input().split()
	(a, b) = (int(q[0]), int(q[1]))
	k = 2 * b
	p = int(sqrt(k))
	while p * (p + 1) < k:
		p += 1
	if p * (p + 1) == k:
		str = 'a' * (a - p - 1) + 'b' * 2 + 'a' * (p - 1)
		print(str)
		continue
	y = p * (p + 1)
	l = p * (p - 1) // 2
	str = 'a' * (a - p - 1) + 'b' + 'a' * (p - b + l) + 'b' + 'a' * (b - l - 1)
	print(str)


t = int(input())
for _ in range(t):
	(n, k) = [int(c) for c in input().split(' ')]
	first = 1
	while first * (first - 1) // 2 <= k - 1:
		first += 1
	first -= 1
	second = k - 1 - first * (first - 1) // 2
	s = ['a' for _ in range(n)]
	s[first] = 'b'
	s[second] = 'b'
	print(''.join(s[::-1]))


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	i = 1
	while True:
		if k <= i:
			break
		else:
			k -= i
		i += 1
	a = n - i - 1
	b = n - k
	print('a' * a + 'b' + 'a' * (b - a - 1) + 'b' + 'a' * (n - b - 1))


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	m = int(n * (n - 1) / 2) - k + 1
	for j in range(1, n + 1):
		if m <= j * (2 * n - j - 1) / 2:
			left = j
			break
	right = left - int((left - 1) * (2 * n - left) / 2) + m
	ans = ['a'] * n
	ans[left - 1] = 'b'
	ans[right - 1] = 'b'
	print(''.join([str(elem) for elem in ans]))


T = int(input())
for _ in range(T):
	(A, B) = map(int, input().split())
	l = 2
	while l * (l - 1) // 2 < B:
		l += 1
	first_b_pos = l - 1
	second_b_pos = B - (l - 2) * (l - 1) // 2 - 1
	ans = ''
	for i in range(A):
		if i == first_b_pos or i == second_b_pos:
			ans += 'b'
		else:
			ans += 'a'
	print(''.join(map(str, reversed(ans))))


import math
import sys
from collections import deque
import heapq
from collections import Counter

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

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

def lis():
	return list(mpp())

def sol(n, k):
	s = ['a'] * n
	for i in range(n - 2, -1, -1):
		if k <= n - i - 1:
			s[i] = 'b'
			s[n - k] = 'b'
			s = ''.join(s)
			print(s)
			break
		k -= n - i - 1

def main():
	t = int(inp())
	for _ in range(t):
		(a, b) = mpp()
		sol(a, b)
main()


from math import sqrt
t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	buf = int(sqrt(1 + 8 * k))
	x = (1 + buf) // 2
	if x * (x - 1) // 2 == k:
		x = x - 1
	pos1 = n - 1 - x
	pos2 = n - (k - x * (x - 1) // 2)
	s = ['a'] * n
	s[pos1] = 'b'
	s[pos2] = 'b'
	print(''.join(s))


import os
import sys
from io import BytesIO, IOBase
from math import *
from itertools import *
readn = lambda : int(input())
readl = lambda : list(map(int, input().split()))
reads = lambda : input()
readns = lambda : map(int, input().split())

def solve(s):
	a = 1
	b = 1
	c = -2 * s
	d = b * b - 4 * a * c
	sq = int(sqrt(d))
	return (sq + -b) // (2 * a)

def main():
	for _ in range(readn()):
		(n, k) = readns()
		close = solve(k)
		s = close * (close + 1) // 2
		if s == k:
			ans = ['a'] * n
			ans[-close] = 'b'
			ans[-close - 1] = 'b'
			ans = ''.join(ans)
		else:
			ans = ['a'] * n
			chk = k - s
			ans[-close - 2] = 'b'
			ans[-chk] = 'b'
			ans = ''.join(ans)
		print(ans)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

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

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

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

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

class IOWrapper(IOBase):

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


bucketList = []
b = 1
indexNo = 1
while b <= 2000000000:
	e = b + indexNo - 1
	bucketList.append({'b': b, 'e': e})
	b = e + 1
	indexNo += 1
indexNo = len(bucketList)
T = int(input())
while T > 0:
	(n, k) = map(int, input().split())
	begin = 0
	end = indexNo - 1
	bucketNo = -1
	while begin <= end:
		mid = (begin + end) // 2
		if bucketList[mid]['b'] <= k and bucketList[mid]['e'] >= k:
			bucketNo = mid + 1
			break
		elif bucketList[mid]['e'] < k:
			begin = mid + 1
		else:
			end = mid - 1
	returnString = 'a' * n
	returnList = list(returnString)
	returnList[n - 1 - bucketNo] = 'b'
	returnList[n - 1 - (k - bucketList[bucketNo - 1]['b'])] = 'b'
	returnString = ''.join(returnList)
	print(returnString)
	T -= 1


def where_is(k):
	x = 1
	while True:
		if k <= x * (x + 1) / 2:
			break
		x += 1
	return x
for i in range(int(input())):
	(n, k) = [int(x) for x in input().split()]
	where = where_is(k)
	first = n - 1 - where
	second = int(where * (where + 1) / 2 - k)
	third = n - 2 - first - second
	answer = first * 'a' + 'b' + second * 'a' + 'b' + third * 'a'
	print(answer)


import math
t = int(input())
for _ in range(t):
	(n, k) = [int(x) for x in input().split()]
	j = (1 + math.sqrt(1 + 8 * k)) / 2
	if j == int(j):
		a = int(j)
		b = int(j) - 1
	else:
		a = int(j) + 1
		b = k - int(j) * (int(j) - 1) // 2
	for i in range(n, 0, -1):
		if i == a or i == b:
			print('b', end='')
		else:
			print('a', end='')
	print()


import math

def execute(nutrela, kinderjoy):
	garden = 1 + 8 * kinderjoy
	noida = garden ** 0.5
	xmas = int(math.ceil((-1 + noida) / 2))
	putin = xmas * (xmas - 1) / 2
	yopse = int(kinderjoy - putin - 1)
	animation = ['a'] * nutrela
	animation[xmas] = 'b'
	animation[yopse] = 'b'
	return ''.join(animation[::-1])
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	print(execute(n, k))


import math
n = input()
for i in range(int(n)):
	(a, b) = [int(x) for x in input().split()]
	count = 0
	flag = 0
	for i in range(1, a):
		if b <= count + i:
			j = 0
			j = i - 1 - (count + i - b)
			break
		count = count + i
	retstr = 'a' * a
	length = len(retstr)
	retstr = retstr[:length - i - 1] + 'b' + retstr[length - i:]
	retstr = retstr[:length - j - 1] + 'b' + retstr[length - j:]
	print(retstr)


(T, n, k) = (0, 0, 0)
T = int(input())
while T:
	(n, k) = map(int, input().split())
	(Kth, a, b) = (0, 0, 0)
	for i in range(2, n + 1):
		Kth += i - 1
		if k <= Kth:
			(a, b) = (i, i - Kth + k - 1)
			break
	s = ''
	for i in range(n, 0, -1):
		if i == a or i == b:
			s += 'b'
		else:
			s += 'a'
	print(s)
	T -= 1


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	mx = n * (n - 1) // 2
	mm = -1
	for i in range(1, 100000):
		mm = i * (i + 1) / 2
		if mm >= k:
			break
	sec = i * (i - 1) // 2
	sec = k - sec - 1
	f = n - i
	s = n - sec
	st = ''
	for i in range(1, n + 1):
		if i == s or i == f:
			st += 'b'
		else:
			st += 'a'
	print(st)


import sys, math
input = sys.stdin.readline
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	ans = ['a'] * n
	(cur, ind) = (0, 1)
	while k - 1 >= cur:
		cur += ind
		ind += 1
	ind -= 1
	ans[n - 1 - ind] = 'b'
	cur2 = k - (ind * (ind - 1) >> 1)
	ans[n - cur2] = 'b'
	print(''.join(ans))


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	k -= 1
	res = ' '
	for i in range(n - 2, -1, -1):
		if k < n - 1 - i:
			p1 = i
			p2 = n - 1 - k
			break
		k -= n - 1 - i
	for i in range(n):
		if i == p1 or i == p2:
			res += 'b'
		else:
			res += 'a'
	print(res)


n = int(input())
for i in range(n):
	(num, k) = map(int, input().split())
	(l, r) = (0, num)
	while l != r - 1:
		bet = (l + r) // 2
		if bet * (bet + 1) // 2 >= k:
			r = bet
		else:
			l = bet
	s = 'a' * (l + 1) + 'b'
	k -= (l + 1) * l // 2 + 1
	s = s[:k] + 'b' + s[k + 1:]
	sgl = 'a' * (num - len(s)) + s[::-1]
	print(sgl)


T = int(input())
for _ in range(T):
	(n, k) = map(int, input().split())
	str = ['a'] * n
	for i in range(n - 2, -1, -1):
		if k <= n - i - 1:
			str[i] = 'b'
			str[n - k] = 'b'
			for chr in str:
				print(chr, end='')
			print()
			break
		else:
			k -= n - i - 1


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	s = 'a' * (n - 2) + 'b' * 2
	if k == 1:
		print(s)
	else:
		for i in range(1, n):
			a = i * (i + 1) // 2
			if a >= k:
				break
		a = a - i
		b1 = n - 1 - i
		b2 = n - (k - a)
		for i in range(n):
			if i == b1 or i == b2:
				print('b', end='')
			else:
				print('a', end='')
		print()


for _ in range(int(input())):
	(N, K) = map(int, input().split())
	res = ''
	cnt = 0
	temp = 0
	i = 1
	l = 0
	r = 0
	for i in range(1, K + 1):
		temp += i
		if temp == K:
			l = i + 1
			r = i
			break
		elif temp > K:
			temp -= i
			l = i + 1
			r = K - temp
			break
	for j in range(1, N + 1):
		if j == l or j == r:
			res += 'b'
		else:
			res += 'a'
	print(res[::-1])


t = int(input())
for i in range(t):
	(n, k) = list(map(int, input().split()))
	if k == 1:
		print('a' * (n - 2) + 'b' * 2)
	else:
		index1 = 0
		index2 = 0
		for j in range(2, 10 ** 5):
			sq = j * (j + 1) // 2
			if k <= sq:
				index1 = n - (j + 1)
				index2 = index1 + (sq - k) + 1
				break
		print('a' * index1 + 'b' + 'a' * (index2 - index1 - 1) + 'b' + 'a' * (n - index2 - 1))


def arProg(i):
	return (1 + i) * i / 2 + 1

def word(n, k):
	i = 1
	while arProg(i + 1) <= k:
		i += 1
	x = arProg(i)
	d = 0
	while x < k:
		x += 1
		d += 1
	print('a' * (n - i - 2) + 'b' + 'a' * (i - d) + 'b' + 'a' * d)
t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	if k > 1:
		word(n, k)
	elif k == 1:
		print('a' * (n - 2) + 'bb')


t = int(input())
for _ in range(t):
	(n, k) = [int(i) for i in input().split()]
	count = 0
	prev = 0
	num = 0
	for i in range(1, k + 1):
		if count + i <= k:
			count += i
			num += 1
		else:
			break
	s = ['a'] * n
	if count == k:
		s[n - num] = 'b'
		s[n - num - 1] = 'b'
		s1 = ''.join(s)
		print(s1)
	else:
		diff = k - count
		num += 1
		s[n - num - 1] = 'b'
		s[n - diff] = 'b'
		s1 = ''.join(s)
		print(s1)


from collections import Counter
from collections import defaultdict
import math
t = int(input())
for _ in range(0, t):
	(n, k) = list(map(int, input().split()))
	ans = 1
	for i in range(1, 200000000):
		if i * (i + 1) >= 2 * k:
			ans = i
			break
	ans1 = i * (i + 1) // 2
	ans2 = ans1 - k + 1
	back1 = n - 1 - ans
	back2 = n - 1 - (ans - ans2)
	for i in range(0, n):
		if i == back1 or i == back2:
			print('b', end='')
		else:
			print('a', end='')
	print()


import bisect
t = int(input())
a = []
s = 2
a.append(1)
for i in range(1, 10 ** 5):
	a.append(a[i - 1] + s)
	s += 1
for _ in range(t):
	(n, k) = map(int, input().split())
	ni = bisect.bisect_left(a, k)
	i = n - ni - 2
	j = i + 1 + a[ni] - k
	print('a' * i + 'b' + (j - i - 1) * 'a' + 'b' + (n - j - 1) * 'a')


t = int(input())
for i in range(t):
	s = input().split()
	n = int(s[0])
	k = int(s[1])
	l = []
	app = 0
	z = 0
	for j in range(1, k + 1):
		app += j
		if app >= k:
			app -= j
			z = j - 1
			break
	for j in range(n):
		if j != n - z - 2 and j != n - (k - app):
			l.append('a')
		else:
			l.append('b')
	print(''.join(l))


t = int(input())
while t > 0:
	t -= 1
	(n, k) = input().split()
	n = int(n)
	k = int(k)
	l = 0
	while l * (l + 1) / 2 < k:
		l += 1
	j = l * (l + 1) / 2 - k
	l = n - l
	j = j + l + 1
	s = ''
	for m in range(n):
		if m == l - 1 or m == j - 1:
			s = s + 'b'
		else:
			s = s + 'a'
	print(s)


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split(' '))
	if k == 1:
		print('a' * (n - 2) + 'bb')
		continue
	b = 1
	e = n
	while e - b > 1:
		m = b + (e - b) // 2
		if m * (m - 1) // 2 < k:
			b = m
		else:
			e = m
	s = ['a'] * n
	s[b] = 'b'
	j = k - b * (b - 1) // 2 - 1
	s[j] = 'b'
	print(''.join(s[::-1]))


from sys import stdin
from math import sqrt
(t,) = map(int, stdin.readline().split())
for _ in range(t):
	(n, k) = map(int, stdin.readline().split())
	l = int(sqrt(k))
	while l * (l + 1) <= 2 * k:
		l += 1
	l -= 1
	diff = k - l * (l + 1) // 2
	out = ['a'] * n
	if diff == 0:
		(out[n - l - 1], out[n - l]) = ('b', 'b')
	else:
		out[n - l - 2] = 'b'
		out[-diff] = 'b'
	print(''.join(out))


t = int(input())
for e in range(t):
	(n, k) = [int(x) for x in input().split()]
	s = ['a'] * n
	cont = 0
	aux = 0
	while True:
		if aux > k:
			aux -= cont
			break
		cont += 1
		aux += cont
	tmp = k - aux
	if tmp > 0:
		pos1 = n - 1 - cont
		pos2 = n - tmp
	else:
		cont -= 1
		pos1 = n - 1 - cont
		pos2 = pos1 + 1
	s[pos1] = 'b'
	s[pos2] = 'b'
	for e in s:
		print(e, end='')
	print()


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	la = ['a'] * n
	(i, j) = (0, 1)
	while i + j < k:
		i += j
		j += 1
	la[n - j - 1] = 'b'
	la[n + i - k] = 'b'
	print(*la, sep='')


for i in range(int(input())):
	(tamanho, k) = map(int, input().split(' '))
	resultado = ['a'] * tamanho
	for i in range(tamanho - 2, -1, -1):
		if k <= tamanho - i - 1:
			resultado[i] = 'b'
			resultado[tamanho - k] = 'b'
			break
		k -= tamanho - i - 1
	print(''.join(resultado))


import math
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	p1 = math.floor((1 + (1 + 8 * (k - 1)) ** 0.5) / 2)
	p2 = k - p1 * (p1 - 1) // 2
	ans = 'a' * (n - p1 - 1) + 'b' + 'a' * (p1 - p2) + 'b' + 'a' * (p2 - 1)
	print(ans)


t = int(input())
for j in range(t):
	(n, k) = map(int, input().split())
	s = ['a'] * n
	ans = ''
	for i in range(n - 2, -1, -1):
		if k <= n - i - 1:
			s[i] = 'b'
			s[n - k] = 'b'
			for ch in s:
				ans += ch
			print(ans)
			break
		k -= n - i - 1


for _ in range(int(input())):
	(n, k) = list(map(int, input().split()))
	pref = [1]
	for i in range(n - 2):
		pref.append(pref[-1] + 1)
	for i in range(1, len(pref)):
		pref[i] = pref[i] + pref[i - 1]
	ans = ['a' for i in range(n)]
	f = 0
	for i in range(1, n):
		if k == pref[i - 1]:
			f = 1
			ind = i - 1
			break
		if k >= pref[i - 1] and k <= pref[i]:
			ind = i
			val = pref[i - 1]
			break
	if f == 1:
		ans[-ind - 2] = 'b'
		ans[-1] = 'b'
		print(''.join((str(x) for x in ans)))
	else:
		ans[-ind - 2] = 'b'
		m = k - val
		ans[-m] = 'b'
		print(''.join((str(x) for x in ans)))


from sys import stdout, stdin
read = stdin.readline
write = stdout.write

def f(n):
	k = int((2 * n) ** 0.5) - 1
	while (k - 1) * k // 2 < n:
		k += 1
	return k - 1
t = int(read())
for _ in range(t):
	(n, k) = map(int, read().split())
	ans = ['a'] * n
	first = f(k)
	second = k - (first - 1) * first // 2 - 1
	ans[first] = 'b'
	ans[second] = 'b'
	print(''.join(reversed(ans)))


for g in [*open(0)][1:]:
	(n, k) = map(int, g.split())
	i = 1
	k -= 1
	while i <= k:
		k = k - i
		i += 1
	print('a' * (n - i - 1) + 'b' + 'a' * (i - k - 1) + 'b' + 'a' * k)


def main():
	t = int(input())
	for __ in range(t):
		(n, k) = map(int, input().split())
		b_index = n - 2
		word_count = 1
		sb_index = n - 1
		s = []
		if k == 1:
			for i in range(1, n):
				if i == n - 1:
					s.append('bb')
				else:
					s.append('a')
		else:
			while True:
				if word_count < k <= word_count + (n - b_index):
					d = word_count + (n - b_index) - k
					sb_index = b_index + 1 + d
					break
				else:
					word_count += n - b_index
					b_index -= 1
			for i in range(1, n + 1):
				if i == b_index or i == sb_index:
					s.append('b')
				else:
					s.append('a')
		print(''.join(s))
main()


from math import sqrt
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())

	def sp(num):
		return num * (num - 1) // 2
	b1 = int((1 + sqrt(1 + 8 * (k - 1))) / 2)
	b2 = k - sp(b1) - 1
	b1 = n - b1 - 1
	b2 = n - b2 - 1
	for i in range(n):
		if i == b1 or i == b2:
			print('b', end='')
		else:
			print('a', end='')
	print()


t = int(input())
for i in range(t):
	(n, m) = list(map(int, input().rstrip().split()))
	res = ['a'] * n
	temp = 2 * 1000000000.0
	low = 0
	high = min(temp, n * (n - 1) / 2)
	mid = 0
	index1 = 0
	while low <= high:
		mid = int((high + low) // 2)
		if int(mid * (mid + 1)) // 2 >= m:
			index1 = mid
			high = mid - 1
		else:
			low = mid + 1
	index2 = index1 - (index1 * (index1 + 1) // 2 - m + 1)
	u = n - index1 - 1
	t = n - index2 - 1
	res[u] = 'b'
	res[t] = 'b'
	print(''.join(res))


t = int(input())
for q in range(t):
	(n, k) = map(int, input().split())
	firstb = 0
	lastb = 0
	cn = 0
	flag = True
	result = ['a' for x in range(n)]
	for x in range(n):
		if x * (x + 1) / 2 >= k:
			firstb = n - x - 1
			cn = x
			break
		elif x * (x + 1) / 2 < k and x == n - 1:
			flag = False
	acases = (n - 1) * (n - 2) // 2
	if flag == False:
		firstb = 0
		bcases = k - acases
		lastb = n - bcases + 1
	else:
		acases = (cn - 1) * cn // 2
		bcases = k - acases
		lastb = n - bcases + 1
	result[firstb] = 'b'
	result[lastb - 1] = 'b'
	for x in result:
		print(x, end='')
	print()


from sys import stdin
input = stdin.readline

def a():
	t = int(input())
	for _ in range(t):
		(a, b) = map(int, input().split())
		if a % b == 0:
			print(0)
		else:
			print(str(b - a % b))

def b():
	t = int(input())
	for _ in range(t):
		(n, k) = map(int, input().split())
		bpos1 = 0
		bpos2 = 0
		for i in range(2, n + 1):
			asdf = i * (i - 1) // 2
			if asdf >= k:
				bpos1 = i
				bpos2 = bpos1 - (asdf - k) - 1
				break
		string = ['a'] * n
		string[n - bpos1] = 'b'
		string[n - bpos2] = 'b'
		print(''.join(string))
b()


import math
n = int(input())
for z in range(n):
	(x, y) = [int(i) for i in input().split()]
	s = ['a'] * x
	w = (-1 + math.sqrt(1 + 8 * y)) / 2
	i = math.ceil(w)
	s[-i - 1] = 'b'
	i -= 1
	w = i * (i + 1) // 2
	i = y - w
	s[-i] = 'b'
	print(''.join(s))


from math import ceil, sqrt

def Support(N):
	return N * (N + 1) >> 1

def First(K):
	return int(ceil((sqrt(8 * K + 1) - 1) / 2))
for _ in range(int(input())):
	(N, K) = map(int, input().split())
	A = First(K)
	B = K - Support(A - 1)
	List = ['a'] * N
	List[-A - 1] = 'b'
	List[-B] = 'b'
	Ans = ''.join(List)
	print(Ans)


from bisect import *
import math
from collections import *
from heapq import *
from itertools import *
inf = 10 ** 18
mod = 10 ** 9 + 7
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	ans = ['a' for _ in range(n)]
	check = False
	ind = -1
	for i in range(1, n):
		if k - i <= 0 or i == n - 1:
			ind = i
			ans[i] = 'b'
			check = True
			break
		else:
			k -= i
	ans[k - 1] = 'b'
	ans = ans[::-1]
	print(''.join(ans))


for _ in range(int(input())):
	(a, k) = list(map(int, input().split()))
	sum1 = 0
	j = 0
	mod = a * (a - 1) // 2
	while sum1 + j + 1 < k:
		j += 1
		sum1 += j
	print((a - j - 2) * 'a' + 'b' + (j + 1 - (k - sum1)) * 'a' + 'b' + (k - sum1 - 1) * 'a')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	l = ['a'] * n
	(idx1, idx2, idxb1, idxb2) = (-1, -1, -1, -1)
	(sum_, count) = (0, 0)
	while sum_ < k:
		count += 1
		sum_ += count
	idx1 = count - 1
	sum_ -= count
	idx2 = k - sum_ - 1
	idxb1 = n - 2
	idxb2 = n - 1
	l[idxb1 - idx1] = 'b'
	l[idxb2 - idx2] = 'b'
	print(''.join(l))


import math
for _ in range(int(input())):
	(n, k) = list(map(int, input().split()))
	N = int(n * (n - 1) / 2)
	if k == N:
		print('bb' + 'a' * (n - 2))
	else:
		n_temp = int((1 + math.sqrt(1 + 8 * k)) / 2)
		string = 'a' * (n - n_temp) + 'bb' + 'a' * (n_temp - 2)
		string = list(string)
		N_temp = int(n_temp * (n_temp - 1) / 2)
		times = k - N_temp
		for i in range(0, times):
			if string[n - n_temp - i] == string[n - n_temp - i + 1] and string[n - n_temp - i] == 'b':
				string[n - n_temp - i - 1] = 'b'
				string[n - n_temp - i] = 'a'
				if n - 1 != n - n_temp + 1:
					string[n - 1] = 'b'
					string[n - n_temp - i + 1] = 'a'
			else:
				string[n - 1 - i] = 'b'
				string[n - 1 - i + 1] = 'a'
		print(''.join(string))


import bisect as b
dp = [0] * 100000
dp[0] = 1
for i in range(1, 100000):
	dp[i] = dp[i - 1] + i
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	p = b.bisect(dp, k)
	o = k - dp[p - 1] + 1
	p = p + 1
	l = ['a'] * n
	l[-p] = 'b'
	l[-o] = 'b'
	print(''.join([str(a) for a in l]))


from math import ceil, log2

def getInts():
	return list(map(int, input().split()))
[T] = getInts()
for case in range(T):
	[n, k] = getInts()
	ans = ''
	prev = n
	while True:
		river = (prev - 1) * (prev - 2) // 2
		if prev == 3:
			if k == 1:
				ans += 'abb'
				break
			elif k == 2:
				ans += 'bab'
				break
			elif k == 3:
				ans += 'bba'
				break
		elif k <= river:
			ans += 'a'
		else:
			ans += 'b'
			temp = ['a'] * (prev - 1)
			temp[-(k - river)] = 'b'
			ans += ''.join(temp)
			break
		prev -= 1
	print(ans)


t = int(input())
import math
for case in range(t):
	(n, k) = map(int, input().split())
	r = math.ceil(-1.5 + math.sqrt(2 * k - 1 / 4))
	l = k - r * (r + 1) // 2
	r += 2
	print('a' * (n - r) + 'b' + 'a' * (r - l - 1) + 'b' + 'a' * (l - 1))


T = int(input())
for _ in range(T):
	(a, b) = map(int, input().split())
	i = 0
	dc = 0
	c = 0
	while i < b:
		dc = i
		c = c + 1
		i = i + c
	d = b - dc - 1
	s = 'a' * (a - c - 1) + 'b' + 'a' * (c - d - 1) + 'b' + 'a' * d
	print(s)


for _ in range(int(input())):
	(n, m) = map(int, input().split())
	i = 1
	while i * (i - 1) / 2 < m:
		i += 1
	j = m - (i - 1) * (i - 2) // 2
	ans = 'a' * (n - i) + 'b' + 'a' * (i - j - 1) + 'b' + 'a' * (j - 1)
	print(ans)


for _ in range(int(input())):
	(n, k) = (int(o) for o in input().split())
	for i in range(n - 1):
		l = i * (i + 1) // 2
		r = (i + 1) * (i + 2) // 2
		if l < k <= r:
			lp = n - i - 2
			rp = n - k + l
			break
	ans = ''
	ans = lp * 'a' + 'b' + (rp - lp - 1) * 'a' + 'b' + (n - rp - 1) * 'a'
	print(ans)


import math
t = int(input())
while t > 0:
	l = list(map(int, input().split()))
	x = l[0]
	k = l[1]
	if k == 1:
		for j in range(x - 2):
			if x - 2 != 0:
				print('a', end='')
		print('bb')
	elif k > 1:
		n = math.ceil((-1 + math.sqrt(1 + 8 * k)) / 2)
		i = x - (k - n * (n - 1) / 2)
		for j in range(x):
			if j == x - n - 1:
				print('b', end='')
			elif j == i:
				print('b', end='')
			else:
				print('a', end='')
		print()
	t = t - 1


debug = False

def calc_result(n, k):
	(current_substr_len, i_index_in_subarray) = find(k - 1)
	begin_a_len = n - (current_substr_len + 1)
	beginstr = ''
	for i in range(begin_a_len):
		beginstr += 'a'
	str = beginstr + 'b' + gen_str_with_b_at_index(current_substr_len, i_index_in_subarray)
	val = str
	return val

def find(i):
	list_index = 0
	current_substr_len = 1
	block_start_index = 0
	block_end_index = 0
	while True:
		block_start_index = list_index
		block_end_index = block_start_index + current_substr_len - 1
		if i >= block_start_index and i <= block_end_index:
			i_index_in_subarray = i - block_start_index
			return (current_substr_len, i_index_in_subarray)
		else:
			list_index = block_end_index + 1
			current_substr_len += 1

def gen_strings(length, begin_a_len):
	strings = [None] * (length - 1)
	beginstr = ''
	for i in range(begin_a_len):
		beginstr += 'a'
	for i in range(length - 1):
		str = beginstr + 'b' + gen_str_with_b_at_index(length - 1, i)
		strings[i] = str
	return strings

def gen_str_with_b_at_index(length, index):
	arr = [None] * length
	for i in range(length):
		arr[i] = 'a'
	arr[index] = 'b'
	arr.reverse()
	string = char_arr_to_str(arr)
	return string

def char_arr_to_str(arr):
	str = ''
	for i in range(len(arr)):
		str += arr[i]
	return str
tests_count = int(input())
for i in range(tests_count):
	line = input()
	n = int(line.split(' ')[0])
	k = int(line.split(' ')[1])
	res = calc_result(n, k)
	print(res)


from collections import defaultdict
t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	lst = ['#'] * n
	k = n * (n - 1) // 2 - k + 1
	lastsub = n - 1
	pos = 0
	while k > 0:
		k -= lastsub
		if k <= 0:
			break
		lastsub -= 1
		pos += 1
	lst[pos] = 'b'
	k += lastsub
	lst[pos + k] = 'b'
	for i in range(len(lst)):
		if lst[i] != 'b':
			lst[i] = 'a'
	print(''.join(lst))


test = int(input())
while test > 0:
	test -= 1
	(n, k) = map(int, input().split())
	(pos1, pos2) = (-1, -1)
	for i in range(n - 1, 0, -1):
		if k <= n - i:
			pos1 = i
			pos2 = n - k + 1
			break
		k -= n - i
	print('a' * (pos1 - 1) + 'b' + 'a' * (pos2 - pos1 - 1) + 'b' + 'a' * (n - pos2))


t = int(input())
for _ in range(t):
	(n, k) = list(map(int, input().split()))
	a = 0
	add = 0
	for i in range(n):
		if i * (i + 1) / 2 >= k:
			add = i * (i + 1) / 2
			a = i
			break
	if add == k:
		s = int(n - a - 1) * 'a' + 2 * 'b' + int(a - 2 + 1) * 'a'
		print(s)
	else:
		d = add - k
		s = int(n - a - 1) * 'a' + 'b' + int(d) * 'a' + 'b' + int(a - d - 1) * 'a'
		print(s)


for tc in range(int(input())):
	(n, k) = [int(x) for x in input().split()]
	s = ['a' for i in range(n)]
	for i in range(n - 2, -1, -1):
		if k <= n - i - 1:
			s[i] = 'b'
			s[n - k] = 'b'
			print(*s, sep='')
			break
		k -= n - i - 1


import math

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

def rList():
	return list(map(int, input().split()))
lis = [1]
temp = 1
for i in range(2, 10 ** 5 + 1):
	temp += i
	lis.append(temp)
t = int(input())
for i in range(t):
	(n, k) = rMap()
	f = n - 2
	s = n - 1
	count = 0
	temp = 0
	for i in lis:
		count += 1
		if k <= i:
			x = count
			y = k - temp
			break
		temp = i
	x -= 1
	y -= 1
	if y < 0:
		y = 0
	f -= x
	s -= y
	ans = ['a'] * n
	ans[f] = 'b'
	ans[s] = 'b'
	print(''.join(ans))


import math
t = int(input())
for _ in range(t):
	(n, k) = list(map(int, input().split()))
	x = int(math.ceil((math.sqrt(1 + 8 * k) - 1) / 2))
	y = x * (x - 1) // 2
	x = x + 1
	y = k - y
	s = 'a' * (n - x) + 'b' + (x - y - 1) * 'a' + 'b' + (y - 1) * 'a'
	print(s)


for t in range(int(input())):
	(n, k) = map(int, input().split())
	p = int((pow(8 * k + 1, 0.5) - 1) // 2)
	if p * (p + 1) // 2 == k:
		p -= 1
	x = ['a'] * n
	x[n - 2 - p] = 'b'
	k -= int(p * (p + 1) // 2)
	x[n - k] = 'b'
	print(''.join(x))


from math import *
from bisect import bisect_left, bisect_right
from sys import stdin, stdout, setrecursionlimit
from collections import Counter
input = lambda : stdin.readline().strip()
print = stdout.write
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	index = ceil((sqrt(1 + 8 * k) - 1) / 2) - 1
	index2 = k - index * (index + 1) // 2
	ls = []
	for i in range(n):
		if i == n - 2 - index or i == n - index2:
			ls.append('b')
		else:
			ls.append('a')
	print(str(''.join(ls)) + '\n')


import bisect
s = [0, 1]
for i in range(2, 100001):
	s.append(i + s[i - 1])
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	i = bisect.bisect_left(s, b)
	ans = ['a'] * a
	ans[a - i - 1] = 'b'
	ans[a + s[i - 1] - b] = 'b'
	print(''.join(ans))


def main():
	t = int(input())
	for _ in range(t):
		(n, k) = map(int, input().split())
		(p, q) = (1, 0)
		for i in range(1, n):
			if i * (i + 1) // 2 >= k:
				p = i
				q = k - i * (i - 1) // 2 - 1
				break
		ans = ''
		for i in range(n):
			if i == p or i == q:
				ans += 'b'
			else:
				ans += 'a'
		print(ans[::-1])
main()


for test_i in range(int(input())):
	(n, k) = map(int, input().split())
	k -= 1
	m0 = int((2 * k) ** 0.5)
	if m0 * (m0 + 1) <= 2 * k:
		m = m0
	else:
		m = m0 - 1
	print('a' * (n - m - 2) + 'b' + 'a' * (m - k + m * (m + 1) // 2) + 'b' + 'a' * (k - m * (m + 1) // 2))


count = [0]
for i in range(1, 10 ** 5 + 5):
	count.append(count[-1] + i)
import math
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	out = 0
	p = -1
	for i in range(1, 100004):
		if count[i - 1] < k <= count[i]:
			out = i - 1
			p = count[i - 1]
			break
	m = 0
	c = 0
	a = ['a'] * n
	a[n - 2 - out] = 'b'
	a[n - (k - p)] = 'b'
	print(''.join(a))


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	opts = 0
	b_pos = n - 2
	while opts + (n - b_pos - 1) < k:
		opts += n - b_pos - 1
		b_pos -= 1
	b_pos2 = n - (k - opts)
	res = ['a'] * n
	res[b_pos] = 'b'
	res[b_pos2] = 'b'
	print(''.join(res))


def c(a, b):
	return a * (a - 1) // 2
s = []
for eejj in range(int(input())):
	(n, k) = map(int, input().split())
	r = ['a'] * n
	g = 0
	for i in range(1, n + 1):
		if g == 0:
			if c(n - i, 2) < k:
				r[i - 1] = 'b'
				g = 1
				break
	r[c(n - i, 2) - k] = 'b'
	s.append(''.join(r))
for i in s:
	print(i)


for _ in range(int(input())):
	(n, k) = map(int, input().strip().split())
	cnt = 1
	r = -1
	for i in range(1, n):
		if k > i:
			cnt += 1
			k -= i
		else:
			cnt += 1
			r = k % i
			break
	strs = 'a' * n
	l = list(strs)
	if r == 0:
		l[cnt - 1:cnt] = 'b'
		l[cnt - 2:cnt - 1] = 'b'
		l = ''.join(l[::-1])
		print(l)
	else:
		l[cnt - 1:cnt] = 'b'
		l[r - 1:r] = 'b'
		l = ''.join(l[::-1])
		print(l)


import math
t = int(input())
for i in range(t):
	(n, k) = input().split()
	(n, k) = (int(n), int(k))
	det = 8 * k + 1
	M = math.ceil((math.sqrt(det) - 1) / 2)
	m = k - int((M - 1) * M / 2)
	s = ['a' for i in range(n)]
	s[-m] = 'b'
	s[-(M + 1)] = 'b'
	print(''.join(s))


t = int(input())
for w in range(t):
	(n, k) = (int(i) for i in input().split())
	for i in range(2, n + 1):
		if i * (i - 1) // 2 >= k:
			k1 = (i - 1) * (i - 2) // 2 + 1
			print('a' * (n - i) + 'b' + 'a' * (i + k1 - k - 2) + 'b' + 'a' * (k - k1))
			break


for _ in range(int(input())):
	(n, k) = [int(x) for x in input().split()]
	ans = ['a'] * n
	i = n - 2
	while i >= 0:
		if k <= n - i - 1:
			ans[i] = 'b'
			ans[n - k] = 'b'
			break
		k -= n - i - 1
		i -= 1
	print(''.join(ans))


(z, zz) = (input, lambda : list(map(int, z().split())))
zzz = lambda : [int(i) for i in stdin.readline().split()]
(szz, graph, mod, szzz) = (lambda : sorted(zz()), {}, 10 ** 9 + 7, lambda : sorted(zzz()))
from string import *
from collections import *
from queue import *
from sys import *
from collections import *
from math import *
from heapq import *
from itertools import *
from bisect import *
from collections import Counter as cc
from math import factorial as f
from bisect import bisect as bs
from bisect import bisect_left as bsl
from itertools import accumulate as ac

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def prime(x):
	p = ceil(x ** 0.5) + 1
	for i in range(2, p):
		if x % i == 0 and x != 2 or x == 0:
			return 0
	return 1

def dfs(u, visit, graph):
	visit[u] = True
	for i in graph[u]:
		if not visit[i]:
			dfs(i, visit, graph)
num = int(z())
for _ in range(num):
	(n, m) = zz()
	i = cur = 1
	k = m
	while cur + i <= m:
		cur += i
		i += 1
	s = ['a'] * n
	s[n - i - 1] = s[n - k + cur - 1] = 'b'
	print(''.join(s))


t = int(input())
for x in range(t):
	(n, k) = map(int, input().split())
	res = ['a'] * n
	s = int(n * (n - 1) / 2)
	mark = 0
	mark1 = 1
	for i in range(n - 1, 0, -1):
		if s == k:
			mark1 = n - mark - 1
			break
		if s < k:
			mark1 = k - s
			mark -= 1
			break
		s -= i
		mark += 1
	res[mark] = 'b'
	res[n - mark1] = 'b'
	e = ''.join(map(str, res))
	print(e)


import math
t = int(input())
while t:
	(n, k) = input().split(' ')
	n = int(n)
	k = int(k)
	delta = 8 * k + 1
	group = int(math.ceil((1 + delta ** 0.5) / 2.0))
	lower = (group - 1) * (group - 2) // 2
	second = k - lower
	out = ['a' for _ in range(n)]
	out[group - 1] = 'b'
	out[second - 1] = 'b'
	print(''.join(out[::-1]))
	t -= 1


t = int(input())
su = []
x = 1
la = 0
for j in range(100000):
	la += x
	x += 1
	su.append(la)
for i in range(t):
	(n, k) = map(int, input().split())
	z = 0
	flag = 0
	for j in range(n):
		if su[j] == k:
			z = j + 1
			flag = 1
			break
		elif j >= 1 and su[j - 1] < k and (su[j] > k):
			z = j + 1
			break
	b1 = n - z
	if flag == 1:
		b2 = n - (z - 1)
	else:
		b2 = n - (k - su[z - 2] - 1)
	for j in range(1, n + 1):
		if j == b1 or j == b2:
			if j == n:
				print('b')
			else:
				print('b', end='')
		elif j == n:
			print('a')
		else:
			print('a', end='')


import math
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	res = ['a'] * n
	first = n - int(math.ceil((math.ceil(math.sqrt(1 + 8 * k)) - 1) / 2)) - 1
	second = n - (k - (first - n + 1) * (first - n + 2) // 2)
	res[first] = 'b'
	res[second] = 'b'
	print(''.join(res))


import math
t = int(input())

def strab(n, k):
	b1 = math.ceil(1 / 2 * (math.sqrt(8 * k + 1) + 1))
	b2 = int(b1 * (b1 - 1) / 2 - k + 1)
	b1 = n - b1
	b2 += b1
	string = ['a'] * n
	string[b1] = 'b'
	string[b2] = 'b'
	return ''.join(string)
outputs = ''
for _ in range(t):
	(n, k) = map(int, input().split())
	string = strab(n, k)
	outputs += string + '\n'
print(outputs.rstrip())


def binarySearch(arr, x):
	l = 0
	r = len(arr) - 1
	while l <= r:
		mid = (l + r) // 2
		if arr[mid] == x:
			return (mid, arr[mid - 1] + 1)
		elif arr[mid] < x:
			l = mid + 1
		else:
			r = mid - 1
	return (l, arr[l - 1] + 1)
sm = 0
i = 1
ar = []
while sm <= 2 * 10 ** 9:
	sm += i
	ar.append(sm)
	i += 1
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = ['a'] * n
	(a, c) = binarySearch(ar, k)
	a += 1
	if k == 1:
		b = 0
	else:
		b = k % c
	s[a] = 'b'
	s[b] = 'b'
	print(''.join(s)[::-1])


def solve(n, k):
	(first, second) = (n - 2, n - 1)
	for i in range(n - 2, -1, -1):
		no = n - i - 1
		if no >= k:
			first = i
			second = n - k
			break
		else:
			k -= no
	ans = ['a'] * n
	ans[first] = 'b'
	ans[second] = 'b'
	return ''.join(ans)
for _ in range(int(input())):
	(n, k) = input().strip().split()
	n = int(n)
	k = int(k)
	ans = solve(n, k)
	print(ans)


for _ in range(int(input())):
	(n, k) = [int(i) for i in input().split()]
	count = 1
	b_one = 1
	while True:
		if k <= b_one:
			b_prev = b_one - count
			break
		count += 1
		b_one += count
	b1 = count
	b2 = k - b_prev - 1
	res = ''
	for j in range(n - 1, -1, -1):
		res += 'b' if j == b1 or j == b2 else 'a'
	print(res)


from os import path
import sys
from math import ceil, floor, gcd, log2
from collections import defaultdict, Counter
maxx = float('inf')
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
	I = lambda : int(sys.stdin.buffer.readline())
	tup = lambda : map(int, sys.stdin.buffer.readline().split())
	lint = lambda : [int(x) for x in sys.stdin.buffer.readline().split()]
	S = lambda : sys.stdin.readline().replace('\n', '').strip()
	stpr = lambda x: sys.stdout.write(f'{x}' + '\n')
	star = lambda x: print(' '.join(map(str, x)))
else:
	I = lambda : int(sys.stdin.buffer.readline())
	tup = lambda : map(int, sys.stdin.buffer.readline().split())
	lint = lambda : [int(x) for x in sys.stdin.buffer.readline().split()]
	S = lambda : sys.stdin.readline().replace('\n', '').strip()
	stpr = lambda x: sys.stdout.write(f'{x}' + '\n')
	star = lambda x: print(' '.join(map(str, x)))

def nextp(s):
	n = len(s)
	(bi, bj) = (-1, -1)
	for i in range(n - 1, 0, -1):
		if s[i] > s[i - 1]:
			bi = i - 1
			break
	for j in range(n - 1, 0, -1):
		if s[j] > s[bi]:
			bj = j
			break
	(s[bi], s[bj]) = (s[bj], s[bi])
	s = s[:bi + 1] + s[bi + 1:n][::-1]
	return s
for _ in range(I()):
	(n, k) = tup()
	s = ['a'] * n
	for i in range(n - 2, -1, -1):
		if k <= n - i - 1:
			s[i] = 'b'
			s[n - k] = 'b'
			break
		k -= n - i - 1
	print(''.join(s))


from sys import stdin, gettrace
from math import sqrt
if not gettrace():

	def input():
		return next(stdin)[:-1]

def main():

	def solve():
		(n, k) = map(int, input().split())
		i = int((-1 + sqrt(8 * (k - 1) + 1)) / 2)
		j = k - 1 - i * (i + 1) // 2
		p1 = n - i - 1
		p2 = n - j
		print('a' * (p1 - 1) + 'b' + 'a' * (p2 - p1 - 1) + 'b' + 'a' * (n - p2))
	q = int(input())
	for _ in range(q):
		solve()
main()


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	arr = ['a'] * n
	for i in range(n - 2, -1, -1):
		if k <= n - 1 - i:
			arr[i] = 'b'
			arr[n - k] = 'b'
			break
		k -= n - 1 - i
	print(''.join(map(str, arr)))


def main():
	(n, k) = map(int, input().split())
	k -= 1
	ps = 1
	to_ch = 1
	while to_ch <= k:
		k -= to_ch
		to_ch += 1
		ps += 1
	ps2 = k
	ln = ''
	for i in range(n):
		if i != ps2 and i != ps:
			ln += 'a'
		else:
			ln += 'b'
	ln1 = ''
	for i in range(n - 1, -1, -1):
		ln1 += ln[i]
	print(ln1)
t = int(input())
for i in range(t):
	main()


t = int(input())
for fhafg in range(t):
	(n, k) = map(int, input().split())
	l = 0
	r = n
	while r - l != 1:
		s = (l + r) // 2
		if s * (s + 1) // 2 < k:
			l = s
		else:
			r = s
	ans = ['a'] * n
	ans[n - r - 1] = 'b'
	ans[n - k + l * (l + 1) // 2] = 'b'
	print(''.join(ans))


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	k -= 1
	ln = n * (n - 1) // 2
	ok = 0
	ng = n
	while ng - ok > 1:
		m = (ok + ng) // 2
		if m * (m + 1) // 2 <= k:
			ok = m
		else:
			ng = m
	x = ok
	y = k - ok * (ok + 1) // 2
	res = ['a'] * n
	res[x + 1] = 'b'
	res[y] = 'b'
	res.reverse()
	print(''.join(res))


sum = [0] * 100007
mad = 0
for i in range(1, 100005):
	mad += i
	sum[i] = mad
from bisect import bisect_left

def BinarySearch(a, x):
	i = bisect_left(a, x)
	if i:
		return i - 1
	else:
		return -1
for i in range(int(input())):
	(n, k) = map(int, input().split())
	l = BinarySearch(sum, k) + 1
	tup = (l + 1, l - (sum[l] - k))
	res = ['a'] * n
	for i in tup:
		res[n - i] = 'b'
	print(''.join(res))


import math

def main():
	for _ in range(int(input())):
		(n, k) = map(int, input().split())
		z = math.ceil((math.sqrt(8 * k + 1) - 1) / 2)
		k -= z * (z - 1) // 2
		print('a' * (n - z - 1) + 'b' + 'a' * (z - k) + 'b' + 'a' * (k - 1))
main()


import itertools as it
t = int(input())
while t:
	(a, k) = map(int, input().split())
	orig = a
	s = []
	while a:
		s.append('a')
		a -= 1
	for i in range(orig - 2, -1, -1):
		if k <= orig - i - 1:
			s[i] = 'b'
			s[orig - k] = 'b'
			print(''.join(s))
			break
		k -= orig - i - 1
	t -= 1


import math

def binarySearch(sum):
	low = 1
	high = sum
	while low < high:
		mid = math.ceil((low + high) / 2)
		s = mid * (mid + 1) / 2
		if s > sum:
			high = mid - 1
		elif s < sum:
			low = mid
		else:
			low = mid
			break
	if sum == low * (low + 1) / 2:
		return low - 1
	return low
test_cases = int(input())
data = []
while test_cases > 0:
	data.append(list(map(int, input().split())))
	test_cases -= 1
for element in data:
	sum = binarySearch(element[1])
	posb1 = int(element[0] - 2 - sum)
	posb2 = int(element[0] - (element[1] - sum * (sum + 1) / 2))
	toPrint = ['a'] * element[0]
	toPrint[posb1] = 'b'
	toPrint[posb2] = 'b'
	print(*toPrint, sep='')


import math

def c(x):
	t = math.floor(math.sqrt(2 * x + 1) + 0.5)
	return 0.5 * (t - t ** 2 + 2 * x)

def b(x):
	return math.floor(0.5 + math.sqrt(2 * x))

def a(x):
	return (b(x), c(x - 1))
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	(f, s) = a(k)
	arr = n * ['a']
	arr[n - 1 - int(f)] = 'b'
	arr[n - 1 - int(s)] = 'b'
	print(''.join(arr))


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	count = 1
	(l, r) = (1, 0)
	while count < k:
		l += 1
		count += l
	r = l - 1
	if count != k:
		r -= count - k
	l += 1
	r += 1
	res = ['a'] * n
	res[-l] = res[-r] = 'b'
	print(''.join(res))


import math
t = int(input())
while t > 0:
	(n, k) = list(map(int, input().split()))
	a = int(1 + (-0.5 + math.sqrt(0.5 * 0.5 - 2 + 2 * k)))
	b = k - 1 - (a - 1) * a / 2
	a = n - 1 - a
	b = n - 1 - b
	ans = 'a' * n
	a = int(a)
	b = int(b)
	ans = ans[:a] + 'b' + ans[a + 1:]
	ans = ans[:b] + 'b' + ans[b + 1:]
	print(ans)
	t -= 1


from math import ceil
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	x = ceil((-1 + (1 + 8 * b) ** 0.5) / 2)
	r = x * (x - 1) // 2
	c = ['a'] * a
	c[-x - 1] = 'b'
	c[r - b] = 'b'
	print(''.join(c))


from math import sqrt

def get_n(k):
	return int((-1 + sqrt(1 + 8 * k)) / 2)
t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	n = get_n(b)
	if n * (n + 1) // 2 == b:
		dif = n - 1
	else:
		n = n + 1
		dif = b - n * (n - 1) // 2 - 1
	lst = ['a'] * a
	lst[-1 - dif] = 'b'
	lst[-n - 1] = 'b'
	print(''.join(lst))


def ab(n, k):
	if k == 1:
		return 'a' * (n - 2) + 'bb'
	i = n
	j = 2
	while i - j > 1:
		m = (i + j) // 2
		if m * (m - 1) // 2 < k:
			j = m
		else:
			i = m
	x = k - j * (j - 1) // 2
	j = x
	return 'a' * (n - i) + 'b' + 'a' * (i - j - 1) + 'b' + 'a' * (j - 1)
for i in range(int(input())):
	(a, b) = map(int, input().split())
	print(ab(a, b))


t = int(input())
N = []
Y = []
Z = []
for i in range(0, t):
	(n, k) = map(int, input().split())
	b = 1
	while b * (b + 1) / 2 < k:
		b += 1
	y = b
	z = int(k - b * (b + 1) / 2 + b)
	N.append(n)
	Y.append(y)
	Z.append(z)
for i in range(0, t):
	for j in range(0, N[i] - Y[i] - 1):
		print('a', end='')
	print('b', end='')
	for j in range(0, Y[i] - Z[i]):
		print('a', end='')
	print('b', end='')
	for j in range(0, Z[i] - 1):
		print('a', end='')
	print()


t = int(input())
while t > 0:
	(n, k) = map(int, input().split())
	l = ['a'] * n
	s = ''
	a = 1
	b = 0
	c = 0
	while True:
		b = int(a * (a + 1) / 2)
		if b == k:
			l[n - a - 1] = 'b'
			l[n - a] = 'b'
			break
		if b > k:
			c = int(a * (a - 1) / 2)
			d = k - c
			l[n - a - 1] = 'b'
			l[n - d] = 'b'
			break
		a += 1
	for x in l:
		s += x
	print(s)
	t -= 1


t = int(input())
import itertools
for _ in range(t):
	(n, k) = map(int, input().split())
	for i in range(3, n + 1):
		if i * (i - 1) // 2 >= k:
			break
	l = ['a'] * n
	if i == 3:
		if k == 1:
			l[-1] = 'b'
			l[-2] = 'b'
		elif k == 2:
			l[-1] = 'b'
			l[-3] = 'b'
		else:
			l[-2] = 'b'
			l[-3] = 'b'
	else:
		l[-i] = 'b'
		j = k - (i - 1) * (i - 2) // 2
		l[-j] = 'b'
	ans = ''.join(l)
	print(ans)


import math
t = int(input())
for _ in range(t):
	(n, k) = [int(i) for i in input().split()]
	k1 = math.ceil((1 + math.sqrt(1 + 8 * k)) / 2)
	r1 = int((k1 - 2) * (k1 - 1) / 2)
	s = k - r1
	if s == k1:
		s = 1
		k1 += 1
	k1 = n - k1
	s = n - s
	st = 'a' * k1 + 'b' + 'a' * (s - k1 - 1) + 'b' + 'a' * (n - s - 1)
	print(st)


t = int(input())
while t > 0:
	(n, k) = map(int, input().split())
	c = 0
	if k == 1:
		print('a' * (n - 2) + 'b' * 2)
	else:
		for i in range(1, n):
			k -= i
			if k <= i + 1:
				c = i + 1
				d = k
				break
		l = ['a' for i in range(n)]
		l[n - c - 1] = 'b'
		l[n - d] = 'b'
		print(''.join(l))
	t -= 1


import math

def so(x):
	return x * (x - 1) // 2
a = int(input())
for i in range(a):
	(x, y) = map(int, input().split())
	al = int(math.sqrt(1 + 8 * y))
	sol = (1 + al) // 2
	if so(sol) >= y and so(sol - 1) < y:
		sol = sol
	elif so(sol + 1) >= y and so(sol - 1) < y:
		sol = sol + 1
	elif so(sol + 2) >= y and so(sol - 1) < y:
		sol = sol + 2
	elif so(sol - 1) >= y and so(sol - 2) < y:
		sol = sol - 1
	elif so(sol - 2) >= y and so(sol - 3) < y:
		sol = sol - 2
	tot = y - so(sol - 1)
	z = []
	sol = sol - 1
	for i in range(x):
		z.append('a')
	z[x - sol - 1] = 'b'
	z[x - tot] = 'b'
	print(''.join(map(str, z)))


t = int(input())
a = [n * (n - 1) // 2 for n in range(100000)]
a[0] = 0
a[1] = 0
for i in range(t):
	nk = [int(i) for i in input().strip('\n').split(' ')]
	n = nk[0]
	k = nk[1]
	ans = ['a' for i in range(n)]
	p = 0
	for j in range(1, n + 1):
		if a[j] >= k:
			p = j
			break
	ans[-j] = 'b'
	ans[-(j - a[j] + k - 1)] = 'b'
	for c in ans:
		print(c, end='')
	print()


import math

def f(a, b):
	b2 = math.ceil((math.sqrt(1 + 8 * b) - 1) / 2)
	b1 = b - int(b2 * (b2 - 1) / 2) - 1
	v = ''
	for i in range(a - 1, -1, -1):
		if i == b2 or i == b1:
			v += 'b'
		else:
			v += 'a'
	print(v)
t = int(input())
for i in range(t):
	(a, b) = list(map(int, input().split()))
	f(a, b)


import math
t = int(input())
while t:
	t += -1
	(n, k) = map(int, input().split())
	s = 0
	ind = 0
	for i in range(1, n + 1):
		s += i
		if s >= k:
			ind = i
			break
	pos1 = n - ind - 1
	pos2 = pos1 + s - k + 1
	s = ['a'] * n
	s[pos1] = 'b'
	s[pos2] = 'b'
	for i in s:
		print(i, end='')
	print()


for x in range(1):
	for tinnn in range(int(input())):
		(n, k) = map(int, input().split())
		j = 0
		for i in range(n ** 2):
			if k <= i * (i + 1) // 2:
				h2 = k - i * (i - 1) // 2
				break
		i = n - i
		j = n - h2 + 1
		s = list('a' * n)
		s[i - 1] = 'b'
		s[j - 1] = 'b'
		for _ in range(len(s) - 1):
			print(s[_], end='')
		print(s[-1])


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split(' '))
	for j in range(n):
		if k <= j * (j + 1) / 2:
			string = ''
			con = int(j * (j + 1) / 2 - k)
			for length in range(n - j - 1):
				string += 'a'
			string += 'b'
			for length in range(con):
				string += 'a'
			string += 'b'
			for length in range(j - 1 - con):
				string += 'a'
			print(string)
			break


import math
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	if k == 1:
		f = 1
		r = 0
	else:
		k -= 1
		f = math.floor((1 + math.sqrt(1 + 8 * k)) / 2)
		r = 0
		w = k - 1
		while math.floor((1 + math.sqrt(1 + 8 * w)) / 2) == f:
			r += 1
			w -= 1
	jam = 2 ** f + 2 ** r
	s = str(bin(jam)[2:].zfill(n)).replace('0', 'a').replace('1', 'b')
	print(s)


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	z = int((2 * k) ** 0.5)
	li = ['a'] * n
	for y in range(z, -1, -1):
		a = y * (y + 1) // 2
		if a <= k:
			break
	if a == k:
		li[n - 1 - y] = 'b'
		li[n - y] = 'b'
	else:
		x = k - a
		li[n - y - 2] = 'b'
		li[n - x] = 'b'
	print(''.join(li))


import sys
import math
import heapq
import collections

def inputnum():
	return int(input())

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

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

def inputstring():
	return [x for x in input()]

def inputmatrixchar(rows):
	arr2d = [[j for j in input().strip()] for i in range(rows)]
	return arr2d

def inputmatrixint(rows):
	arr2d = []
	for _ in range(rows):
		arr2d.append([int(i) for i in input().split()])
	return arr2d
t = int(input())
for q in range(t):
	(n, k) = inputnums()
	rtn = ['a'] * n
	x = 1
	while (x + 1) * x // 2 < k:
		x += 1
	x -= 1
	rem = k - (x + 1) * x // 2
	rtn[n - rem] = 'b'
	rtn[n - 2 - x] = 'b'
	for c in rtn:
		print(c, end='')
	print()


t = int(input())
for i in range(t):
	[n, k] = list(map(int, input().split()))
	r = 0
	while k > r * (r + 1) / 2:
		r += 1
	r -= 1
	p = k - r * (r + 1) // 2
	print('a' * (n - r - 2) + 'b' + 'a' * (r - p + 1) + 'b' + 'a' * (p - 1))


import math
for _ in range(0, int(input())):
	(n, k) = map(int, input().split())
	f = math.ceil((math.sqrt(8 * k + 1) - 1) / 2) + 1
	s = k - (f - 1) * (f - 2) // 2
	for i in reversed(range(1, n + 1)):
		if i == f or i == s:
			print('b', end='')
		else:
			print('a', end='')
	print('')


import sys
from collections import Counter
import math
NN = 10 ** 5 + 1
input = sys.stdin.readline
testcases = int(input())
for i in range(testcases):
	(n, k) = map(int, input().split())
	ans = n * (n - 1) // 2
	res = -1
	for j in range(1, NN):
		res = j * (j + 1) / 2
		if res >= k:
			break
	NEW_ANSWER = j * (j - 1) // 2
	NEW_ANSWER = k - NEW_ANSWER - 1
	first = n - j
	second = n - NEW_ANSWER
	RESULT = ''
	for i in range(1, n + 1):
		if i == second or i == first:
			RESULT += 'b'
		else:
			RESULT += 'a'
	print(RESULT)


t = int(input())
for i in range(t):
	nk = list(map(int, input().split()))
	n = nk[0]
	k = nk[1]
	counter = 0
	step = 1
	while counter + step < k:
		counter += step
		step += 1
	firstPointer = n - 1 - step
	secondPointer = n - (k - counter)
	string = ['a' for i in range(n)]
	string[firstPointer] = 'b'
	string[secondPointer] = 'b'
	print(''.join(string))


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	temp1 = n - 2
	temp2 = n - 1
	(aux, key) = (0, 0)
	for i in range(1, n):
		if aux >= k:
			break
		else:
			aux += i
			key = i
	temp1 = temp1 - key + 1
	aux -= key
	x = k - aux
	temp2 = temp2 - x + 1
	res = ''
	for i in range(n):
		if i == temp1 or i == temp2:
			res += 'b'
		else:
			res += 'a'
	print(res)


import os
import sys
from io import BytesIO, IOBase

def main():
	pass
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

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

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

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

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

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()
t = int(input())
while t > 0:
	t -= 1
	(n, k) = map(int, input().split())
	ind = 1
	i = 1
	pos = 2
	pre = 1
	while ind <= k:
		pre = ind
		ind = ind + i
		i += 1
		pos += 1
	b1 = pos - 1
	b2 = k - pre
	a = ['a'] * n
	a[-b1] = 'b'
	a[-b2 - 1] = 'b'
	print(''.join(a))


for i in range(int(input())):
	(n, k) = map(int, input().split())
	i = cur = 1
	while cur + i <= k:
		cur += i
		i += 1
	s = ['a'] * n
	s[n - i - 1] = s[n - k + cur - 1] = 'b'
	print(''.join(s))


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	i = 0
	while i * (i + 1) // 2 + 1 <= k:
		i += 1
	i -= 1
	rem = k - (i * (i + 1) // 2 + 1)
	latter = 'b' + 'a' * rem
	x = i - rem
	pre = 'b' + 'a' * x
	late = pre + latter
	x = n - len(late)
	print('a' * x + late)


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	L = ['a' for __ in range(n)]
	m = int((2 * k) ** 0.5)
	if m * (m + 1) < 2 * k < (m + 1) * (m + 1):
		m += 1
	L[m] = 'b'
	k -= m * (m - 1) // 2
	L[k - 1] = 'b'
	for i in range(n, 0, -1):
		print(L[i - 1], end='')
	print()


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	(i, c) = (1, 2)
	while i < k:
		i += c
		c += 1
	(b, bb) = (c, k - (i - c + 1))
	ans = 'a' * (n - b) + 'b' + 'a' * (b - bb - 1) + 'b' + 'a' * (bb - 1)
	print(ans)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	p = 0
	for i in range(1, n + 1):
		if i * (i + 1) // 2 >= k:
			p = i - 1
			break
	k -= p * (p + 1) // 2
	b1 = -p - 2
	b2 = -k
	s = ['a'] * n
	s[b1] = 'b'
	s[b2] = 'b'
	print(''.join(s))


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	ans = [0] * (n + 1)
	b_idx = 2
	val = 1
	interval = 2
	while val < k:
		val += interval
		interval += 1
		b_idx += 1
	ans[b_idx] = 1
	if val - k == 0:
		ans[b_idx - 1] = 1
	else:
		ans[b_idx - (val - k) - 1] = 1
	cnt = 0
	for j in reversed(ans):
		cnt += 1
		if cnt == n + 1:
			break
		if j == 0:
			print('a', end='')
		else:
			print('b', end='')
	print()


def b(a):
	f = 0
	s = 2 ** 18
	while f < s - 1:
		m = (f + s) // 2
		if m * (m + 1) // 2 >= a:
			s = m
		else:
			f = m
	return (-s - 1, s * (s - 1) // 2 - a)
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	(f, s) = b(k)
	a = ['a' for i in range(n)]
	a[f] = 'b'
	a[s] = 'b'
	print(''.join(a))


for i in range(int(input())):
	x = list(map(int, input().split()))
	v = (-1 + (1 + 8 * x[1]) ** (1 / 2)) / 2
	n = int(v) + (v % 1 > 0)
	s = int(n * (n + 1) / 2) - x[1]
	print((x[0] - (n + 1)) * 'a' + 'b' + s * 'a' + 'b' + (n - s - 1) * 'a')


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	i = 1
	c = 0
	pos2 = 0
	ans = ['a' for i in range(n)]
	while k > c + i:
		c = c + i
		i += 1
	pos1 = n - 1 - i
	start = c + 1
	shift = k - start
	pos2 = n - 1 - shift
	ans[pos1] = 'b'
	ans[pos2] = 'b'
	print(''.join(ans))


for j in range(int(input())):
	(m, k) = map(int, input().split())
	ans = ['a' for i in range(m)]
	(index1, index2) = (None, None)
	for n in range(1, 1000000):
		if n * (n - 1) <= 2 * k <= n ** 2 + n:
			index1 = n
			ans[n] = 'b'
			break
	index2 = k - index1 * (index1 - 1) // 2 - 1
	ans[index2] = 'b'
	for u in range(m - 1, -1, -1):
		print(ans[u], end='')
	print()


import math
t = int(input())
for _ in range(t):
	[x, y] = [int(i) for i in input().split(' ')]
	st = []
	for _ in range(x):
		st.append('a')
	y -= 1
	pos1 = 1
	pos2 = 0
	while pos1 <= y:
		y -= pos1
		pos1 += 1
	pos2 = y
	st[x - pos1 - 1] = 'b'
	st[x - pos2 - 1] = 'b'
	print(''.join(st))


a = [0] * 100002
for i in range(1, len(a)):
	a[i] = a[i - 1] + i
a.reverse()
t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	b = ['a'] * n
	l = 1
	r = len(a) - 1
	while r - l != 1:
		m = l + (r - l + 1) // 2
		if a[m] >= k:
			l = m
		else:
			r = m
	b[l - (len(a) - n)] = 'b'
	b[l - (len(a) - n) + (a[l] - k + 1)] = 'b'
	print(*b, sep='')


def cal(num):
	return num * (num - 1) // 2
for _ in range(1, int(input()) + 1):
	(N, k) = map(int, input().split())
	string = ['a'] * N
	target = N
	while cal(target) >= k:
		target -= 1
	string[-target - 1] = 'b'
	string[cal(target) - k] = 'b'
	print(''.join(string))


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

def findkpos(k):
	l = 0
	h = 10 ** 5
	while l < h:
		m = (l + h) // 2
		if d[m] == k:
			return (m, True)
		elif d[m] < k:
			l = m + 1
		else:
			h = m
	return (l, False)
d = [1 + (i + 1) * (i + 2) // 2 for i in range(10 ** 5)]
cases = int(input())
for t in range(cases):
	(n, k) = list(map(int, input().split()))
	s = ['a'] * n
	if k == 1:
		s[-1] = 'b'
		s[-2] = 'b'
	else:
		(pos, bl) = findkpos(k)
		if bl:
			s[-1] = 'b'
			dist = -3 - pos
			s[dist] = 'b'
		else:
			pos -= 1
			dist = -3 - pos
			s[dist] = 'b'
			pos2 = k % d[pos]
			dist = -1 - pos2
			s[dist] = 'b'
	print(''.join(s))


import bisect
prefix = [0, 1]
for i in range(2, 200000):
	prefix.append(prefix[-1] + i)
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	ind = bisect.bisect_left(prefix, k) + 1
	ind2 = k - prefix[ind - 2]
	ans = ''
	for ind3 in range(1, n + 1):
		if ind3 == ind or ind3 == ind2:
			ans += 'b'
		else:
			ans += 'a'
	print(ans[::-1])


tc = int(input())
for t in range(0, tc):
	(n, k) = input().split(' ')
	n = int(n)
	k = int(k)
	new = ['a' for i in range(0, n)]
	for i in reversed(range(n - 1)):
		if k <= n - i - 1:
			new[i] = 'b'
			new[n - k] = 'b'
			''.join(new)
			for x in new:
				print(x, end='')
			print('')
			break
		k -= n - i - 1


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	s = 0
	st = ''
	for i in range(1, n):
		su = i * (i + 1) // 2
		if su >= k:
			s = i
			break
	b1 = n - 1 - s
	b2 = n - (k - (s - 1) * s // 2)
	st += 'a' * b1 + 'b' + 'a' * (b2 - b1 - 1) + 'b' + 'a' * (n - b2 - 1)
	print(st)


import sys
sys.setrecursionlimit(100000)
n = int(input())
for _ in range(n):
	(N, K) = map(int, sys.stdin.readline().split())
	ch = ['a'] * N
	for i in range(N - 2, -1, -1):
		numOfLeftInIPos = N - 1 - i
		if K <= numOfLeftInIPos:
			ch[i] = 'b'
			ch[N - K] = 'b'
			print(''.join(ch))
			break
		K -= numOfLeftInIPos


def get_d(x):
	left = 1
	right = x
	while left + 1 < right:
		m = left + (right - left) // 2
		if (1 + m) * m // 2 > x:
			right = m
		else:
			left = m
	if (1 + left) * left // 2 >= x:
		return left
	else:
		return right
t = int(input())
for g in range(t):
	(n, k) = map(int, input().split())
	bf = get_d(k)
	first_pos = bf + 1
	second_pos = 0
	second_pos += bf - ((1 + bf) * bf // 2 - k)
	res = ['a'] * n
	res[n - first_pos] = 'b'
	res[n - second_pos] = 'b'
	print(''.join(res))


def cat(k):
	i = 1
	cur = 1
	while cur < k:
		cur += i
		i += 1
	if cur > k:
		i -= 1
		cur -= i
	two = i - 1 - (k - cur)
	return [i - 1, two]
t = int(input())
for i in range(t):
	(l, k) = map(int, input().split())
	a = l - 2
	ans = cat(k)
	one = a - ans[0]
	two = ans[1]
	print('a' * one + 'b' + 'a' * two + 'b' + 'a' * (a - one - two))


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	l = []
	for i in range(n - 2):
		l.append('a')
	l.append('b')
	l.append('b')
	oo = 1
	k2 = k
	while k2 > 0:
		k2 -= oo
		oo += 1
	oo -= 1
	newb = abs(k2)
	(l[n - 2], l[n - oo - 1]) = (l[n - oo - 1], l[n - 2])
	(l[n - 1], l[n - oo + newb]) = (l[n - oo + newb], l[n - 1])
	for i in l:
		print(i, end='')
	print()


t = int(input())
for loop in range(t):
	(n, k) = map(int, input().split())
	ans = ['a'] * n
	l = 0
	r = n - 1
	while r - l != 1:
		m = (r + l) // 2
		if (1 + m) * m // 2 >= k:
			r = m
		else:
			l = m
	ans[-1 - r] = 'b'
	r -= 1
	sub = k - (1 + r) * r // 2
	ans[-1 * sub] = 'b'
	print(''.join(ans))


t = int(input())
for i in range(t):
	(n, k) = [int(i) for i in input().split()]
	f = k
	sy = 0
	ch = 1
	while f - ch >= 0:
		f -= ch
		sy += 1
		ch += 1
	if f == 0:
		s = ['a'] * (ch - 2) + ['b'] + ['b'] + ['a'] * (n - ch)
	else:
		s = ['a'] * (f - 1) + ['b'] + ['a'] * (ch - f) + ['b'] + ['a'] * (n - ch - 1)
	s.reverse()
	for i in s:
		print(i, end='')
	print()


import sys, os, io

def rs():
	return sys.stdin.readline().rstrip()

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

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

def ws(s):
	sys.stdout.write(s + '\n')

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

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
import math, datetime, functools
from collections import deque, defaultdict, OrderedDict
import collections

def main():
	starttime = datetime.datetime.now()
	if os.path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	z = []
	e = 0
	for i in range(1, 100000 + 2):
		e += i
		z.append(e)
	for _ in range(ri()):
		(n, k) = ria()
		t = 0
		c = 0
		for i in z:
			if i >= k:
				break
			else:
				t = i
				c += 1
		f = k - t
		if i == k:
			s = 'a' * (n - 2 - c) + 'bb' + 'a' * c
		else:
			s = s = 'a' * (n - 2 - c) + 'b' + 'a' * (c - (f - 1)) + 'b' + 'a' * (f - 1)
		print(s)
	endtime = datetime.datetime.now()
	time = (endtime - starttime).total_seconds() * 1000
	if os.path.exists('input.txt'):
		print('Time:', time, 'ms')

class FastReader(io.IOBase):
	newlines = 0

	def __init__(self, fd, chunk_size=1024 * 8):
		self._fd = fd
		self._chunk_size = chunk_size
		self.buffer = io.BytesIO()

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size))
			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, size=-1):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size if size == -1 else size))
			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()

class FastWriter(io.IOBase):

	def __init__(self, fd):
		self._fd = fd
		self.buffer = io.BytesIO()
		self.write = self.buffer.write

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

class FastStdin(io.IOBase):

	def __init__(self, fd=0):
		self.buffer = FastReader(fd)
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

class FastStdout(io.IOBase):

	def __init__(self, fd=1):
		self.buffer = FastWriter(fd)
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.flush = self.buffer.flush
sys.stdin = FastStdin()
sys.stdout = FastStdout()
main()


l = [0]
N = 10 ** 5 + 1

def tri():
	for i in range(1, N):
		l.append(i * (i + 1) // 2)
tri()

def find(k, n):
	ind1 = 0
	ind2 = 0
	for i in range(1, N):
		if k == l[i]:
			return [n - i, n - i + 1]
		elif k < l[i]:
			return [n - i, n - (k - l[i - 1]) + 1]
	return [ind1, ind2]
t = int(input())
while t != 0:
	(n, k) = [int(i) for i in input().split()]
	x = find(k, n)
	for i in range(1, n + 1):
		if x[0] == i or x[1] == i:
			print('b', end='')
		else:
			print('a', end='')
	print()
	t = t - 1


import sys
test_c = int(input())
for i in range(0, test_c):
	num = input().split()
	line_len = int(num[0])
	pos = int(num[1])
	first = 0
	cur = 1
	rang = 1
	while cur < pos:
		if pos - cur >= rang:
			cur += rang
			rang += 1
		else:
			first += pos - cur
			cur = pos
	l = ['a' for i in range(0, line_len)]
	l[line_len - 1 - rang] = 'b'
	l[line_len - 1 - first] = 'b'
	print(''.join(l))


from math import *
t = int(input())
for y in range(t):
	(n, k) = map(int, input().split())
	a = ['a' for i in range(n)]
	ct = 0
	ch = -1
	for i in range(1, n):
		if ct >= k:
			break
		ch = i
		ct += i
	a[ch] = 'b'
	a[k - ct + ch - 1] = 'b'
	print(''.join(a[::-1]))


import math
t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	z = math.ceil((math.sqrt(8 * k + 1) - 1) / 2)
	z2 = k - z * (z - 1) // 2
	z += 1
	z = int(z)
	z2 = int(z2)
	print('a' * (n - z), end='')
	print('b', end='')
	print('a' * (z - z2 - 1), end='')
	print('b', end='')
	print('a' * (z2 - 1), end='')
	print()


def main():
	n = int(input())
	arr = []
	for i in range(n):
		(m, k) = tuple(map(int, input().split()))
		high = 1
		sum_ = 1
		while sum_ < k:
			high += 1
			sum_ += high
		low = k - (sum_ - high + 1)
		arr.append('a' * (m - 1 - high) + 'b' + 'a' * (high - 1 - low) + 'b' + 'a' * low)
		print('a' * (m - 1 - high) + 'b' + 'a' * (high - 1 - low) + 'b' + 'a' * low)
result = main()


import math as m
t = int(input())
for i in range(t):
	(n, k) = list(map(int, input().split()))
	f = (m.sqrt(8 * k + 1) - 1) // 2
	res = k - f * (f + 1) // 2
	if res != 0:
		f += 1
	f = n - 1 - f
	if res == 0:
		s = f + 1
	else:
		s = n - res
	for j in range(n):
		if j == f or j == s:
			print('b', end='')
		else:
			print('a', end='')
	print()


def fun(n):
	return int(n * (n + 1) // 2)
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	i = 1
	while i < k:
		k -= i
		i += 1
	st = ['a'] * n
	(st[i], st[k - 1]) = ('b', 'b')
	print(''.join(st[::-1]))


from math import sqrt
t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	if k == 1:
		string = ['b', 'b']
		actual_answer = ['a' for j in range(n - 2)]
		actual_answer = actual_answer + string
	else:
		temp = int(sqrt(2 * k))
		if temp * (temp + 1) >= 2 * k:
			temp -= 1
		length = temp + 2
		remiaining = k - temp * (temp + 1) // 2
		string = ['a' for j in range(length)]
		string[0] = 'b'
		string[length - remiaining] = 'b'
		actual_answer = ['a' for j in range(n - length)]
		actual_answer = actual_answer + string
	for j in actual_answer:
		print(j, end='')
	print()


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	flag = 0
	for i in range(n ** 2):
		if i * (i + 1) / 2 >= k:
			break
	indexb1 = i + 1
	indexb2 = k - i * (i - 1) / 2
	str1 = ''
	for i in range(n):
		if i == n - indexb1 or i == n - indexb2:
			str1 = str1 + 'b'
		else:
			str1 = str1 + 'a'
	print(str1)


t = int(input())
while t:
	t -= 1
	(n, k) = map(int, input().split())
	for i in range(k, -1, -1):
		if int((8 * i - 7) ** 0.5) == (8 * i - 7) ** 0.5:
			break
	j = int((-1 + (8 * i - 7) ** 0.5) / 2) + 1
	x = int((j ** 2 + j) / 2) + 2
	s = ['a'] * n
	s[-j - 1] = 'b'
	s[i - k - 1] = 'b'
	ss = ''
	for i in s:
		ss += i
	print(ss)


t = int(input())
for l in range(t):
	s = input().split()
	n = int(s[0])
	su = int(s[1]) * 2
	for i in range(1, n):
		ca = i * (i + 1)
		if ca == su:
			v = n - (i + 1)
			for k in range(n):
				if k == v or k == v + 1:
					print('b', end='')
				else:
					print('a', end='')
			print()
			break
		elif ca > su:
			v = n - (i + 1)
			i1 = (ca - su) // 2 + v + 1
			for k in range(n):
				if k == v:
					print('b', end='')
				elif k == i1:
					print('b', end='')
				else:
					print('a', end='')
			print()
			break
		else:
			pass


import math
from math import factorial as fac

def binomial(x, y):
	try:
		binom = fac(x) // fac(y) // fac(x - y)
	except ValueError:
		binom = 0
	return binom
t = int(input())
trinv = lambda n: binomial(1 + math.floor(1 / 2 + math.sqrt(2 + 2 * n)), 2) - (n + 1)
while t != 0:
	t -= 1
	c = list(map(int, input().rsplit()))
	n = c[0]
	k = c[1]
	mins = math.ceil((math.sqrt(8 * (k + 1) - 7) + 1) / 2)
	s = ''
	if k == 1:
		for i in range(n - 2):
			s += 'a'
		pass
		s += 'bb'
	elif k == n * (n - 1) / 2:
		s += 'bb'
		for i in range(n - 2):
			s += 'a'
		pass
	elif mins == n:
		s += 'b'
		rn = int(n * (n - 1) / 2 - k)
		for i in range(rn):
			s += 'a'
		s += 'b'
		for i in range(n - 2 - rn):
			s += 'a'
	else:
		nz = k - 1
		distb = trinv(nz)
		for i in range(n - mins):
			s += 'a'
		s += 'b'
		for i in range(distb):
			s += 'a'
		s += 'b'
		for i in range(n - 2 - distb - (n - mins)):
			s += 'a'
	print(s)


cases = int(input())
for w in range(cases):
	(n, k) = [int(i) for i in input().split()]
	b1 = n - 2
	b2 = n - 1
	cont = 1
	while k - cont > 0:
		b1 -= 1
		k = k - cont
		cont += 1
	b2 = b2 - k + 1
	for i in range(n):
		if i != b1 and i != b2:
			print('a', end='')
		else:
			print('b', end='')
	print()