#include <bits/stdc++.h>
using namespace std;
int main() {
  int t = 0;
  cin >> t;
  int z = 200002;
  vector<long long> arr(z, 0);
  for (int i = 2; i < z; ++i) {
    arr[i] = arr[i - 1] + (i - 1);
  }
  while (t--) {
    long long n, k;
    cin >> n >> k;
    string s(n, 'a');
    int a = n - 1, b = n - 2;
    if (k > 1) {
      vector<long long>::iterator it = lower_bound(arr.begin(), arr.end(), k);
      while (*it >= k && it > arr.begin()) {
        --it;
      }
      long long p = distance(arr.begin(), it);
      int last = k - arr[p];
      a = n - last;
      b = n - p - 1;
    }
    for (int i = 0; i < n; ++i) {
      if (i == a || i == b)
        printf("b");
      else
        printf("a");
    }
    printf("\n");
  }
  return 0;
}
