#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int n, m, k, q;
const int INF = 1e9 + 5;
const int nax = 1e5 + 5;
int a[1005], pos[1005];
int l, r;
void solve() {
  string s;
  cin >> s;
  n = s.length();
  int R = 0, S = 0, P = 0;
  for (int i = 0; i < n; ++i) {
    if (s[i] == 'R') R++;
    if (s[i] == 'S') S++;
    if (s[i] == 'P') P++;
  }
  char rs;
  if (R == max({R, S, P}))
    rs = 'P';
  else {
    if (S == max({R, S, P}))
      rs = 'R';
    else
      rs = 'S';
  }
  for (int i = 0; i < n; ++i) cout << rs;
  cout << "\n";
}
int main() {
  {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
  };
  int t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
}
