#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    string st;
    cin >> st;
    string d = "";
    int p = 0, r = 0, s = 0;
    for (int i = 0; i < st.size(); i++) {
      if (st[i] == 'S') {
        d += "R";
        r++;
      } else if (st[i] == 'R') {
        d += "P";
        p++;
      } else {
        d += "S";
        s++;
      }
    }
    int maxi = max(p, r);
    char ch;
    if (maxi == p)
      ch = 'P';
    else
      ch = 'R';
    int maxi1 = max(maxi, s);
    if (maxi1 == s) ch = 'S';
    for (int i = 0; i < st.size(); i++) cout << ch;
    cout << "\n";
  }
  return 0;
}
