#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
using namespace std;
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cout << *it << " = " << a << "\n";
  err(++it, args...);
}
const long long N = 2e5 + 5, M = 1e9 + 7, inf = 1e18;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  int tt;
  cin >> tt;
  while (tt--) {
    string s;
    cin >> s;
    map<char, int> m;
    for (int i = 0; i < ((int)(s).size()); i++) {
      m[s[i]]++;
    }
    char c;
    if (m['R'] >= m['P'] and m['R'] >= m['S']) c = 'P';
    if (m['P'] >= m['R'] and m['P'] >= m['S']) c = 'S';
    if (m['S'] >= m['P'] and m['S'] >= m['R']) c = 'R';
    for (int i = 0; i < ((int)(s).size()); i++) {
      cout << c;
    }
    cout << "\n";
  }
}
