#include <bits/stdc++.h>
using namespace std;
const long long dx[] = {-1, -1, -1, 0, 1, 1, 1, 0};
const long long dy[] = {-1, 0, 1, 1, 1, 0, -1, -1};
long long n, m, i;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long test = 1;
  cin >> test;
  while (test--) {
    string ss;
    cin >> ss;
    std::map<char, long long> mp;
    for (auto x : ss) mp[x]++;
    char ans = 'R';
    if (mp['R'] >= mp['P'] and mp['R'] >= mp['S'])
      ans = 'P';
    else if (mp['P'] >= mp['R'] and mp['P'] >= mp['S'])
      ans = 'S';
    for (i = 0; i < ss.length(); i++) cout << ans;
    cout << '\n';
  }
  return 0;
}
