#include using namespace std; #define FOR(i,a,b) for(int i=(a);i<(b);i++) #define REP(i,n) FOR(i,0,n) #define ALL(v) (v).begin(),(v).end() template inline bool chmax(A &a, B b) { if (a inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; } typedef unsigned long long ull; typedef long long ll; typedef pair pii; typedef pair pll; typedef pair P; const ll INF = 1ll<<29; const ll MOD = 1000000007; const double EPS = 1e-10; int main() { int prev[4094]; memset(prev, -1, sizeof(prev)); queue que; que.push(0); while (!que.empty()) { int now = que.front(); que.pop(); int l = now * 2 + 1; int r = now * 2 + 2; if (l <= 4094) { prev[l] = now; que.push(l); } if (r <= 4094) { prev[r] = now; que.push(r); } } int m; cin >> m; while (m--) { int a; scanf("%d", &a); vector v; v.push_back(a); while (v.back() != 0) v.push_back(prev[v.back()]); reverse(ALL(v)); REP(i, v.size() - 1) { if (v[i] * 2 + 1 == v[i + 1]) putchar('L'); else putchar('R'); } puts(""); } return 0; }