#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, n, i;
  long long int l, r, ans, mid, m, k;
  cin >> t;
  while (t--) {
    scanf("%d%lld", &n, &k);
    l = 1;
    r = n - 1;
    ans = 1;
    while (l <= r) {
      mid = (l + r) >> 1;
      if ((mid + 1) * mid >= k * 2) {
        r = mid - 1;
        ans = mid;
      } else
        l = mid + 1;
    }
    ans--;
    for (i = n - 2 - ans; i >= 1; --i) printf("a");
    printf("b");
    m = k - (ans + 1) * ans / 2 - 1;
    for (i = ans - m; i >= 1; --i) printf("a");
    printf("b");
    for (i = m; i >= 1; --i) printf("a");
    printf("\n");
  }
  return 0;
}
