#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    string str;
    cin >> str;
    int r = 0, p = 0, s = 0, mxm;
    for (int i = 0; i < str.size(); i++) {
      if (str[i] == 'R')
        r++;
      else if (str[i] == 'P')
        p++;
      else
        s++;
    }
    if (r >= s && r >= p) {
      for (int i = 0; i < str.size(); i++) cout << "P";
      cout << "\n";
    } else if (s >= r && s >= p) {
      for (int i = 0; i < str.size(); i++) cout << "R";
      cout << "\n";
    } else {
      for (int i = 0; i < str.size(); i++) cout << "S";
      cout << "\n";
    }
  }
  return 0;
}
