#include <bits/stdc++.h>
using namespace std;
const long double pi = 3.14159265358979323846;
long long MOD = 1e9 + 7;
const char nl = '\n';
const long long inf = 1e15;
long long mul(long long x, long long y) {
  return (1ll * (x % MOD) * (y % MOD));
}
long long modpow(long long x, long long y) {
  long long z = 1;
  while (y > 0) {
    if (y % 2) z = mul(z, x);
    x = mul(x, x);
    y /= 2;
  }
  return z;
}
long long power(long long x, long long y) {
  long long z = 1;
  while (y > 0) {
    if (y % 2) z = z * x;
    x = x * x;
    y /= 2;
  }
  return z;
}
long long gcd(long long a, long long b) {
  if (a < b) return gcd(b, a);
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long min(long long a, long long b) {
  if (a < b) return a;
  return b;
}
long long max(long long a, long long b) {
  if (a > b) return a;
  return b;
}
long long sq(long long a) {
  long long ans = (1ll * a * a);
  return ans;
}
void solve() {
  string st;
  cin >> st;
  long long r, s, p;
  r = p = s = 0;
  long long n = (long long)(st.size());
  for (long long i = 0; i < n; i++) {
    if (st[i] == 'R')
      r++;
    else if (st[i] == 'S')
      s++;
    else
      p++;
  }
  if (r == s && s == p) {
    cout << st << nl;
  } else {
    long long k = max(max(r, s), p);
    if (k == r) {
      for (long long i = 0; i < n; i++) cout << 'P';
    } else if (k == s) {
      for (long long i = 0; i < n; i++) cout << 'R';
    } else {
      for (long long i = 0; i < n; i++) cout << 'S';
    }
    cout << nl;
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  long long TC = 1;
  cin >> TC;
  while (TC--) {
    solve();
  }
  cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC
       << "ms\n";
}
