#include <bits/stdc++.h>
using namespace std;
void impo() { puts("IMPOSSIBLE"); }
int n, k;
int main() {
  cin >> k >> n;
  if (k == 1) {
    if (n == 1)
      cout << 0 << endl << "T" << endl;
    else
      impo();
    return 0;
  }
  int d;
  int res = 1 << 30;
  int who;
  for (d = 1; d < n; d++) {
    int ct = 0;
    int a = n, b = d;
    int erros = 0;
    while (b) {
      erros++;
      ct += a / b;
      int r = a % b;
      a = b;
      b = r;
    }
    if (a == 1 && ct == k) {
      int tmp = ct - erros - 1;
      if (res > tmp) res = tmp, who = d;
    }
  }
  if (res == (1 << 30))
    impo();
  else {
    cout << res << endl;
    int a = n, b = who;
    vector<int> v;
    while (b) {
      v.push_back(a / b);
      int r = a % b;
      a = b;
      b = r;
    }
    v.back()--;
    v.push_back(1);
    reverse((v).begin(), (v).end());
    int tipo = 0;
    for (int i = 0; i < v.size(); i++) {
      for (int j = 0; j < v[i]; j++) putchar(tipo ? 'B' : 'T');
      tipo = 1 - tipo;
    }
    putchar(10);
  }
}
