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