#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int t;
  cin >> t;
  while (t--) {
    long long int n, k;
    cin >> n >> k;
    string s = "";
    for (long long int(i) = (0); (i) < (n - 2); (i)++) s += 'a';
    for (long long int(i) = (0); (i) < (2); (i)++) s += 'b';
    if (k == 1)
      cout << s << endl;
    else {
      long long int perm = 1;
      long long int pt1 = n - 2, pt2 = n - 1;
      long long int luv = 1;
      while (perm < k) {
        pt1--;
        luv++;
        perm += (pt2 - pt1);
      }
      string s2 = "";
      long long int on = perm - luv;
      for (long long int(i) = (0); (i) < (pt1); (i)++) {
        s2 += 'a';
      }
      s2 += 'b';
      long long int len = pt1 + 1;
      long long int left = n - len;
      string gg = "";
      for (long long int(i) = (0); (i) < (left); (i)++) {
        gg += 'a';
      }
      s2 += gg;
      long long int leftperm = k - on;
      long long int idx = n - leftperm;
      s2[idx] = 'b';
      cout << s2 << endl;
    }
  }
  return 0;
}
