#include <bits/stdc++.h>
const int MOD = 1E9 + 7;
const int N = 1000000 + 5;
const int dx[] = {-1, 1, 0, 0, -1, -1, 1, 1};
const int dy[] = {0, 0, -1, 1, -1, 1, -1, 1};
using namespace std;
int n, r;
char str[N];
char res[N];
int error = 0x3f3f3f3f;
int tot, cnt;
int cal(int t, int b) {
  cnt = 0;
  while (t >= 0 && b >= 0 && t != b) {
    if (b > t) {
      str[cnt++] = 'B';
      b -= t;
    } else {
      str[cnt++] = 'T';
      t -= b;
    }
  }
  str[cnt] = 'T';
  if (t != 1 || cnt != n - 1) return 0x3f3f3f3f;
  int minn = 0;
  for (int i = 0; i < cnt; i++)
    if (str[i] == str[i + 1]) minn++;
  return minn;
}
int main() {
  scanf("%d%d", &n, &r);
  int error = 0x3f3f3f3f;
  for (int i = 1; i <= r; i++) {
    int minn = cal(i, r);
    if (minn < error) {
      error = minn;
      tot = cnt;
      for (int i = 0; i <= cnt; i++) res[i] = str[i];
    }
    minn = cal(r, i);
    if (minn < error) {
      error = minn;
      tot = cnt;
      for (int i = 0; i <= cnt; i++) res[i] = str[i];
    }
  }
  if (error == 0x3f3f3f3f)
    printf("IMPOSSIBLE\n");
  else {
    printf("%d\n", error);
    for (int i = tot; i >= 0; i--) printf("%c", res[i]);
    printf("\n");
  }
  return 0;
}
