#include <bits/stdc++.h>
using namespace std;
string oppose(char s) {
  if (s == 'R') {
    return "P";
  }
  if (s == 'P') {
    return "S";
  }
  return "R";
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    string s;
    cin >> s;
    string ans = "";
    int r = 0, st = 0, p = 0;
    for (int i = 0; i < s.size(); i++) {
      ans = ans + oppose(s[i]);
      if (ans[i] == 'R') {
        r++;
      } else if (ans[i] == 'S') {
        st++;
      } else {
        p++;
      }
    }
    int maxS = max(r, max(st, p));
    char c;
    if (maxS == r) {
      c = 'R';
    } else if (maxS == st) {
      c = 'S';
    } else {
      c = 'P';
    }
    for (int i = 0; i < s.size(); i++) {
      cout << c;
    }
    cout << endl;
  }
  return 0;
}
