#include <bits/stdc++.h>
using namespace std;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
const long long INF = 0x3f3f3f3f3f3f3f3f;
const int inf = 0x3f3f3f3f;
const long long mod = 1e9 + 7;
const double eps = 1e-11;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
long long mul(long long a, long long b) {
  long long ans = 0;
  a %= mod, b %= mod;
  while (b) {
    if (b & 1) ans = (ans + a) % mod;
    a = (a * 2) % mod;
    b >>= 1;
  }
  return ans;
}
long long powmod(long long a, long long b) {
  long long ans = 1, pow = a;
  while (b) {
    if (b & 1) ans = (ans * pow) % mod;
    pow = (pow * pow) % mod;
    b >>= 1;
  }
  return ans;
}
int pr(long long num) {
  if (num == 1) return 0;
  if (num == 2 || num == 3) return 1;
  if (num % 6 != 1 && num % 6 != 5) return 0;
  int tmp = sqrt(num);
  for (int i = 5; i <= tmp; i += 6)
    if (num % i == 0 || num % (i + 2) == 0) return 0;
  return 1;
}
int Day(int y, int m, int d) {
  if (m == 1 || m == 2) {
    m += 12;
    y--;
  }
  int w = (d + 2 * m + 3 * (m + 1) / 5 + y + y / 4 - y / 100 + y / 400) % 7;
  return w + 1;
}
long long C(long long n, long long m) {
  if (n < m) return 0;
  long long res = 1;
  for (int i = 1; i <= m; i++) {
    long long a = (n + i - m) % mod;
    long long b = i % mod;
    res = res * (a * powmod(b, mod - 2) % mod) % mod;
  }
  return res;
}
long long Lucas(long long n, long long m) {
  if (m == 0) return 1;
  return C(n % mod, m % mod) * Lucas(n / mod, m / mod) % mod;
}
const int maxn = 2e5 + 5;
long long a[maxn];
int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    string s;
    cin >> s;
    map<char, int> mp;
    int maxx = 0;
    char ans;
    for (auto i : s) {
      mp[i]++;
      if (mp[i] > maxx) {
        maxx = mp[i];
        ans = i;
      }
    }
    if (ans == 'R')
      cout << string(s.size(), 'P') << '\n';
    else if (ans == 'P')
      cout << string(s.size(), 'S') << '\n';
    else
      cout << string(s.size(), 'R') << '\n';
  }
  return 0;
}
