#include <bits/stdc++.h>
using namespace std;
long long binS(long long n, long long l, long long r) {
  while (l < r) {
    long long m = (l + r) / 2;
    long long a = (m * (m - 1)) / 2;
    if (a >= n)
      r = m;
    else
      l = m + 1;
  }
  return r;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    long long n, k;
    cin >> n >> k;
    string s(n, 'a');
    long long l = binS(k, 1, n);
    long long r = l - 1;
    r = k - ((r * (r - 1)) / 2);
    s[n - l] = 'b';
    s[n - r] = 'b';
    cout << s << endl;
  }
  return 0;
}
