#include <bits/stdc++.h>
using namespace std;
vector<long long> sum(100002);
int main() {
  int t;
  long long n, k;
  cin >> t;
  sum[0] = 0;
  for (int i = 1; i < 100002; i++) sum[i] = i + sum[i - 1];
  while (t--) {
    cin >> n >> k;
    int idx = lower_bound(sum.begin(), sum.end(), k) - sum.begin();
    int f_idx, s_idx;
    if (sum[idx] != k) {
      idx--;
      f_idx = n - 2 - idx;
      s_idx = n - (k - sum[idx]);
    } else {
      f_idx = n - 1 - idx;
      s_idx = f_idx + 1;
    }
    for (int i = 0; i < n; i++) {
      if (i == f_idx || (s_idx) == i)
        cout << "b";
      else
        cout << "a";
    }
    cout << endl;
  }
  return 0;
}
