#include <bits/stdc++.h>
using namespace std;
void solve() {
  string str;
  cin >> str;
  long long int n = str.size();
  long long int r = 0, p = 0, s = 0;
  for (char i : str) {
    if (i == 'R')
      r++;
    else {
      if (i == 'P')
        p++;
      else
        s++;
    }
  }
  string ans = "";
  long long int mx1 = max(r, p);
  long long int mx2 = max(mx1, s);
  if (mx2 == r) {
    for (long long int i = 0; i < n; ++i) ans += 'P';
  } else {
    if (mx2 == p) {
      for (long long int i = 0; i < n; ++i) ans += 'S';
    } else {
      for (long long int i = 0; i < n; ++i) ans += 'R';
    }
  }
  cout << ans << '\n';
}
int32_t main() {
  long long int tst;
  cin >> tst;
  while (tst--) solve();
}
