#include <bits/stdc++.h>
using namespace std;
bool compare(char &s1, char &s2) { return s1 > s2; }
bool sortmahstyle(const pair<long long int, long long int> &a,
                  const pair<long long int, long long int> &b) {
  if (a.second > b.second) return true;
  if (a.second == b.second && a.first > b.second) return true;
  return false;
}
long long int const mod = 1e9 + 7;
long long int const inf = 1e5 + 1;
void solve() {
  string s;
  cin >> s;
  map<char, long long int> cnt;
  for (auto e : s) cnt[e]++;
  for (auto e : s) {
    char ch;
    long long int a = cnt['P'];
    long long int b = cnt['S'];
    long long int c = cnt['R'];
    if (a >= b && a >= c) ch = 'S';
    if (b >= a && b >= c) ch = 'R';
    if (c >= b && c >= a) ch = 'P';
    cout << ch;
  }
  cout << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int t;
  cin >> t;
  while (t-- > 0) {
    solve();
  }
  return 0;
}
