#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int t, n, k;
  cin >> t;
  map<long long int, long long int> mp;
  unsigned long long int idx1, idx2, ct = 0;
  for (long long int i = 2; i <= 100004; i++) {
    idx1 = (i * (i - 1)) / 2;
    mp[idx1] = i;
  }
  auto it = mp.lower_bound(100);
  while (t--) {
    cin >> n >> k;
    if (k == 1) {
      for (int i = 1; i <= n - 2; i++) cout << 'a';
      for (int j = 1; j <= 2; j++) cout << 'b';
      cout << endl;
      continue;
    }
    auto ptr = mp.lower_bound(k);
    auto pre = ptr;
    pre--;
    long long int pos1 = n - (ptr->second);
    long long int diff = k - (pre->first);
    long long int pos2 = n - diff;
    for (long long int i = 0; i < n; i++) {
      if (i == pos1 || i == pos2)
        cout << 'b';
      else
        cout << 'a';
    }
    cout << endl;
  }
  return 0;
}
