#include <bits/stdc++.h>
using namespace std;
bool check(long long n, long long pos) { return n & (1LL << pos); }
long long Set(long long n, long long pos) { return n = n | (1LL << pos); }
string str;
int main() {
  long long i, j, k, l, m, n, o, r, q;
  long long testcase;
  long long input, flag, tag, ans;
  scanf("%lld", &testcase);
  for (long long cs = 1; cs <= testcase; cs++) {
    long long r = 0, s = 0, p = 0;
    cin >> str;
    for (auto it : str) {
      if (it == 'R')
        r++;
      else if (it == 'S')
        s++;
      else
        p++;
    }
    long long mx = max(r, max(s, p));
    if (mx == r)
      for (long long i = 1; i <= str.size(); i++) cout << "P";
    else if (mx == p)
      for (long long i = 1; i <= str.size(); i++) cout << "S";
    else if (mx == s)
      for (long long i = 1; i <= str.size(); i++) cout << "R";
    cout << '\n';
  }
}
