#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t;
  cin >> t;
  map<char, int> mp;
  mp['R'] = 0;
  mp['S'] = 1;
  mp['P'] = 2;
  while (t--) {
    string s;
    cin >> s;
    vector<int> vx(4);
    for (int i = 0; i < s.length(); i++) {
      vx[mp[s[i]]]++;
    }
    int x = max_element(vx.begin(), vx.end()) - vx.begin();
    char k;
    if (x == 0) {
      k = 'P';
    } else if (x == 1) {
      k = 'R';
    } else
      k = 'S';
    string ans;
    for (int i = 0; i < s.length(); i++) {
      ans += k;
    }
    cout << ans << endl;
  }
}
