#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    long long int n, k;
    cin >> n >> k;
    long long int first = 1;
    long long int last = n - 1;
    long long int one = -1;
    long long int two = -1;
    while (first <= last) {
      long long int mid = (first + last) / 2;
      long long int sum = mid * (mid - 1) / 2;
      if (k - sum > mid) {
        first = mid + 1;
      } else if (k - sum <= 0) {
        last = mid - 1;
      } else if (k - sum <= mid && k - sum > 0) {
        one = mid;
        k = k - sum;
        break;
      }
    }
    for (long long int i = 1; i <= n; i++) {
      if (i == (n - 1 - one + 1) || i == (n - k + 1)) {
        cout << "b";
      } else {
        cout << "a";
      }
    }
    cout << endl;
  }
  return 0;
}
