#include <bits/stdc++.h>
int main() {
  int t;
  scanf("%d", &t);
  for (int i = 1; i <= t; i++) {
    int n;
    scanf("%d", &n);
    char str[n];
    for (int j = 0; j < n; j++) str[j] = 'a';
    long long int k;
    scanf("%lld", &k);
    for (long long int j = 2; j <= n; j++) {
      if (((j * (j - 1)) / 2) >= k) {
        str[j - 1] = 'b';
        long long int m;
        int c;
        m = ((j - 1) * (j - 2)) / 2;
        c = (int)(k - m);
        str[c - 1] = 'b';
        break;
      }
    }
    for (int j = n - 1; j >= 0; j--) printf("%c", str[j]);
    printf("\n");
  }
  return 0;
}
