// Parasparopagraho Jīvānām
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/rope>
using namespace __gnu_pbds ;
using namespace __gnu_cxx ;
using namespace std ;
typedef long long ll ;
typedef long double ldb ;
typedef pair<int, int> pii ;
typedef pair<int, ll> pil ;
typedef pair<ll,ll> pll ;
typedef vector<int> vi ;
typedef vector<ll> vll ;
typedef vector<pii> vpi ;
typedef vector<pll> vpl ;
typedef vector<pair<ll,int> > vpli ;
typedef vector<int,pil> edges ;
typedef vector<vi> matrix ;
typedef priority_queue<int> pqu ;
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update> ;
#define rep(i,a,b) for (int i = (a); i <= (b); i++)
#define per(i,b,a) for (int i = (b); i >= (a); i--)
#define mp make_pair
#define eb emplace_back
#define pb push_back
#define pob pop_back
#define fi first
#define se second
#define ins insert
#define bk back
#define con continue
#define lbd lower_bound
#define ubd upper_bound
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define pr cout << // I don't like this but my laptop's 'O' key is not functioning well
/* Careful when using long long
__builtin_clz(int x) {} //: the number of zeros at the beginning of the number
__builtin_ctz(int x) {} //: the number of zeros at the end of the number
__builtin_popcount(int x) {} //: the number of ones in the number
__builtin_parity(int x) {} //: the parity (even or odd) of the number of ones */
const int mod1 = 1000000007 ;
const int mod2 = 998244353 ;
const ll infl = 4e18 ;
const int infi = 2e9 ;
const int maxn = 5e5 + 5 ;
const int block = 500 ;
const int logn = 60 ;
const int alpha = 27 ;
const ldb pi = acos(-1) ;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()) ;
int rng_lr(int a, int b)
{
int ret ;
ret = uniform_int_distribution<int>(a, b)(rng) ;
return ret ;
// For shuffling use shuffle(all, rng) ;
}
ll modpow(ll a, ll b, int MOD) { ll res = 1 ; while(b) { if(b&1) { res = res*a ; res %= MOD ; } a *= a ; a %= MOD ; b >>= 1 ; } return res%MOD ; }
void upmin(int &a, int b) { if(a < b) { a = b ; } }
void relax(int &a, int b) { if(a > b) { a = b ; } }
ll add(ll a, ll b, int MOD) { a += b ; if(a >= MOD) { a -= MOD ; } return a ; }
ll sub(ll a, ll b, int MOD) { a -= b ; if(a < 0) { a += MOD ; } return a ; }
ll mul(ll a, ll b, int MOD) { b %= MOD ; a *= b ; a %= MOD ; return a ; }
ll inverse(ll a, ll MOD) { a = modpow(a, MOD - 2, MOD) ; return a ; }
ll lcm(ll a, ll b) { ll ret ; ll g = __gcd(a, b) ; ret = a/g ; ret = ret*b ; return ret ; }
int icast(char ch) { return int(ch-'a') ; }
void hyn(int a, int b) { if(a == b) cout << "YES\n" ; else cout << "NO\n" ; }
void pyd(int a, int b) { if(a == b) cout << "First\n" ; else cout << "Second\n" ; }
// Check constraints + overflows + types in typedef
ldb ev ;
void sol() {
ldb dp[61][61][61] ;
rep(i,0,60) {
rep(j,0,60) {
rep(k,0,60) {
dp[i][k][k] = (ldb)0 ;
}
}
}
int w, d ;
cin >> w >> d ;
ldb win = (ldb)w ;
ldb dra = (ldb)d ;
ldb den_3 = (ldb)3 ;
dp[1][0][0] = (win + dra)/den_3 ;
dp[0][1][0] = (win + dra)/den_3 ;
dp[0][0][1] = (win + dra)/den_3 ;
int par[60][60][60] ;
par[1][0][0] = 0 ;
par[0][1][0] = 1 ;
par[0][0][1] = 2 ;
rep(i,0,60) {
rep(j,0,60-i) {
rep(k,0,60-i-j) {
if(i == 0 && j == 0 && k == 0) con ;
if(i + j + k > 60) con ;
if(i + j + k == 1) con ;
int t = i + j + k - 1 ;
if(i > 0) {
ldb pbr, pbp, pbs ;
pbr = ((ldb)(k))/(ldb)t ;
pbp = ((ldb)(i-1))/(ldb)t ;
pbs = ((ldb)(j))/(ldb)t ;
ldb exp_val = pbs*win + pbr*dra + dp[i-1][j][k] ;
if(dp[i][j][k] < exp_val) {
dp[i][j][k] = exp_val ;
par[i][j][k] = 0 ;
}
}
if(j > 0) {
ldb pbr, pbp, pbs ;
pbr = ((ldb)(k))/(ldb)t ;
pbp = ((ldb)(i))/(ldb)t ;
pbs = ((ldb)(j-1))/(ldb)t ;
ldb exp_val = pbr*win + pbp*dra +dp[i][j-1][k] ;
if(dp[i][j][k] < exp_val) {
dp[i][j][k] = exp_val ;
par[i][j][k] = 1 ;
}
}
if(k > 0) {
ldb pbr, pbp, pbs ;
pbr = ((ldb)(k-1))/(ldb)t ;
pbp = ((ldb)(i))/(ldb)t ;
pbs = ((ldb)(j))/(ldb)t ;
ldb exp_val = pbp*win + pbs*dra + dp[i][j][k-1] ;
if(dp[i][j][k] < exp_val) {
dp[i][j][k] = exp_val ;
par[i][j][k] = 2 ;
}
}
}
}
}
int ni, nj, nk ;
ldb mx = (ldb)0 ;
rep(i,0,60) {
rep(j,0,60-i) {
rep(k,0,60-i-j) {
if(i + j + k == 60) {
if(dp[i][j][k] > mx) {
mx = dp[i][j][k] ;
ni = i ;
nj = j ;
nk = k ;
}
}
}
}
}
ev = ev + dp[ni][nj][nk] ;
string res ;
// pr ni << " " << nj << " " << nk << endl ;
while(sz(res) < 60) {
if(par[ni][nj][nk] == 0) {
ni-- ;
res.pb('R') ;
}
if(par[ni][nj][nk] == 1) {
nj-- ;
res.pb('P') ;
}
if(par[ni][nj][nk] == 2) {
nk-- ;
res.pb('S') ;
}
}
pr res << "\n" ;
}
int main()
{
ios::sync_with_stdio(false) ;
cin.tie(NULL) ;
int tc ;
cin >> tc ;
int rev ;
cin >> rev ;
ev = (ldb)0 ;
rep(i,1,tc) {
pr "Case #" << i << ": " ;
sol() ;
}
// pr ev << "\n" ;
return 0 ;
}
Ly8gUGFyYXNwYXJvcGFncmFobyBKxKt2xIFuxIFtCiAKI3ByYWdtYSBHQ0Mgb3B0aW1pemUgKCJPMyIpCiNwcmFnbWEgR0NDIHRhcmdldCAoInNzZTQiKQogCiNpbmNsdWRlIDxiaXRzL3N0ZGMrKy5oPgojaW5jbHVk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