#include <bits/stdc++.h>
using namespace std;
char ans[1000005], tmp[1000005];
int wa;
int n, x;
void go(int x, int y) {
  int len = 0;
  while (x != y) {
    if (x < y) {
      y -= x;
      tmp[len++] = 'B';
    } else {
      x -= y;
      tmp[len++] = 'T';
    }
    if (len >= n) return;
  }
  tmp[len++] = 'T';
  int w = 0;
  if (x > 1 || len != n) return;
  for (int i = 0; i + 1 < len; i++)
    if (tmp[i] == tmp[i + 1]) w++;
  if (wa > w) {
    wa = w;
    for (int i = 0; i < n; i++) ans[i] = tmp[i];
  }
}
int main() {
  while (scanf("%d%d", &n, &x) == 2) {
    wa = 10000000;
    for (int i = 1; i <= x; i++) {
      go(i, x);
      go(x, i);
    }
    if (wa == 10000000)
      puts("IMPOSSIBLE");
    else {
      reverse(ans, ans + n);
      printf("%d\n", wa);
      for (int i = 0; i < n; i++) putchar(ans[i]);
      puts("");
    }
  }
  return 0;
}
