#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    string s;
    cin >> s;
    long long P = 0, S = 0, R = 0;
    for (long long i = 0; i < s.length(); i++) {
      if (s[i] == 'R')
        R++;
      else if (s[i] == 'P')
        P++;
      else if (s[i] == 'S')
        S++;
    }
    long long x = max(P, max(S, R));
    if (x == P) {
      for (int i = 0; i < s.length(); i++) cout << "S";
    } else if (x == R) {
      for (int i = 0; i < s.length(); i++) cout << "P";
    } else {
      for (int i = 0; i < s.length(); i++) cout << "R";
    }
    cout << endl;
  }
  return 0;
}
