#include <bits/stdc++.h>
using namespace std;
void solve(vector<int> &v, int n) {
  for (int i = 1; i < n - 1; i++) {
    if (v[i - 1] < v[i] && v[i] > v[i + 1]) {
      cout << "YES" << endl << i << " " << i + 1 << " " << i + 2 << endl;
      return;
    }
  }
  cout << "NO" << endl;
}
bool sortbysec(const pair<int, int> &a, const pair<int, int> &b) {
  return (a.second > b.second);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  map<pair<char, char>, int> m;
  m[{'R', 'S'}] = 1;
  m[{'S', 'P'}] = 1;
  m[{'P', 'R'}] = 1;
  int t;
  cin >> t;
  while (t--) {
    string s, ans = "";
    cin >> s;
    vector<pair<char, int>> v{{'R', 0}, {'P', 0}, {'S', 0}};
    for (int i = 0; i < 3; i++) {
      for (int j = 0; j < s.length(); j++) {
        v[i].second += m[{v[i].first, s[j]}];
      }
    }
    sort(v.begin(), v.end(), sortbysec);
    for (int i = 0; i < s.length(); i++) ans += v[0].first;
    cout << ans << endl;
  }
}
