#include <bits/stdc++.h>
using namespace std;
int main() {
  int T;
  cin >> T;
  while (T--) {
    long long n, k;
    cin >> n >> k;
    long double b = (-1 + sqrt(1 + 8 * k)) / 2.0;
    long long s = -1, e = -1;
    if (b - int(b) == 0.0) {
      s = b;
      e = b - 1;
    } else {
      long long p = (long long)b;
      k = k - p * (p + 1) / 2;
      s = p + 1;
      e = k - 1;
    }
    string str = "";
    for (int i = 0; i < n; ++i) str.push_back('a');
    str[n - s - 1] = 'b';
    str[n - e - 1] = 'b';
    cout << str << endl;
  }
}
