#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(nullptr);
  int T;
  cin >> T;
  while (T--) {
    string s;
    cin >> s;
    int R = 0;
    int P = 0;
    int S = 0;
    for (int i = 0; i < s.length(); i++) {
      if (s[i] == 'R')
        R++;
      else if (s[i] == 'P')
        P++;
      else
        S++;
    }
    if (R >= P and R >= S) {
      cout << string(s.length(), 'P') << endl;
    } else if (P >= R and P >= S)
      cout << string(s.length(), 'S') << endl;
    else
      cout << string(s.length(), 'R') << endl;
  }
}
