#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int t;
  cin >> t;
  while (t--) {
    string s;
    cin >> s;
    long long int n = s.size();
    string ret;
    long long int count1 = 0;
    long long int count2 = 0;
    long long int count3 = 0;
    for (long long int i = 0; i < n; i++) {
      if (s[i] == 'R') {
        count1++;
      } else {
        if (s[i] == 'P') {
          count2++;
        } else {
          count3++;
        }
      }
    }
    for (long long int i = 0; i < n; i++) {
      ret += 'P';
    }
    if (count2 > count1) {
      for (long long int i = 0; i < n; i++) {
        ret[i] = 'S';
      }
    }
    if (count3 > count1 && count3 > count2) {
      for (long long int i = 0; i < n; i++) {
        ret[i] = 'R';
      }
    }
    cout << ret << endl;
  }
}
