#include <bits/stdc++.h>
using namespace std;
const int N = 30005;
const int inf = 1e9 + 1;
const double eps = 1e-15;
const double EPS = 1e-9;
const double PI = acos(-1.0);
long long int bs(long long int n, long long int k) {
  long long int low = 1, high = n + 1;
  while (high - low >= 2) {
    long long int mid = (high + low) >> 1;
    ((mid * (mid - 1)) / 2 <= k) ? low = mid : high = mid;
  }
  return low;
}
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(NULL);
  long long int t, n, k;
  cin >> t;
  while (t--) {
    cin >> n >> k;
    long long int pos = bs(n, k);
    string s(n, 'a');
    if ((pos * (pos - 1)) / 2 == k) {
      s[n - 1 - (pos - 1)] = 'b';
      s[n - 1 - (pos - 2)] = 'b';
    } else {
      k -= pos * (pos - 1) / 2;
      pos++;
      s[n - 1 - (pos - 1)] = 'b';
      s[n - 1 - (k - 1)] = 'b';
    }
    cout << s << endl;
  }
}
