#include <bits/stdc++.h>
using namespace std;
int n, r, A = 1 << 29, T;
char s[1000005];
int main() {
  scanf("%d %d", &n, &r);
  for (int i = (1); i <= (r); i++) {
    int a = i, b = r, m = 0, p = 0;
    while (a) {
      if (a == 1 && b > 1)
        m += b / a - 2;
      else
        m += b / a - 1;
      p += b / a;
      int t = b % a;
      b = a;
      a = t;
    }
    if (b == 1 && p == n && m < A) T = i, A = m;
  }
  if (A == 1 << 29)
    puts("IMPOSSIBLE");
  else {
    printf("%d\n", A);
    for (int i = (n - 1); i >= (1); i--) {
      if (T < r) {
        r -= T;
        s[i] = 'T';
      } else {
        T -= r;
        s[i] = 'B';
      }
    }
    if (s[1] == 'T')
      for (int i = (1); i < (n); i++) s[i] = s[i] == 'B' ? 'T' : 'B';
    s[0] = 'T';
    puts(s);
  }
  scanf("\n");
}
