#include <bits/stdc++.h>
using namespace std;
int main() {
  long long t;
  cin >> t;
  while (t--) {
    long long n, k, z, v;
    cin >> n;
    cin >> k;
    for (long long i = 1; i <= n; i++) {
      v = i * (i + 1) / 2;
      if (v >= k) {
        z = i;
        break;
      }
    }
    long long p1 = n - z;
    long long p2 = n - z + 1 + v - k;
    char arr[n];
    for (long long i = 0; i < n; i++) {
      if (i == p1 - 1 || i == p2 - 1) {
        arr[i] = 'b';
      } else {
        arr[i] = 'a';
      }
    }
    for (long long i = 0; i < n; i++) {
      cout << arr[i];
    }
    cout << endl;
  }
  return 0;
}
