#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    string s;
    cin >> s;
    map<char, int> mp;
    char maxi = 'R';
    for (int i = 0; i < s.length(); i++) {
      mp[s[i]]++;
      if (mp[s[i]] > mp[maxi]) maxi = s[i];
    }
    for (int i = 0; i < s.length(); i++) {
      if (maxi == 'R')
        cout << 'P';
      else if (maxi == 'S')
        cout << 'R';
      else
        cout << 'S';
    }
    cout << endl;
  }
  return 0;
}
