#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    long long n, k, t;
    cin >> n >> k;
    if (k == 1) {
      string temp;
      for (int i = 1; i <= n - 2; i++) {
        temp = temp + 'a';
      }
      temp = temp + 'b' + 'b';
      cout << temp << endl;
      continue;
    }
    string ans;
    t = (n * (n - 1)) / 2;
    while (1) {
      if (k > t - n + 1) {
        ans = ans + 'b';
        n--;
        break;
      } else {
        ans = ans + 'a';
        n--;
        t = (n * (n - 1)) / 2;
      }
    }
    int a = n - (k - (n) * (n - 1) / 2);
    for (int i = 0; i < n; i++) {
      if (i != a)
        ans = ans + 'a';
      else
        ans = ans + 'b';
    }
    cout << ans << endl;
  }
}
