#include <bits/stdc++.h>
using namespace std;
const char nl = '\n';
long long mod = 1e9 + 7;
long long a[500010];
void solve() {
  string s;
  cin >> s;
  int n = s.size();
  bool ok = false;
  for (int i = 1; i < n; i++) {
    if (s[i] == s[i - 1] && s[i] == '1') {
      ok = true;
    }
    if (s[i] == s[i - 1] && ok && s[i] == '0') {
      cout << "NO" << nl;
      return;
    }
  }
  cout << "YES" << nl;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    string s;
    cin >> s;
    map<char, int> m;
    for (char& ch : s) {
      m[ch]++;
    }
    char ans = 'P';
    int cnt = 0;
    for (auto it = m.begin(); it != m.end(); it++) {
      if (it->second > cnt) {
        ans = it->first;
        cnt = it->second;
      }
    }
    if (ans == 'R')
      ans = 'P';
    else if (ans == 'P')
      ans = 'S';
    else
      ans = 'R';
    for (int i = 0; i < s.size(); i++) cout << ans;
    cout << nl;
  }
}
