#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long int cnt[3];
  memset(cnt, 0, sizeof(cnt));
  string c;
  cin >> c;
  for (long long int i = 0; i < (c.size()); i++) {
    if (c[i] == 'R') cnt[0]++;
    if (c[i] == 'P') cnt[1]++;
    if (c[i] == 'S') cnt[2]++;
  }
  long long int maxind = max_element(cnt, cnt + 3) - cnt;
  string ans;
  char t;
  if (maxind == 0)
    t = 'P';
  else if (maxind == 1)
    t = 'S';
  else
    t = 'R';
  for (long long int i = 0; i < (c.size()); i++) {
    ans.push_back(t);
  }
  cout << ans << endl;
}
int main() {
  long long int t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
}
