#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int t;
  cin >> t;
  while (t--) {
    string s;
    cin >> s;
    long long int n = s.length();
    long long int r = 0;
    long long int p = 0;
    long long int sc = 0;
    for (long long int i = 0; i < n; ++i) {
      if (s[i] == 'P')
        p++;
      else if (s[i] == 'R')
        r++;
      else
        sc++;
    }
    long long int val = max(p, max(sc, r));
    if (sc == val) {
      for (long long int i = 0; i < n; ++i) {
        cout << "R";
      }
    } else if (r == val) {
      for (long long int i = 0; i < n; ++i) {
        cout << "P";
      }
    } else {
      for (long long int i = 0; i < n; ++i) {
        cout << "S";
      }
    }
    cout << '\n';
  }
}
