#include <bits/stdc++.h>
using namespace std;
int n, r;
bool a[1001000];
int an = 0;
int main() {
  scanf("%d%d", &n, &r);
  int ans = 1e7, ansi = -1;
  for (int i = 1; i <= r; i++) {
    int t = 0, res = 0, pre = 2, x = i, y = r;
    while (x != 0 && y != 0) {
      if (x < y) {
        y -= x;
        t++;
        if (pre == 1) res++;
        pre = 1;
      } else if (x > y) {
        x -= y;
        t++;
        if (pre == 0) res++;
        pre = 0;
      } else {
        t++;
        x -= y;
        pre = 0;
      }
    }
    if ((x == 0 && y == 1 || x == 1 && y == 0) && t == n && res < ans) {
      ansi = i;
      ans = res;
    }
  }
  if (ans == 1e7)
    puts("IMPOSSIBLE");
  else {
    printf("%d\n", ans);
    int x = ansi, y = r;
    for (int i = 0; i < n; i++) {
      if (x < y) {
        y -= x;
        a[an++] = true;
      } else if (x > y) {
        x -= y;
        a[an++] = false;
      } else if (x == 1) {
        if (a[an - 1])
          a[an++] = false;
        else
          a[an++] = true;
      }
    }
    bool T = a[an - 1];
    for (int i = an - 1; i >= 0; i--) {
      if (T == a[i])
        printf("T");
      else
        printf("B");
    }
    printf("\n");
  }
  return 0;
}
