#include <bits/stdc++.h>
using namespace std;
int p1, p2;
vector<pair<int, int> > v;
int gcdlen(int a, int b) {
  if (b == 0) {
    if (a == 1)
      return 0;
    else
      return 1e9;
  }
  int len = a / b;
  p1 += len - 1;
  len += gcdlen(b, a % b);
  return len;
}
int gcdlenx(int a, int b) {
  v.push_back(make_pair(a, b));
  if (b == 0) {
    if (a == 1)
      return 0;
    else
      return 1e9;
  }
  int len = a / b;
  p1 += len - 1;
  len += gcdlenx(b, a % b);
  return len;
}
int main() {
  int n, k;
  scanf("%d %d", &k, &n);
  if (n == 1 && k == 1) {
    printf("0\nT");
    return 0;
  }
  int mini = 1e9, ans = -1;
  for (int i = 1; i < n; i++) {
    p1 = p2 = 0;
    if (gcdlen(n, i) == k) {
      if (mini > p1) {
        mini = p1;
        ans = i;
      }
    }
  }
  if (ans == -1) {
    printf("IMPOSSIBLE");
    return 0;
  }
  printf("%d\n", mini - 1);
  gcdlenx(n, ans);
  reverse(v.begin(), v.end());
  printf("T");
  for (int i = 0; i < (int)v[1].first / v[1].second - 1; i++) printf("B");
  char now = 'T', next = 'B';
  for (int j = 0; j < (int)v.size(); j++) {
  }
  for (int j = 0; j < (int)v.size(); j++) {
    if (j <= 1) continue;
    for (int i = 0; i < (int)v[j].first / v[j].second; i++) printf("%c", now);
    swap(now, next);
  }
  return 0;
}
