#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-10;
const int inf = (int)1e9;
int go(int n, int x, int y) {
  if (n == 0) {
    if (x == 0 && y == 1)
      return 0;
    else
      return inf;
  }
  if (x == 0) return inf;
  int c = y / x;
  if (c > 1 && y % x == 0) c--;
  return go(n - c, y - c * x, x) + c - 1;
}
const int maxn = (int)1e6 + 10;
int s[maxn];
int second = 0;
void out(int x, int y, int ch) {
  if (x == 0 && y == 1) return;
  int c = y / x;
  if (c > 1 && y % x == 0) c--;
  for (int(i) = 0; (i) < (c); ++(i)) s[second++] = ch;
  out(y - c * x, x, ch ^ 1);
}
int main() {
  int n, r;
  scanf("%d%d", &n, &r);
  int res = inf, ind = 0;
  for (int(i) = 0; (i) < (r + 1); ++(i)) {
    int x = go(n, i, r);
    if (x < res) res = x, ind = i;
  }
  if (res == inf) return 0 * printf("IMPOSSIBLE\n");
  printf("%d\n", res);
  out(ind, r, 0);
  reverse(s, s + second);
  for (int(i) = 0; (i) < (second); ++(i))
    printf("%c", (s[i] == s[0] ? 'T' : 'B'));
  printf("\n");
  return 0;
}
