#include <bits/stdc++.h>
using namespace std;
template <typename T, typename U>
bool ckmin(T &a, U b) {
  return b < a ? a = b, true : false;
}
template <typename T, typename U>
bool ckmax(T &a, U b) {
  return b > a ? a = b, true : false;
}
int tt;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> tt;
  while (tt--) {
    string second;
    cin >> second;
    vector<char> res = {'R', 'S', 'P'};
    vector<int> cnt(3, 0);
    for (int i = 0; i < (int)(second).size(); ++i) {
      if (second[i] == 'R') cnt[2]++;
      if (second[i] == 'S') cnt[0]++;
      if (second[i] == 'P') cnt[1]++;
    }
    char win = ' ';
    int mx = *max_element(cnt.begin(), cnt.end());
    for (int i = 0; i < 3; ++i) {
      if (cnt[i] == mx) win = res[i];
    }
    for (int i = 0; i < (int)(second).size(); ++i) {
      cout << win;
    }
    cout << "\n";
  }
  return 0;
}
