#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    string s;
    cin >> s;
    map<char, int> mp;
    for (auto x : s) mp[x]++;
    pair<int, char> mx = {-1, '0'};
    for (auto x : mp) mx = max(mx, {x.second, x.first});
    int n = int(s.size());
    if (mx.second == 'P') cout << string(n, 'S') << "\n";
    if (mx.second == 'R') cout << string(n, 'P') << "\n";
    if (mx.second == 'S') cout << string(n, 'R') << "\n";
  }
}
