#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  std::ios::sync_with_stdio(false);
  long long te = 1;
  cin >> te;
  while (te--) {
    string s;
    cin >> s;
    long long n = s.size();
    long long a[3] = {0};
    for (long long i = 0; i < n; i++) {
      if (s[i] == 'R')
        a[0]++;
      else if (s[i] == 'P')
        a[1]++;
      else
        a[2]++;
    }
    string t = "";
    long double m = max(a[0], max(a[1], a[2]));
    char c;
    if (m == a[0])
      c = 'P';
    else if (m == a[1])
      c = 'S';
    else
      c = 'R';
    for (long long i = 0; i < n; i++) t.push_back(c);
    cout << t << "\n";
  }
}
