#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
long long sum(long long a, long long b) {
  while (a + b > MOD) a -= MOD;
  return a + b;
}
long long mult(long long a, long long b) { return (a * b) % MOD; }
long long fexp(long long base, long long exp) {
  long long r = 1;
  for (long long i = 1; i <= exp; i <<= 1) {
    if (i & exp) r = mult(r, base);
    base = mult(base, base);
  }
  return r;
}
long long inv(long long a) { return fexp(a, MOD - 2); }
long long fact[200010];
long long finv[200010];
void f_init() {
  fact[0] = 1;
  for (long long i = 1; i < 200010; i++) {
    fact[i] = mult(fact[i - 1], i);
  }
  finv[200010 - 1] = inv(fact[200010 - 1]);
  for (long long i = 200010 - 1; i; i--) {
    finv[i] = mult(finv[i + 1], i);
  }
}
long long bin(long long a, long long b) {
  if (b > a) return 0;
  return mult(fact[a], mult(finv[b], finv[a - b]));
}
long long N, T, M, K, a, b, c;
int main() {
  cin >> T;
  while (T--) {
    string S;
    cin >> S;
    int r = 0, s = 0, p = 0;
    for (auto lol : S) {
      if (lol == 'R') r++;
      if (lol == 'P') p++;
      if (lol == 'S') s++;
    }
    N = S.size();
    if (r == max({r, s, p})) {
      while (N--) cout << "P";
      cout << "\n";
      continue;
    }
    if (s == max({r, s, p})) {
      while (N--) cout << "R";
      cout << "\n";
      continue;
    }
    if (p == max({r, s, p})) {
      while (N--) cout << "S";
      cout << "\n";
      continue;
    }
  }
  return 0;
}
