#include <bits/stdc++.h>
using namespace std;
const int maxn = 10005;
int main() {
  int t;
  cin >> t;
  while (t--) {
    long long n, k;
    cin >> n >> k;
    long long l = 1, r = n - 1, ans = 1;
    while (l <= r) {
      long long mid = (l + r) >> 1;
      if ((mid + 1) * mid >= k * 2)
        r = mid - 1, ans = mid;
      else
        l = mid + 1;
    }
    ans--;
    for (int i = n - 2 - ans; i >= 1; --i) cout << "a";
    cout << "b";
    long long m = k - (ans + 1) * ans / 2 - 1;
    for (int i = ans - m; i >= 1; --i) cout << "a";
    cout << "b";
    for (int i = m; i >= 1; --i) cout << "a";
    cout << endl;
  }
  return 0;
}
