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