#include <bits/stdc++.h>
using namespace std;
int main() {
  long long t;
  cin >> t;
  while (t--) {
    long long n, k;
    cin >> n >> k;
    vector<long long> p;
    vector<long long> pre;
    for (long long i = 0; i < n; i++) {
      p.push_back(i + 1);
    }
    long long sum = 0;
    for (long long i = 0; i < n; i++) {
      sum += p[i];
      pre.push_back(sum);
    }
    long long ind = lower_bound(pre.begin(), pre.end(), k) - pre.begin();
    long long x = p[ind];
    long long y = n - x - 1;
    long long bb;
    bb = y + (pre[ind] - k) + 1;
    vector<char> ans;
    for (long long i = 0; i < n; i++) {
      if (i == y || i == bb)
        ans.push_back('b');
      else
        ans.push_back('a');
    }
    for (int i = 0; i < n; i++) {
      cout << ans[i];
    }
    cout << endl;
  }
  return 0;
}
