#include <bits/stdc++.h>
using namespace std;
int n, m, sz, ans, flag, po, a[1000001], b[1000001], cnt, mx;
void solve(int hh, int x, int y) {
  int nt, now;
  if (!x || !y) {
    if (y != 1 || sz != n || a[cnt] != 1) return;
    flag = 1;
    if (mx < ans) {
      ans = mx;
      po = hh;
    }
    return;
  }
  if (x > y) {
    now = x / y;
    nt = x % y;
    if (!nt) nt = y, now--;
    sz += now;
    a[++cnt] = 1;
    b[cnt] = now;
    mx += now - 1;
    solve(hh, nt, y);
  } else if (x < y) {
    now = y / x;
    nt = y % x;
    if (!nt) nt = x, now--;
    sz += now;
    a[++cnt] = 0;
    b[cnt] = now;
    mx += now - 1;
    solve(hh, x, nt);
  } else {
    if (x != 1) return;
    flag = 1;
    if (a[cnt] == 1)
      b[cnt]++, mx++;
    else
      a[++cnt] = 1, b[cnt] = 1;
    sz++;
    if (sz != n) return;
    if (mx < ans) {
      ans = mx;
      po = hh;
    }
  }
}
int main() {
  int i, j, x, y;
  scanf("%d%d", &n, &m);
  if (n == 1 && m == 1) {
    puts("0");
    puts("T");
    return 0;
  }
  ans = 1e9;
  for (i = 0; i <= m; i++) {
    x = i;
    y = m - i;
    cnt = mx = 0;
    flag = 0;
    sz = 1;
    solve(i, x, y);
  }
  cnt = 0;
  mx = 1;
  if (ans == 1e9) return puts("IMPOSSIBLE"), 0;
  solve(po, po, m - po);
  if (a[1] == 1)
    a[0] = 0;
  else
    a[0] = 1;
  b[0] = 1;
  printf("%d\n", ans);
  for (i = cnt; i >= 0; i--)
    for (j = 1; j <= b[i]; j++)
      if (a[i] == 0)
        printf("B");
      else
        printf("T");
}
