#include <bits/stdc++.h>
using namespace std;
const int MaxN = 1000005;
const int INF = 1000000005;
int n, r, Min, ans, m;
bool op[MaxN];
int solve(int first) {
  int a, b, cnt, ret = 0;
  a = first, b = r, cnt = 0;
  while (a != 0 && b != 0) {
    if (a > b) {
      int t = a / b;
      ret += t - 1;
      cnt += t, a %= b;
    } else {
      int t = b / a;
      ret += t - 1;
      cnt += b / a, b %= a;
    }
  }
  if ((a == 1 || b == 1) && n + 1 == cnt)
    return ret;
  else
    return INF;
}
int main() {
  scanf("%d%d", &n, &r);
  --n;
  Min = INF;
  for (int i = 1; i <= r; ++i) {
    int t = solve(i);
    if (Min > t) Min = t, ans = i;
  }
  if (Min == INF)
    printf("IMPOSSIBLE\n");
  else {
    int a = ans, b = r;
    while (a != 0 && b != 0) {
      if (a > b) {
        op[m++] = 0;
        a -= b;
      } else {
        op[m++] = 1;
        b -= a;
      }
    }
    if (op[m - 2] == 0) {
      for (int i = m - 2; i >= 0; --i) op[i] = !op[i];
    }
    op[m - 1] = 0;
    ans = 0;
    for (int i = 0; i < m - 1; ++i)
      if (op[i] == op[i + 1]) ++ans;
    printf("%d\n", ans);
    for (int i = m - 1; i >= 0; --i)
      if (op[i])
        printf("B");
      else
        printf("T");
    printf("\n");
  }
  return 0;
}
