#include <bits/stdc++.h>
using namespace std;
long long i, i1, j, k, k1, t, n, m, res, flag[10], a, b, rps[3];
string s;
map<char, long long> f;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> t;
  while (t--) {
    f.clear();
    cin >> s;
    n = s.size();
    for (i = 0; i < n; i++) {
      f[s[i]]++;
    }
    rps[0] = f['R'];
    rps[1] = f['P'];
    rps[2] = f['S'];
    if (rps[0] >= rps[1] && rps[0] >= rps[2]) {
      for (i = 0; i < n; i++) {
        cout << "P";
      }
      cout << "\n";
    } else if (rps[1] >= rps[0] && rps[1] >= rps[2]) {
      for (i = 0; i < n; i++) {
        cout << "S";
      }
      cout << "\n";
    } else {
      for (i = 0; i < n; i++) {
        cout << "R";
      }
      cout << "\n";
    }
  }
  return 0;
}
