#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 5;
const int INF = 1e9 + 7;
const char CM[] = "TB";
int n, r;
pair<int, int> ans = make_pair(INF, 0);
int s[maxn];
inline void solve(int x, int y, int &lst, int &res, int &tot, bool f) {
  if (min(x, y) == 0) {
    if (max(x, y) == 1)
      lst = -1;
    else
      tot = -1;
    return;
  }
  if (x < y) {
    while (x < y) {
      y -= x;
      if (f) s[tot] = 1;
      ++tot;
      ++res;
    }
    --res;
    solve(x, y, lst, res, tot, f);
    if (!~tot) return;
    res += (lst == 1);
    lst = 1;
  } else {
    while (y <= x) {
      x -= y;
      if (f) s[tot] = 0;
      ++tot;
      ++res;
    }
    --res;
    solve(x, y, lst, res, tot, f);
    if (!~tot) return;
    res += (lst == 0);
    lst = 0;
  }
  return;
}
int main() {
  scanf("%d%d", &n, &r);
  for (int i = (0); i <= (r); ++i) {
    int lst, res = 0, tot = 0;
    solve(i, r, lst, res, tot, 0);
    if (tot == n && res < ans.first) ans = make_pair(res, i << 1);
    lst = 0, res = 0, tot = 0;
    solve(r, i, lst, res, tot, 0);
    if (tot == n && res < ans.first) ans = make_pair(res, i << 1 | 1);
  }
  if (ans.first == INF) {
    puts("IMPOSSIBLE");
    return 0;
  }
  int lst, res = 0, tot = 0;
  printf("%d\n", ans.first);
  if (ans.second & 1)
    solve(r, ans.second >> 1, lst, res, tot, 1);
  else
    solve(ans.second >> 1, r, lst, res, tot, 1);
  for (int i = n - 1; i >= 0; --i) putchar(CM[s[i] ^ s[n - 1]]);
  return 0;
}
