#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <queue>
#include <cstring>
#include <string>
using namespace std;

#define FOREACH(it, c) for(__typeof((c).begin()) it = (c).begin(); it != (c).end(); it ++)
#define FOR(i, a, b) for(int i = (a), _b = (b); i <= _b; i ++)
#define DOW(i, b, a) for(int i = (b), _a = (a); i >= _a; i --)
#define REP(i, n) FOR(i, 0, (n) - 1)
#define DEP(i, n) DOW(i, (n) - 1, 0)
#define all(a) (a).begin(), (a).end()
#define pb(a, b) (a).push_back((b))
#define pf(a, b) (a).push_front((b))
#define ave(a, b) (a+b)/2
#define RI(a) scanf("%d", &a)
#define RII(a) scanf("%I64d", &a)

typedef vector <int> VI;
typedef vector <string> VS;
typedef pair <int, int> PII;
typedef vector <PII> VII;
typedef long long int64;
template <class T> inline int size(const T&c) { return c.size(); }
template <class T> inline int lenght(const T&c) { return c.length(); }

int n, r;
bool istrace;
string trace;

int mistake(int t, int b, char next, int lv) {
	if (t == b)
		if (t == 1 && lv+1 == n) {
			trace = "T";
			return next == 'T';
		}
		else return 1e9;
	if (t > b) {
		int ret = mistake(t-b, b, 'T', lv+1)+(next=='T');
		if (istrace) trace += "T";
		return ret;
	}
	else {
		int ret = mistake(t, b-t, 'B', lv+1)+(next=='B');
		if (istrace) trace += "B";
		return ret;
	}
}

int main() {
	RI(n); RI(r);
	if (r == 1) {
		if (n == 1) cout << 0 << endl << "T";
		else cout << "IMPOSSIBLE";
		return 0;
	}
	istrace = false;
	int ret = 1e9, t = -1;
	FOR(i, 1, r-1) {
		int tmp = 1e9;
		if (i > r-i) tmp = mistake(i, r-i, 'B', 1);
		if (i < r-i) tmp = mistake(i, r-i, 'T', 1);
		if (ret > tmp) {
			ret = tmp;
			t = i;
		}
	}
	if (t == -1) cout << "IMPOSSIBLE";
	else {
		istrace = true;
		trace = "";
		
		if (t > r-t) { mistake(t, r-t, 'B', 1); trace += "B"; }
		if (t < r-t) { mistake(t, r-t, 'T', 1); trace += "T"; }
		cout << ret << endl;
		cout << trace << endl;
	}
	return 0;
}