#include <bits/stdc++.h>
using namespace std;
const int MaxN = 1000006, MaxC = 0x3F3F3F3F, NA = -1;
int n, r;
pair<int, int> solve(int a, int b) {
  int res = -1, step = 0;
  while (a > 0) {
    assert(a <= b);
    int cur = b / a;
    step += cur;
    res += cur - 1;
    b %= a;
    swap(a, b);
  }
  if (a == 0 && b == 1)
    return make_pair(res, step);
  else
    return make_pair(MaxC, MaxC);
}
string answer(int a, int b) {
  vector<int> v;
  while (a > 0) {
    assert(a <= b);
    v.push_back(b / a);
    b %= a;
    swap(a, b);
  }
  reverse(v.begin(), v.end());
  assert(a == 0 && b == 1);
  string c = "TB";
  int k = 0;
  string res;
  res += c[k];
  k ^= 1;
  v[0]--;
  for (int i = 0; i < (int)v.size(); i++) {
    for (int j = 0; j < v[i]; j++) res += c[k];
    k ^= 1;
  }
  return res;
}
int main(void) {
  while (scanf(" %d %d", &n, &r) != EOF) {
    int res = MaxC, s = MaxC, t;
    for (t = 1; t <= r; t++) {
      pair<int, int> cur = solve(t, r);
      if (cur.second == n && res > cur.first) {
        res = cur.first;
        s = t;
      }
    }
    if (res == MaxC) {
      printf("IMPOSSIBLE\n");
    } else {
      printf("%d\n", max(0, res));
      printf("%s\n", answer(s, r).c_str());
    }
  }
  return 0;
}
