#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vd = vector<double>;
using vs = vector<string>;
using vpii = vector<pair<int, int>>;
using vpll = vector<pair<ll, ll>>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
int dx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
int dy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
void solve() {
  string second;
  cin >> second;
  int cnt1 = 0, cnt2 = 0, cnt3 = 0;
  for (int i = 0; i < (int)second.length(); i++) {
    cnt1 += second[i] == 'P';
    cnt2 += second[i] == 'R';
    cnt3 += second[i] == 'S';
  }
  string ans;
  int num = max(cnt1, max(cnt2, cnt3));
  if (num == cnt1) {
    ans = string(second.length(), 'S');
  } else if (num == cnt2)
    ans = string(second.length(), 'P');
  else if (num == cnt3)
    ans = string(second.length(), 'R');
  cout << ans << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ll t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
}
