#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0);
  cout.tie(0);
  ios::sync_with_stdio(false);
  int t;
  cin >> t;
  while (t--) {
    string s;
    cin >> s;
    int cntR = 0, cntS = 0, cntP = 0;
    for (int i = 0; i < s.size(); ++i) {
      if (s[i] == 'R')
        cntR += 1;
      else if (s[i] == 'S')
        cntS += 1;
      else
        cntP += 1;
    }
    int n = s.size();
    if (cntR >= cntS && cntR >= cntP) {
      cout << string(n, 'P') << endl;
    } else if (cntS >= cntR && cntS >= cntP) {
      cout << string(n, 'R') << endl;
    } else
      cout << string(n, 'S') << endl;
  }
  return 0;
}
