#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(0);
  long long n, k;
  long long t;
  cin >> t;
  while (t--) {
    int n, k;
    cin >> n >> k;
    string s(n, 'a');
    for (int i = n - 2; i >= 0; i--) {
      int cur = n - 1 - i;
      if (cur >= k) {
        s[i] = s[n - k] = 'b';
        cout << s << '\n';
        break;
      }
      k -= cur;
    }
  }
}
