#include <bits/stdc++.h>
using namespace std;
const int maxn = (int)1e5 + 1;
int t;
int a, b;
int u[maxn];
int main() {
  cin >> t;
  while (t--) {
    cin >> a >> b;
    if (b == 1) {
      for (int i = 1; i < a - 1; i++) {
        cout << 'a';
      }
      cout << "bb\n";
      continue;
    }
    int cur = 1;
    for (int i = 1; i <= a; i++) {
      u[i] = 0;
    }
    for (int i = a - 1; i >= 1; i--) {
      if (b <= cur) {
        u[i] = 1;
        break;
      }
      b -= cur;
      cur++;
    }
    u[a - b + 1] = 1;
    for (int i = 1; i <= a; i++) {
      cout << (u[i] == 1 ? 'b' : 'a');
    }
    cout << "\n";
  }
}
