#include <bits/stdc++.h>
using namespace std;
int n, inf = 100000000, minn = inf, mint, r;
int rec(int x, int y) {
  int ans = 0, last = 0, dr = 0;
  while (x > 0 && y > 0) {
    if (dr > n || ans > minn) {
      ans = inf;
      break;
    }
    dr++;
    if (x >= y) {
      if (last == 1) ans++;
      last = 1;
      x -= y;
    } else {
      if (last == -1) ans++;
      last = -1;
      y -= x;
    }
  }
  if (dr != n) {
    ans = inf;
  }
  if (!(x == 0 && y == 1)) ans = inf;
  return ans;
}
bool u;
int e;
int main() {
  cin >> n >> r;
  if (r == 1) {
    if (n != 1)
      minn = inf;
    else {
      minn = 0;
      mint = 0;
    }
  }
  for (int i = r - 1; i >= 0; i--) {
    e = rec(r, i);
    if (e < minn) {
      minn = e;
      mint = i;
      u = 1;
    }
    e = rec(i, r);
    if (e < minn) {
      minn = e;
      mint = i;
      u = 0;
    }
  }
  if (minn > n) {
    cout << "IMPOSSIBLE" << endl;
    return 0;
  }
  vector<char> v;
  cout << minn << endl;
  int xx, yy;
  if (u == 1) {
    xx = r;
    yy = mint;
  } else {
    xx = mint;
    yy = r;
  }
  for (int i = 1; i <= n; i++) {
    if (xx > yy) {
      v.push_back('T');
      xx -= yy;
    } else {
      v.push_back('B');
      yy -= xx;
    }
  }
  printf("T");
  for (int i = v.size() - 2; i >= 0; i--) {
    printf("%c", v[i]);
  }
}
