#include <bits/stdc++.h>
using namespace std;
int n, r;
deque<char> ans;
int minim = 2123123123;
deque<char> minimans;
int temp;
void coba(int atas, int bawah) {
  while (atas != 0 && bawah != 0) {
    if (atas < bawah) {
      bawah -= atas;
      ans.push_front('B');
    } else {
      atas -= bawah;
      ans.push_front('T');
    }
  }
  if ((atas == 0 && bawah == 1) || (atas == 1 && bawah == 0)) return;
  ans.clear();
}
int hitung() {
  int res = 0;
  for (int i = 0; i < ans.size() - 1; i++) {
    if (ans[i] == ans[i + 1]) res++;
  }
  return res;
}
void rev() {
  for (int i = 0; i < minimans.size(); i++) {
    if (minimans[i] == 'T')
      minimans[i] = 'B';
    else
      minimans[i] == 'T';
  }
}
int main() {
  scanf("%d %d", &n, &r);
  for (int i = 1; i <= r; i++) {
    ans.clear();
    coba(i, r);
    if (ans.size() == n) {
      temp = hitung();
      if (minim > temp) {
        minim = temp;
        minimans = ans;
      }
    }
    ans.clear();
    coba(r, i);
    if (ans.size() == n) {
      temp = hitung();
      if (minim > temp) {
        minim = temp;
        minimans = ans;
      }
    }
  }
  if (minim == 2123123123)
    printf("IMPOSSIBLE\n");
  else {
    if (minimans[0] == 'B') rev();
    printf("%d\n", minim);
    for (int j = 0; j < minimans.size(); j++) printf("%c", minimans[j]);
  }
  return 0;
}
