#include <bits/stdc++.h>
std::mt19937_64 rng(
    std::chrono::steady_clock::now().time_since_epoch().count());
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t;
  cin >> t;
  while (t--) {
    long long n, k;
    cin >> n >> k;
    vector<char> s;
    for (long long i = 0; i < n; i++) s.push_back('a');
    long long j = (1 + sqrt(8 * k + 1)) / 2;
    long long x = j * (j + 1) / 2;
    long long e = j - 1;
    long long o = e * (e + 1) / 2;
    long long h;
    if (o >= k) {
      h = e;
      x = e * (e + 1) / 2;
    } else
      h = j;
    long long g = h - 1;
    s[n - 2 - h + 1] = 'b';
    long long p = k - (x - h);
    s[n - 1 - p + 1] = 'b';
    for (long long i = 0; i < n; i++) cout << s[i];
    cout << "\n";
  }
  return 0;
}
