#include <bits/stdc++.h>
using namespace std;
void solve() {
  string s;
  int rc = 0, sc = 0, pc = 0;
  cin >> s;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == 'R') rc++;
    if (s[i] == 'P') pc++;
    if (s[i] == 'S') sc++;
  }
  for (int i = 0; i < s.size(); i++) {
    if (rc >= sc && rc >= pc)
      cout << "P";
    else if (pc >= rc && pc >= sc)
      cout << "S";
    else
      cout << "R";
  }
  cout << "\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  t = 1;
  cin >> t;
  for (int I = 1; I <= t; I++) {
    solve();
  }
  return 0;
}
