#include <bits/stdc++.h>
using namespace std;
int const MAXN = 2e6 + 9;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    string s;
    cin >> s;
    map<char, int> mp;
    int mx = 0;
    for (auto c : s) {
      mp[c]++;
      mx = max(mx, mp[c]);
    }
    for (auto cur : mp) {
      if (cur.second == mx) {
        char c = cur.first;
        for (int i = 0; i < (int)s.size(); i++) {
          if (c == 'R') cout << "P";
          if (c == 'S') cout << "R";
          if (c == 'P') cout << "S";
        }
        break;
      }
    }
    cout << '\n';
  }
}
