#include <bits/stdc++.h>
using namespace std;
bool db = false;
const long long INF = 1e18 + 1;
const long long maxn = 2 * 1e6 + 1;
long long t, n, m;
string s;
int R, S, P;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> t;
  while (t--) {
    cin >> s;
    n = s.size();
    R = 0;
    S = 0;
    P = 0;
    char c;
    for (int i = 0; i < n; i++) {
      if (s[i] == 'R') {
        R++;
      } else if (s[i] == 'S') {
        S++;
      } else if (s[i] == 'P') {
        P++;
      }
    }
    if (R >= S and R >= P)
      c = 'P';
    else if (S >= P and S >= R)
      c = 'R';
    else if (P >= R and P >= S)
      c = 'S';
    s = "";
    s.append(n, c);
    cout << s << endl;
  }
  return 0;
}
