#include <bits/stdc++.h>
using namespace std;
void tmkc() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(0);
}
int main() {
  tmkc();
  int t;
  cin >> t;
  while (t--) {
    string s;
    cin >> s;
    long long a[3] = {0}, i;
    for (i = 0; i < s.length(); i++) {
      if (s[i] == 'R')
        a[0]++;
      else if (s[i] == 'P')
        a[1]++;
      else
        a[2]++;
    }
    char r;
    if (a[0] >= a[1] && a[0] >= a[2])
      r = 'P';
    else if (a[1] >= a[2] && a[1] >= a[0])
      r = 'S';
    else
      r = 'R';
    for (i = 0; i < s.length(); i++) cout << r;
    cout << endl;
  }
}
