#include <bits/stdc++.h>
int T, m1, m2, m3, m;
template <typename T>
inline void read(T &x) {
  char ch = getchar();
  int f = 1;
  x = 0;
  for (; ch > '9' || ch < '0'; ch = getchar())
    if (ch == '-') f = -1;
  for (; ch <= '9' && ch >= '0'; ch = getchar()) x = x * 10 + ch - '0';
  x *= f;
}
int main() {
  read(T);
  std::string s;
  while (T--) {
    std::cin >> s;
    m1 = m2 = m3 = 0;
    for (register int i = 0; i < s.size(); i++)
      if (s[i] == 'R')
        m1++;
      else if (s[i] == 'S')
        m2++;
      else
        m3++;
    m = std::max(m1, std::max(m2, m3));
    if (m == m1)
      for (register int i = 0; i < s.size(); i++) printf("P");
    else if (m == m2)
      for (register int i = 0; i < s.size(); i++) printf("R");
    else
      for (register int i = 0; i < s.size(); i++) printf("S");
    printf("\n");
  }
  return 0;
}
