#include <bits/stdc++.h>
using namespace std;
void solve() {
  string s;
  cin >> s;
  vector<int> rsp(3, 0);
  for (int i = 0; i < s.size(); ++i) {
    if (s[i] == 'R') {
      ++rsp[0];
    }
    if (s[i] == 'S') {
      ++rsp[1];
    }
    if (s[i] == 'P') {
      ++rsp[2];
    }
  }
  int max_idx = 0;
  char win_symb = 'P';
  if (rsp[max_idx] < rsp[1]) {
    max_idx = 1;
    win_symb = 'R';
  }
  if (rsp[max_idx] < rsp[2]) {
    max_idx = 2;
    win_symb = 'S';
  }
  for (int i = 0; i < s.size(); ++i) {
    cout << win_symb;
  }
  cout << '\n';
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
