#include <bits/stdc++.h>
using namespace std;
int n;
long long k;
void xuli() {
  int d = 1, c = n;
  while (d <= c) {
    int giua = (d + c) / 2;
    long long so = (long long)giua * (giua + 1) / 2;
    if (k > so)
      d = giua + 1;
    else
      c = giua - 1;
  }
  k = (long long)d * (d + 1) / 2 - k;
  string s = "";
  for (int i = 0; i < n; ++i) {
    if (i == n - d - 1 || i == n - d + k)
      s += 'b';
    else
      s += 'a';
  }
  cout << s << '\n';
}
int main() {
  int t;
  cin >> t;
  for (int i = 1; i <= t; ++i) {
    cin >> n >> k;
    xuli();
  }
}
