#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    string str;
    cin >> str;
    int r = 0, p = 0, s = 0;
    for (char c : str)
      if (c == 'P')
        p++;
      else if (c == 'S')
        s++;
      else
        r++;
    int MAX = max({r, p, s});
    if (MAX == r)
      cout << string(str.size(), 'P') << "\n";
    else if (MAX == p)
      cout << string(str.size(), 'S') << "\n";
    else
      cout << string(str.size(), 'R') << "\n";
  }
}
