#include <bits/stdc++.h>
using namespace std;
using namespace std;
using ll = long long;
using ld = long double;
const int MOD = 1e9 + 7, inf = 1e9, N = 2e5 + 1;
const ll INF = 1e18;
ld tic, tac;
void solve() {
  string str, ans = "";
  cin >> str;
  int cr = 0, cs = 0, cp = 0;
  for (int i = 0; i < (str.size()); ++i) {
    if (str[i] == 'R')
      cr++;
    else if (str[i] == 'P')
      cp++;
    else
      cs++;
  }
  char ch;
  if (cr >= cp && cr >= cs)
    ch = 'P';
  else if (cp >= cs && cp >= cr)
    ch = 'S';
  else
    ch = 'R';
  cout << string(str.size(), ch) << '\n';
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  cin >> t;
  while (t--) solve();
  return 0;
}
