#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n, k;
  cin >> n >> k;
  long long int pos1, pos2;
  long long int l = 1, h = n;
  while (l <= h) {
    long long int m = l + (h - l) / 2;
    if (m * (m - 1) / 2 == k) {
      pos1 = m;
      break;
    } else if (m * (m - 1) / 2 > k) {
      pos1 = m;
      h = m - 1;
    } else
      l = m + 1;
  }
  l = 1, h = n;
  pos2 = k - ((pos1 - 1) * (pos1 - 2)) / 2;
  string s = "";
  for (int i = 0; i < n; i++) {
    if (i + 1 == pos1 || i + 1 == pos2) {
      s = "b" + s;
    } else
      s = "a" + s;
  }
  cout << s << endl;
}
int main() {
  int t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
