#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int t, a, b, c, q, h, i, j, k, n, n1, n2, n3, st, mid, end, pos,
      ind, min1, min2, max1, max2, lsb, sum, tot, rem, ans, prod, diff, count,
      flag, flag1, temp, temp1, temp2;
  long long int mod = 1000000007, inf = LLONG_MAX, pr = 998244353;
  const int N = 150000 + 1;
  for (cin >> t; t--; cout << "\n") {
    string s;
    cin >> s;
    a = 0;
    b = 0;
    c = 0;
    for (i = 0; i < int((s).size()); ++i) {
      if (s[i] == 'R')
        a++;
      else if (s[i] == 'S')
        b++;
      else if (s[i] == 'P')
        c++;
    }
    char ch;
    max1 = max(a, max(b, c));
    if (max1 == a) ch = 'P';
    if (max1 == b) ch = 'R';
    if (max1 == c) ch = 'S';
    for (i = 0; i < int((s).size()); ++i) {
      s[i] = ch;
    }
    cout << s;
  }
}
