#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  cin.exceptions(cin.failbit);
  int i, j, k, t, n, x, y;
  cin >> t;
  string s;
  char a[3] = {'R', 'S', 'P'};
  while (t--) {
    cin >> s;
    vector<int> val(3, 0);
    for (i = 0; i < (s.size()); ++i) {
      for (j = 0; j < (3); ++j) {
        if (s[i] == a[j]) val[j]++;
      }
    }
    x = 0, y = -1;
    for (j = 0; j < (3); ++j) {
      if (val[j] > x) {
        x = val[j];
        y = j;
      }
    }
    string ans;
    y = (y - 1 + 3) % 3;
    for (i = 0; i < (s.size()); ++i) ans += a[y];
    cout << ans << endl;
  }
  return 0;
}
