#include <bits/stdc++.h>
using namespace std;
vector<long long> cumm;
string build(long long pos1b, long long pos2b, long long n) {
  string str = "";
  for (long long i = 1; i <= n; i++) {
    if (i == pos1b || i == pos2b) {
      str += "b";
    } else {
      str += "a";
    }
  }
  return str;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t;
  cin >> t;
  while (t--) {
    long long n, k;
    cin >> n >> k;
    cumm.resize(n + 1);
    cumm[0] = 0;
    cumm[1] = 1;
    for (long long i = 2; i <= n; i++) {
      cumm[i] = cumm[i - 1] + i;
    }
    long long idx = lower_bound(cumm.begin(), cumm.end(), k) - cumm.begin();
    string str = "";
    long long pos1b, pos2b;
    if (k == cumm[idx]) {
      pos1b = n - idx;
      pos2b = pos1b + 1;
    } else {
      pos1b = n - idx;
      pos2b = n - (k - cumm[idx - 1]) + 1;
    }
    cout << build(pos1b, pos2b, n) << endl;
  }
  return 0;
}
