#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int i, j, k, l, m, n, p, t, a, b, c;
  cin >> t;
  while (t--) {
    string s;
    cin >> s;
    a = count(s.begin(), s.end(), 'R');
    b = count(s.begin(), s.end(), 'S');
    c = count(s.begin(), s.end(), 'P');
    if (a == b && b == c) {
      for (i = 0; i < s.length(); i++) {
        cout << s[i];
      }
      cout << "\n";
    } else {
      p = max(a, max(b, c));
      if (p == a) {
        for (i = 0; i < s.length(); i++) {
          cout << 'P';
        }
        cout << "\n";
      } else if (p == b) {
        for (i = 0; i < s.length(); i++) {
          cout << 'R';
        }
        cout << "\n";
      } else {
        for (i = 0; i < s.length(); i++) {
          cout << 'S';
        }
        cout << "\n";
      }
    }
  }
}
