#include <bits/stdc++.h>
using namespace std;
int month[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
string lowerCase = "abcdefghijklmnopqrstuvwxyz";
string upperCase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const int fx8[] = {+1, +1, +0, -1, -1, -1, +0, +1};
const int fy8[] = {+0, +1, +1, +1, +0, -1, -1, -1};
const int fx4[] = {+1, 0, -1, 0};
const int fy4[] = {0, +1, 0, -1};
long long t, m, n, x, y, cnt;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> t;
  while (t--) {
    string s;
    cin >> s;
    int R = 0, S = 0, P = 0;
    for (auto i : s) {
      if (i == 'R')
        R++;
      else if (i == 'S')
        S++;
      else
        P++;
    }
    int n = s.size();
    int m = max(R, max(S, P));
    if (m == R)
      for (int i = 0; i < n; i++) cout << 'P';
    else if (m == S)
      for (int i = 0; i < n; i++) cout << 'R';
    else
      for (int i = 0; i < n; i++) cout << 'S';
    cout << endl;
  }
  return 0;
}
