#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, n, m, l, r, i;
  long long sum;
  scanf("%d", &t);
  while (t--) {
    scanf("%d%d", &n, &m);
    sum = 0;
    for (i = 0; i < n; i++) {
      if (sum + i + 1 >= m) break;
      sum += i + 1;
    }
    l = i + 2;
    r = m - sum;
    for (i = n; i >= 1; i--) printf(i == l || i == r ? "b" : "a");
    printf("\n");
  }
  return 0;
}
