#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long double pi = 3.14159265359;
const long long N = 100005;
long long a[N][35];
long long n;
long long b[35][2];
long long ch = 0;
long long power(long long a, long long b) {
  long long res = 1;
  a %= mod;
  while (b > 0) {
    if (b % 2 == 1) {
      res = (res * a) % mod;
    }
    b /= 2;
    a = (a * a) % mod;
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  long long t;
  cin >> t;
  while (t--) {
    string s;
    cin >> s;
    long long n = s.length();
    long long x = 0, y = 0, z = 0;
    for (long long i = 0; i < n; i++) {
      if (s[i] == 'R')
        x++;
      else if (s[i] == 'P')
        y++;
      else
        z++;
    }
    long long p = max(x, max(y, z));
    if (p == x) {
      for (long long i = 0; i < n; i++) {
        cout << "P";
      }
    } else if (p == y) {
      for (long long i = 0; i < n; i++) {
        cout << "S";
      }
    } else {
      for (long long i = 0; i < n; i++) cout << "R";
    }
    cout << "\n";
  }
}
