#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 1000000 + 50, INF = 0x3f3f3f3f, UP = 1, DN = 0;
int N, R, tmpOp[MAX_N], resOp[MAX_N], resM;
int main() {
  cin >> N >> R;
  resM = INF;
  for (int i = 1; i <= R; i++) {
    int x = i, y = R, p = N, mistake = 0;
    while (x > 0 && y > 0 && p > 1) {
      if (x > y)
        tmpOp[p] = UP, x = x - y;
      else
        tmpOp[p] = DN, y = y - x;
      if (p < N) mistake += tmpOp[p] == tmpOp[p + 1];
      p--;
    }
    if (x == 1 && y == 1 && mistake < resM) {
      resM = mistake;
      for (p = 2; p <= N; p++) resOp[p] = tmpOp[p];
    }
  }
  if (resM == INF)
    puts("IMPOSSIBLE");
  else {
    printf("%d\n", resM);
    resOp[1] = UP;
    if (N >= 2 && resOp[2] == UP)
      for (int p = 2; p <= N; p++) resOp[p] = 1 ^ resOp[p];
    for (int p = 1; p <= N; p++) putchar(resOp[p] == UP ? 'T' : 'B');
    putchar('\n');
  }
  return 0;
}
