#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  std::cerr << name << " : " << arg1 << '\n';
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  std::cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
const long long int N = 1e5 + 5;
void Hariiih() {
  string s;
  cin >> s;
  long long int n = s.length();
  long long int a[3] = {0};
  string ans = "RPS";
  for (long long int i = 0; i < n; ++i) {
    if (s[i] == 'R') a[0]++;
    if (s[i] == 'P') a[1]++;
    if (s[i] == 'S') a[2]++;
  }
  long long int m = max({a[0], a[1], a[2]});
  for (long long int i = 0; i < 3; ++i) {
    if (a[i] == m) {
      for (long long int j = 0; j < n; ++j) {
        cout << ans[(i + 1) % 3];
      }
      cout << '\n';
      return;
    }
  }
  return;
}
signed main() {
  std::ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int t = 1;
  cin >> t;
  while (t--) Hariiih();
  return 0;
  return 0;
}
