#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    string s;
    cin >> s;
    int a = 0, b = 0, c = 0, m = -1, d, n = s.length();
    for (int i = 0; i < s.length(); i++) {
      if (s[i] == 'R')
        a++;
      else if (s[i] == 'P')
        b++;
      else
        c++;
    }
    if (a > m) m = a, d = 1;
    if (b > m) m = b, d = 2;
    if (c > m) m = c, d = 3;
    if (d == 1)
      while (n--) cout << 'P';
    else if (d == 2)
      while (n--) cout << 'S';
    else
      while (n--) cout << 'R';
    cout << endl;
  }
}
