#include <bits/stdc++.h>
using namespace std;
int n, r, m, i, j, k, l, ans, u, v, p;
char c[1000001];
void make(const int x, const int y) {
  j = x;
  k = y;
  l = n;
  m = 0;
  p = 0;
  while (j > 0 && k > 0 && l > 1) {
    if (k > j) {
      if (j == 1) {
        m += (k - 2);
        l -= (k - 1);
        k = 1;
      } else {
        m += k / j - 1;
        l -= k / j;
        k = k % j;
      }
      p = 1;
    } else {
      if (k == 1) {
        m += (j - 2);
        l -= (j - 1);
        j = 1;
      } else {
        m += j / k - 1;
        l -= j / k;
        j = j % k;
      }
      p = 2;
    }
    if (k == 1 && j == 1) break;
  }
  if (p == 2) ++m;
  if (j == 1 & k == 1 && l == 1 && m < ans) {
    ans = m;
    u = x;
    v = y;
  }
}
int main() {
  scanf("%d%d", &n, &r);
  if (n == 1) {
    if (r == 1) {
      printf("0\n");
      printf("T\n");
    } else
      printf("IMPOSSIBLE\n");
    return 0;
  }
  ans = n + 1;
  for (i = 1; i < r; ++i) make(i, r), make(r, i);
  if (ans == n + 1)
    printf("IMPOSSIBLE\n");
  else {
    printf("%d\n", ans);
    j = u;
    k = v;
    l = n;
    m = 0;
    while (j > 0 && k > 0 && l > 1) {
      if (k > j) {
        k = k - j;
        c[l] = 'B';
      } else {
        j = j - k;
        c[l] = 'T';
      }
      --l;
    }
    printf("T");
    for (i = 2; i <= n; ++i) printf("%c", c[i]);
    printf("\n");
  }
  return 0;
}
