#include <bits/stdc++.h>
long long calc(long long x) { return (x + 1) * x / 2; }
int find(int k) {
  int l = 1, r = k;
  while (l <= r) {
    int mid = (l + r) / 2;
    if (calc(mid) < k)
      l = mid + 1;
    else
      r = mid - 1;
  }
  return l;
}
int main() {
  int t, n, k;
  scanf("%d", &t);
  while (t--) {
    scanf("%d%d", &n, &k);
    int a = find(k);
    int fpos = n - a;
    int spos = n + 1 - (k - calc(a - 1));
    for (int i = 1; i <= n; i++) {
      if (i == fpos || i == spos) {
        putchar('b');
      } else {
        putchar('a');
      }
    }
    puts("");
  }
  return 0;
}
