#include <bits/stdc++.h>
using namespace std;
int n, r, minchange = (1000000 + 10);
bool ans[(1000000 + 10)] = {0}, res[(1000000 + 10)];
bool flag = 0;
int calc() {
  int tot = 0;
  for (int i = 2; i <= n; i++)
    if (!res[i] ^ res[i - 1]) tot++;
  return tot;
}
void relax() {
  int now = calc();
  if (!flag || now < minchange) {
    flag = 1;
    minchange = now;
    memcpy(ans, res, sizeof(ans));
    return;
  }
  if (now > minchange) return;
  for (int i = 2; i <= n; i++) {
    if (ans[i] < res[i]) return;
    if (ans[i] > res[i]) {
      memcpy(ans, res, sizeof(ans));
      return;
    }
  }
}
bool is_ok(int l, int r) {
  res[1] = 1;
  for (int i = n; i > 1; i--) {
    if (!l || !r) return 0;
    if (r < l) {
      l = l - r;
      res[i] = 1;
    } else {
      r -= l;
      res[i] = 0;
    }
  }
  if (l != 1 || r != 1) return 0;
  relax();
  for (int i = 2; i <= n; i++) res[i] = !res[i];
  relax();
}
int main() {
  cin >> n >> r;
  for (int i = 1; i <= r; i++) {
    flag = is_ok(i, r) | flag;
  }
  if (!flag)
    cout << "IMPOSSIBLE\n";
  else {
    cout << minchange << '\n';
    for (int i = 1; i <= n; i++) {
      if (ans[i])
        printf("T");
      else
        printf("B");
    }
    printf("\n");
  }
  return 0;
}
