#include <bits/stdc++.h>
using namespace std;
int main() {
  long long t;
  cin >> t;
  vector<long long> v(100001);
  v[0] = 0;
  for (long long i = 1; i < 100001; i++) {
    v[i] = v[i - 1] + i;
  }
  while (t--) {
    long long n, k;
    cin >> n >> k;
    auto idx = lower_bound(v.begin(), v.end(), k);
    long long i = idx - v.begin();
    long long pos1 = n - i;
    long long pos2 = pos1 + 1 + ((*idx) - k);
    string s = "";
    for (long long i1 = 1; i1 < n + 1; i1++) {
      if (i1 == pos1 || i1 == pos2)
        s += 'b';
      else
        s += 'a';
    }
    cout << s << endl;
  }
}
