#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
const int mod = 1000000007;
const int inf = 0x3f3f3f3f;
const int maxn = 200005;
void task() {
  string s;
  cin >> s;
  int n = s.size();
  int R = 0, S = 0, P = 0;
  for (auto ch : s) {
    if (ch == 'R')
      R++;
    else if (ch == 'S')
      S++;
    else
      P++;
  }
  string ans;
  if (R >= S and R >= P) {
    for (int i = 0; i < n; i++) ans += 'P';
  } else if (S >= R and S >= P) {
    for (int i = 0; i < n; i++) ans += 'R';
  } else if (P >= R and P >= S) {
    for (int i = 0; i < n; i++) ans += 'S';
  }
  cout << ans << "\n";
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int T = 1;
  cin >> T;
  while (T--) {
    task();
  }
  return 0;
}
