#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
const ll llinf = (ll)1e18;
const int intinf = 1e9;
const int MOD = (int)(1e9 + 7);
const ld EPS = 1e-7;
void solve() {
  string inp;
  cin >> inp;
  int n = inp.length();
  string r = string(n, 'R');
  string s = string(n, 'S');
  string p = string(n, 'P');
  int rc = 0, sc = 0, pc = 0;
  for (auto& c : inp) {
    rc += (c == 'R');
    sc += (c == 'S');
    pc += (c == 'P');
  }
  int mx = max(rc, max(sc, pc));
  if (mx == rc) {
    cout << p << endl;
  } else if (mx == sc) {
    cout << r << endl;
  } else {
    cout << s << endl;
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
