#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const int _inf = 0xc0c0c0c0;
const long long INF = 0x3f3f3f3f3f3f3f3f;
const long long _INF = 0xc0c0c0c0c0c0c0c0;
const long long mod = (int)1e9 + 7;
const int N = 2e5 + 100;
int best = -1, oth;
int n, r;
void cal(int x) {
  int cnt = 0, times = 0;
  int a = r, b = x;
  while (b) {
    ++cnt;
    times += a / b;
    a %= b;
    swap(a, b);
  }
  if (a == 1 && times == n && cnt > best) {
    best = cnt;
    oth = x;
  }
}
string op = "TB";
int P(int a, int b) {
  if (b == 0) {
    putchar(op[0]);
    return 1;
  }
  int c = P(b, a % b);
  int cnt = a / b - (b == 1);
  for (int i = 1; i <= cnt; ++i) putchar(op[c]);
  return c ^ 1;
}
int main() {
  scanf("%d%d", &n, &r);
  if (r == 1) {
    if (n == 1) {
      puts("0");
      puts("T");
    } else
      puts("IMPOSSIBLE");
    return 0;
  }
  for (int i = 1; i < r; ++i) cal(i);
  if (best == -1)
    puts("IMPOSSIBLE");
  else {
    printf("%d\n", n - best - 1);
    P(r, oth);
  }
  return 0;
}
