#include <bits/stdc++.h>
using namespace std;
string lpp(string p) {
  string k = p;
  reverse(k.begin(), k.end());
  p = p + '#' + k;
  int n = p.size();
  int lps[n + 5];
  memset(lps, 0, sizeof(lps));
  int i = 0, j = 1;
  while (j < n) {
    if (p[i] == p[j]) {
      lps[j] = i + 1;
      i++;
      j++;
    } else {
      if (i > 0) {
        i = lps[i - 1];
      } else {
        j++;
      }
    }
  }
  return p.substr(0, lps[n - 1]);
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, k;
    cin >> n >> k;
    int cnt = 0;
    int i = 1;
    while (cnt + i < k) {
      cnt += i;
      i++;
    }
    string ans = "";
    for (int i = 0; i < n; i++) ans += 'a';
    ans[i] = 'b';
    long long tmp = cnt + i - k + 1;
    ans[i - tmp] = 'b';
    reverse(ans.begin(), ans.end());
    cout << ans << endl;
  }
}
