#include <bits/stdc++.h>
using namespace std;
const double pi = 3.141592653589793;
bool isprime(long long n) {
  for (long long i = 2; i * i <= n; i++) {
    if (n % i == 0) return false;
  }
  return true;
}
long long power(long long a, long long b) {
  long long ans = 1;
  while (b > 0) {
    if (b & 1) {
      ans = (ans * a);
    }
    b >>= 1;
    a = (a * a);
  }
  return ans;
}
void frooty() {
  string s;
  cin >> s;
  string ans;
  long long n = (long long)s.size();
  long long c1 = 0, c2 = 0, c3 = 0;
  for (long long i = 0; i < n; i++) {
    if (s[i] == 'R') {
      c1++;
    } else if (s[i] == 'P') {
      c2++;
    } else
      c3++;
  }
  long long maxx = max(c1, max(c2, c3));
  if (maxx == c1) {
    for (long long i = 0; i < n; i++) ans += 'P';
  } else if (maxx == c2) {
    for (long long i = 0; i < n; i++) ans += 'S';
  } else {
    for (long long i = 0; i < n; i++) ans += 'R';
  }
  cout << ans << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int q = 1;
  cin >> q;
  while (q--) {
    frooty();
  }
}
