#include <bits/stdc++.h>
const int N = 1000001;
int gcd(int a, int b) {
  int c;
  while (a) {
    c = a;
    a = b % a;
    b = c;
  }
  return b;
}
void cal(int a, int b, int &s1, int &s2) {
  int c;
  while (a > 1) {
    s1 += b / a;
    s2 += b / a - 1;
    c = a;
    a = b % a;
    b = c;
  }
  s1 += b;
  s2 += b - 2;
}
int s[N];
void output(int a, int b) {
  int sign = 0, m = 0, c;
  while (a > 1) {
    for (int i = b / a; i >= 1; --i) s[m++] = sign;
    c = a;
    a = b % a;
    b = c;
    sign ^= 1;
  }
  if (sign)
    for (int i = m - 1; i >= 0; --i) s[i] ^= 1;
  for (int i = b - 1; i >= 1; --i) s[m++] = 0;
  s[m++] = 1;
  for (int i = m - 1; i >= 0; --i)
    if (s[i])
      printf("T");
    else
      printf("B");
  printf("\n");
}
int main() {
  int n, r, mis, d;
  int s1, s2;
  while (scanf("%d%d", &n, &r) != EOF) {
    mis = n + 1;
    d = -1;
    for (int i = 1; i <= r; ++i) {
      if (gcd(i, r) != 1) continue;
      s1 = s2 = 0;
      cal(i, r, s1, s2);
      if (s2 < 0) s2 = 0;
      if (s1 == n && s2 < mis) mis = s2, d = i;
    }
    if (mis > n)
      printf("IMPOSSIBLE\n");
    else {
      printf("%d\n", mis);
      output(d, r);
    }
  }
  return 0;
}
