#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n;
  string s;
  cin >> s;
  long long arr[3] = {0};
  n = s.length();
  for (long long i = 0; i < n; i++) {
    switch (s[i]) {
      case 'R':
        arr[0]++;
        break;
      case 'S':
        arr[1]++;
        break;
      case 'P':
        arr[2]++;
        break;
    }
  }
  if (arr[0] >= arr[1] and arr[0] >= arr[2]) {
    for (long long i = 0; i < n; i++) cout << 'P';
  } else if (arr[1] >= arr[0] and arr[1] >= arr[2]) {
    for (long long i = 0; i < n; i++) cout << 'R';
  } else {
    for (long long i = 0; i < n; i++) cout << 'S';
  }
  cout << endl;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t;
  cin >> t;
  for (long long T = 1; T <= t; T++) {
    solve();
  }
}
