#include <bits/stdc++.h>
using namespace std;
void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }
template <typename T, typename V>
void __print(const pair<T, V> &x) {
  cerr << '{';
  __print(x.first);
  cerr << ',';
  __print(x.second);
  cerr << '}';
}
template <typename T>
void __print(const T &x) {
  int f = 0;
  cerr << '{';
  for (auto &i : x) cerr << (f++ ? "," : ""), __print(i);
  cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
  __print(t);
  if (sizeof...(v)) cerr << ", ";
  _print(v...);
}
void Print(int n, char ch) {
  switch (ch) {
    case 'R':
      ch = 'P';
      break;
    case 'S':
      ch = 'R';
      break;
    default:
      ch = 'S';
      break;
  }
  for (int i = 0; i < n; i++) cout << ch;
  cout << endl;
}
struct Node {
  int num;
  char name;
} a[3];
bool cmp(Node &x, Node &y) { return x.num > y.num; }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long i, tc, cs = 1, n, m, k, cnt = 0, j, q, c;
  char ch;
  string s;
  cin >> tc;
  while (tc--) {
    cin >> s;
    n = s.size();
    int R = count((s).begin(), (s).end(), 'R');
    int second = count((s).begin(), (s).end(), 'S');
    int P = n - (second + R);
    a[0].num = R, a[0].name = 'R';
    a[1].num = second, a[1].name = 'S';
    a[2].num = P, a[2].name = 'P';
    sort(a, a + 3, cmp);
    Print(n, a[0].name);
  }
  return 0;
}
