#include <bits/stdc++.h>
using namespace std;
long long fps(long long x, long long n) {
  long long l = 1, r = n - 1;
  while (l < r) {
    long long m = (l + r) >> 1;
    long long tmp = m * (m + 1) / 2, tt = tmp - m;
    if (tmp >= x && tt < x) return m;
    if (tmp > x)
      r = m - 1;
    else
      l = m + 1;
  }
  return r;
}
int main() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    long long n, k;
    cin >> n >> k;
    if (k == 1) {
      for (int i = 0; i < n - 2; i++) cout << 'a';
      cout << "bb\n";
      continue;
    }
    long long id = fps(k, n);
    k -= id * (id - 1) / 2;
    for (long long i = 1; i <= n; i++)
      if (n - i == id || n - i + 1 == k)
        cout << 'b';
      else
        cout << 'a';
    cout << "\n";
  }
}
