Recently, you found a bot to play "Rock paper scissors" with. Unfortunately, the bot uses quite a simple algorithm to play: he has a string $s = s_1 s_2 \dots s_{n}$ of length $n$ where each letter is either R, S or P.

While initializing, the bot is choosing a starting index $pos$ ($1 \le pos \le n$), and then it can play any number of rounds. In the first round, he chooses "Rock", "Scissors" or "Paper" based on the value of $s_{pos}$:   if $s_{pos}$ is equal to R the bot chooses "Rock";  if $s_{pos}$ is equal to S the bot chooses "Scissors";  if $s_{pos}$ is equal to P the bot chooses "Paper"; 

In the second round, the bot's choice is based on the value of $s_{pos + 1}$. In the third round — on $s_{pos + 2}$ and so on. After $s_n$ the bot returns to $s_1$ and continues his game.

You plan to play $n$ rounds and you've already figured out the string $s$ but still don't know what is the starting index $pos$. But since the bot's tactic is so boring, you've decided to find $n$ choices to each round to maximize the average number of wins.

In other words, let's suggest your choices are $c_1 c_2 \dots c_n$ and if the bot starts from index $pos$ then you'll win in $win(pos)$ rounds. Find $c_1 c_2 \dots c_n$ such that $\frac{win(1) + win(2) + \dots + win(n)}{n}$ is maximum possible.


-----Input-----

The first line contains a single integer $t$ ($1 \le t \le 1000$) — the number of test cases.

Next $t$ lines contain test cases — one per line. The first and only line of each test case contains string $s = s_1 s_2 \dots s_{n}$ ($1 \le n \le 2 \cdot 10^5$; $s_i \in \{\text{R}, \text{S}, \text{P}\}$) — the string of the bot.

It's guaranteed that the total length of all strings in one test doesn't exceed $2 \cdot 10^5$.


-----Output-----

For each test case, print $n$ choices $c_1 c_2 \dots c_n$ to maximize the average number of wins. Print them in the same manner as the string $s$.

If there are multiple optimal answers, print any of them.


-----Example-----
Input
3
RRRR
RSP
S

Output
PPPP
RSP
R


-----Note-----

In the first test case, the bot (wherever it starts) will always choose "Rock", so we can always choose "Paper". So, in any case, we will win all $n = 4$ rounds, so the average is also equal to $4$.

In the second test case:   if bot will start from $pos = 1$, then $(s_1, c_1)$ is draw, $(s_2, c_2)$ is draw and $(s_3, c_3)$ is draw, so $win(1) = 0$;  if bot will start from $pos = 2$, then $(s_2, c_1)$ is win, $(s_3, c_2)$ is win and $(s_1, c_3)$ is win, so $win(2) = 3$;  if bot will start from $pos = 3$, then $(s_3, c_1)$ is lose, $(s_1, c_2)$ is lose and $(s_2, c_3)$ is lose, so $win(3) = 0$;  The average is equal to $\frac{0 + 3 + 0}{3} = 1$ and it can be proven that it's the maximum possible average.

A picture from Wikipedia explaining "Rock paper scissors" game:  $\beta$

Difficulty: MEDIUM

Solutions:
n = int(input())
for _ in range(n):
	s = input()
	num_dict = {}
	for i in s:
		if i in num_dict.keys():
			num_dict[i] += 1
		else:
			num_dict[i] = 1
	final = ''
	key = max(num_dict, key=num_dict.get)
	value = num_dict[key]
	if key == 'P':
		final += 'S' * len(s)
	elif key == 'S':
		final += 'R' * len(s)
	else:
		final += 'P' * len(s)
	print(final)


import sys
import math
from functools import reduce
import bisect

def getN():
	return int(input())

def getNM():
	return map(int, input().split())

def getList():
	return list(map(int, input().split()))

def input():
	return sys.stdin.readline().rstrip()

def index(a, x):
	i = bisect.bisect_left(a, x)
	if i != len(a) and a[i] == x:
		return i
	return False

def find_dividers(x):
	dividers = []
	for i in range(2, int(math.sqrt(x)) + 1):
		if x % i == 0:
			dividers.append(i)
			if i * i != x:
				dividers.append(x // i)
	return dividers
for _ in range(int(input())):
	s = input()
	amount = dict()
	for x in s:
		if x == 'R':
			amount.setdefault('R', 0)
			amount['R'] += 1
		elif x == 'S':
			amount.setdefault('S', 0)
			amount['S'] += 1
		else:
			amount.setdefault('P', 0)
			amount['P'] += 1
	letter = max(amount, key=amount.get)
	if letter == 'R':
		print('P' * len(s))
	elif letter == 'S':
		print('R' * len(s))
	else:
		print('S' * len(s))


from collections import Counter
for s in range(int(input())):
	a = {'R': 'P', 'P': 'S', 'S': 'R'}
	h = input()
	i = Counter(h).most_common()[0][0]
	print(a[i] * len(h))


import os
import sys
from io import BytesIO, IOBase
from collections import Counter, defaultdict
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997, 1009, 1013, 1019, 1021, 1031, 1033, 1039, 1049, 1051, 1061, 1063, 1069, 1087, 1091, 1093, 1097, 1103, 1109, 1117, 1123, 1129, 1151, 1153, 1163, 1171, 1181, 1187, 1193, 1201, 1213, 1217, 1223, 1229, 1231, 1237, 1249, 1259, 1277, 1279, 1283, 1289, 1291, 1297, 1301, 1303, 1307, 1319, 1321, 1327, 1361, 1367, 1373, 1381, 1399, 1409, 1423, 1427, 1429, 1433, 1439, 1447, 1451, 1453, 1459, 1471, 1481, 1483, 1487, 1489, 1493, 1499, 1511, 1523, 1531, 1543, 1549, 1553, 1559, 1567, 1571, 1579, 1583, 1597, 1601, 1607, 1609, 1613, 1619, 1621, 1627, 1637, 1657, 1663, 1667, 1669, 1693, 1697, 1699, 1709, 1721, 1723, 1733, 1741, 1747, 1753, 1759, 1777, 1783, 1787, 1789, 1801, 1811, 1823, 1831, 1847, 1861, 1867, 1871, 1873, 1877, 1879, 1889, 1901, 1907, 1913, 1931, 1933, 1949, 1951, 1973, 1979, 1987, 1993, 1997, 1999, 2003, 2011, 2017, 2027, 2029, 2039, 2053, 2063, 2069, 2081, 2083, 2087, 2089, 2099, 2111, 2113, 2129, 2131, 2137, 2141, 2143, 2153, 2161, 2179, 2203, 2207, 2213, 2221, 2237, 2239, 2243, 2251, 2267, 2269, 2273, 2281, 2287, 2293, 2297, 2309, 2311, 2333, 2339, 2341, 2347, 2351, 2357, 2371, 2377, 2381, 2383, 2389, 2393, 2399, 2411, 2417, 2423, 2437, 2441, 2447, 2459, 2467, 2473, 2477, 2503, 2521, 2531, 2539, 2543, 2549, 2551, 2557, 2579, 2591, 2593, 2609, 2617, 2621, 2633, 2647, 2657, 2659, 2663, 2671, 2677, 2683, 2687, 2689, 2693, 2699, 2707, 2711, 2713, 2719, 2729, 2731, 2741, 2749, 2753, 2767, 2777, 2789, 2791, 2797, 2801, 2803, 2819, 2833, 2837, 2843, 2851, 2857, 2861, 2879, 2887, 2897, 2903, 2909, 2917, 2927, 2939, 2953, 2957, 2963, 2969, 2971, 2999, 3001, 3011, 3019, 3023, 3037, 3041, 3049, 3061, 3067, 3079, 3083, 3089, 3109, 3119, 3121, 3137, 3163, 3167, 3169, 3181, 3187, 3191, 3203, 3209, 3217, 3221, 3229, 3251, 3253, 3257, 3259, 3271, 3299, 3301, 3307, 3313, 3319, 3323, 3329, 3331, 3343, 3347, 3359, 3361, 3371, 3373, 3389, 3391, 3407, 3413, 3433, 3449, 3457, 3461, 3463, 3467, 3469, 3491, 3499, 3511, 3517, 3527, 3529, 3533, 3539, 3541, 3547, 3557, 3559, 3571, 3581, 3583, 3593, 3607, 3613, 3617, 3623, 3631, 3637, 3643, 3659, 3671, 3673, 3677, 3691, 3697, 3701, 3709, 3719, 3727, 3733, 3739, 3761, 3767, 3769, 3779, 3793, 3797, 3803, 3821, 3823, 3833, 3847, 3851, 3853, 3863, 3877, 3881, 3889, 3907, 3911, 3917, 3919, 3923, 3929, 3931, 3943, 3947, 3967, 3989, 4001, 4003, 4007, 4013, 4019, 4021, 4027, 4049, 4051, 4057, 4073, 4079, 4091, 4093, 4099, 4111, 4127, 4129, 4133, 4139, 4153, 4157, 4159, 4177, 4201, 4211, 4217, 4219, 4229, 4231, 4241, 4243, 4253, 4259, 4261, 4271, 4273, 4283, 4289, 4297, 4327, 4337, 4339, 4349, 4357, 4363, 4373, 4391, 4397, 4409, 4421, 4423, 4441, 4447, 4451, 4457, 4463, 4481, 4483, 4493, 4507, 4513, 4517, 4519, 4523, 4547, 4549, 4561, 4567, 4583, 4591, 4597, 4603, 4621, 4637, 4639, 4643, 4649, 4651, 4657, 4663, 4673, 4679, 4691, 4703, 4721, 4723, 4729, 4733, 4751, 4759, 4783, 4787, 4789, 4793, 4799, 4801, 4813, 4817, 4831, 4861, 4871, 4877, 4889, 4903, 4909, 4919, 4931, 4933, 4937, 4943, 4951, 4957, 4967, 4969, 4973, 4987, 4993, 4999, 5003, 5009, 5011, 5021, 5023, 5039, 5051, 5059, 5077, 5081, 5087, 5099, 5101, 5107, 5113, 5119, 5147, 5153, 5167, 5171, 5179, 5189, 5197, 5209, 5227, 5231, 5233, 5237, 5261, 5273, 5279, 5281, 5297, 5303, 5309, 5323, 5333, 5347, 5351, 5381, 5387, 5393, 5399, 5407, 5413, 5417, 5419, 5431, 5437, 5441, 5443, 5449, 5471, 5477, 5479, 5483, 5501, 5503, 5507, 5519, 5521, 5527, 5531, 5557, 5563, 5569, 5573, 5581, 5591, 5623, 5639, 5641, 5647, 5651, 5653, 5657, 5659, 5669, 5683, 5689, 5693, 5701, 5711, 5717, 5737, 5741, 5743, 5749, 5779, 5783, 5791, 5801, 5807, 5813, 5821, 5827, 5839, 5843, 5849, 5851, 5857, 5861, 5867, 5869, 5879, 5881, 5897, 5903, 5923, 5927, 5939, 5953, 5981, 5987, 6007, 6011, 6029, 6037, 6043, 6047, 6053, 6067, 6073, 6079, 6089, 6091, 6101, 6113, 6121, 6131, 6133, 6143, 6151, 6163, 6173, 6197, 6199, 6203, 6211, 6217, 6221, 6229, 6247, 6257, 6263, 6269, 6271, 6277, 6287, 6299, 6301, 6311, 6317, 6323, 6329, 6337, 6343, 6353, 6359, 6361, 6367, 6373, 6379, 6389, 6397, 6421, 6427, 6449, 6451, 6469, 6473, 6481, 6491, 6521, 6529, 6547, 6551, 6553, 6563, 6569, 6571, 6577, 6581, 6599, 6607, 6619, 6637, 6653, 6659, 6661, 6673, 6679, 6689, 6691, 6701, 6703, 6709, 6719, 6733, 6737, 6761, 6763, 6779, 6781, 6791, 6793, 6803, 6823, 6827, 6829, 6833, 6841, 6857, 6863, 6869, 6871, 6883, 6899, 6907, 6911, 6917, 6947, 6949, 6959, 6961, 6967, 6971, 6977, 6983, 6991, 6997, 7001, 7013, 7019, 7027, 7039, 7043, 7057, 7069, 7079, 7103, 7109, 7121, 7127, 7129, 7151, 7159, 7177, 7187, 7193, 7207, 7211, 7213, 7219, 7229, 7237, 7243, 7247, 7253, 7283, 7297, 7307, 7309, 7321, 7331, 7333, 7349, 7351, 7369, 7393, 7411, 7417, 7433, 7451, 7457, 7459, 7477, 7481, 7487, 7489, 7499, 7507, 7517, 7523, 7529, 7537, 7541, 7547, 7549, 7559, 7561, 7573, 7577, 7583, 7589, 7591, 7603, 7607, 7621, 7639, 7643, 7649, 7669, 7673, 7681, 7687, 7691, 7699, 7703, 7717, 7723, 7727, 7741, 7753, 7757, 7759, 7789, 7793, 7817, 7823, 7829, 7841, 7853, 7867, 7873, 7877, 7879, 7883, 7901, 7907, 7919]
from math import ceil

def lmii():
	return list(map(int, input().split()))
d = {'R': 'P', 'S': 'R', 'P': 'S'}
t = int(input())
for i in range(t):
	a = input()
	s = Counter(a)
	print(d[s.most_common(1)[0][0]] * len(a))


def solve():
	from collections import Counter
	t = int(input())
	for _ in range(t):
		s = input()
		l = len(s)
		c = Counter(s)
		ma = max(c, key=c.get)
		if ma == 'R':
			ma = 'P'
		elif ma == 'P':
			ma = 'S'
		else:
			ma = 'R'
		print(ma * l)
solve()


from collections import Counter
t = int(input())
for _ in range(t):
	mas = input()
	count = Counter(mas).most_common()
	if count[0][0] == 'R':
		str = 'P'
	elif count[0][0] == 'P':
		str = 'S'
	else:
		str = 'R'
	stonks = str * len(mas)
	print(stonks)


from sys import stdin
input = lambda : stdin.readline().rstrip('\r\n')
from collections import deque as que
from collections import defaultdict as vector
from heapq import *
inin = lambda : int(input())
inar = lambda : list(map(int, input().split()))

def SOLVEA():
	n = inin()
	a = inar()
	for i in range(1, n - 1):
		if a[i - 1] < a[i] > a[i + 1]:
			print('YES')
			print(i, i + 1, i + 2)
			break
	else:
		print('NO')

def SOLVEB():
	s = input()
	n = len(s)
	mc = max(s.count('P'), s.count('S'), s.count('R'))
	if s.count('R') == mc:
		print('P' * n)
	elif s.count('P') == mc:
		print('S' * n)
	else:
		print('R' * n)
Testcase = inin()
for _ in range(Testcase):
	SOLVEB()


import sys
import math
import collections
import heapq

def set_debug(debug_mode=False):
	if debug_mode:
		fin = open('input.txt', 'r')
		sys.stdin = fin

def int_input():
	return list(map(int, input().split()))
t = int(input())
for ti in range(1, t + 1):
	s = input()
	c = collections.Counter(s)
	m = max(c['R'], c['S'], c['P'])
	if m == c['R']:
		print('P' * len(s))
	elif m == c['S']:
		print('R' * len(s))
	else:
		print('S' * len(s))


import sys
input = sys.stdin.readline
from collections import Counter
for _ in range(int(input())):
	s = input().rstrip()
	c = Counter(s)
	v = c.most_common()
	if v[0][0] == 'R':
		print('P' * len(s))
	elif v[0][0] == 'S':
		print('R' * len(s))
	else:
		print('S' * len(s))


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def RL():
	return map(int, sys.stdin.readline().rstrip().split())

def RLL():
	return list(map(int, sys.stdin.readline().rstrip().split()))

def N():
	return int(input())

def comb(n, m):
	return factorial(n) / (factorial(m) * factorial(n - m)) if n >= m else 0

def perm(n, m):
	return factorial(n) // factorial(n - m) if n >= m else 0

def mdis(x1, y1, x2, y2):
	return abs(x1 - x2) + abs(y1 - y2)
mod = 998244353
INF = float('inf')
from math import factorial
from collections import Counter, defaultdict, deque
from heapq import heapify, heappop, heappush

def main():
	for _ in range(N()):
		s = input()
		le = len(s)
		a = b = c = 0
		for i in s:
			if i == 'R':
				a += 1
			if i == 'S':
				b += 1
			if i == 'P':
				c += 1
		ma = max(a, b, c)
		if ma == a:
			print('P' * le)
		elif ma == b:
			print('R' * le)
		elif ma == c:
			print('S' * le)
main()


import math, sys
from sys import stdin, stdout
from collections import Counter, defaultdict, deque
input = stdin.readline
I = lambda : int(input())
li = lambda : list(map(int, input().split()))

def solve():
	s = input().strip()
	a = []
	p = s.count('R')
	q = s.count('P')
	r = s.count('S')
	if p >= q and p >= r:
		print('P' * len(s))
	elif q >= p and q >= r:
		print('S' * len(s))
	else:
		print('R' * len(s))
for _ in range(I()):
	solve()


from collections import Counter
for _ in range(int(input())):
	s = input()
	cnt = Counter(s)
	win = {'R': 'P', 'S': 'R', 'P': 'S'}
	print(''.join((win[cnt.most_common(1)[0][0]] for _ in s)))


t = int(input())
for i in range(t):
	s = str(input())
	n = len(s)
	a = ''
	s1 = 0
	s2 = 0
	s3 = 0
	for j in range(n):
		if s[j] == 'R':
			s1 += 1
		elif s[j] == 'P':
			s2 += 1
		else:
			s3 += 1
	lis = [s1, s2, s3]
	lis.sort()
	if lis[-1] != lis[-2]:
		if s1 == lis[-1]:
			for j in range(n):
				a += 'P'
			print(a)
		elif s2 == lis[-1]:
			for j in range(n):
				a += 'S'
			print(a)
		else:
			for j in range(n):
				a += 'R'
			print(a)
	elif lis[-1] == lis[-2] and lis[-2] != lis[-3]:
		if s1 == lis[0]:
			for j in range(n):
				a += 'R'
			print(a)
		elif s2 == lis[0]:
			for j in range(n):
				a += 'P'
			print(a)
		else:
			for j in range(n):
				a += 'S'
			print(a)
	else:
		for j in range(n):
			a += 'P'
		print(a)


import math
t = int(input())
for w in range(t):
	s = input()
	n = len(s)
	l = [0] * 3
	for i in s:
		if i == 'R':
			l[0] += 1
		elif i == 'S':
			l[1] += 1
		else:
			l[2] += 1
	k = max(l)
	if k == l[0]:
		print('P' * n)
	elif k == l[1]:
		print('R' * n)
	else:
		print('S' * n)


for _ in range(int(input())):
	s = input()
	n = len(s)
	a = s.count('R')
	b = s.count('P')
	c = s.count('S')
	m = max(a, max(b, c))
	if m == a:
		print('P' * n)
	elif m == b:
		print('S' * n)
	else:
		print('R' * n)


t = int(input())
for i in range(t):
	s = input()
	R = 0
	P = 0
	S = 0
	n = len(s)
	for j in range(n):
		if s[j] == 'R':
			R += 1
		elif s[j] == 'S':
			S += 1
		else:
			P += 1
	m = max(R, S, P)
	if m == R:
		print(n * 'P')
	elif m == S:
		print(n * 'R')
	else:
		print(n * 'S')


from collections import *
t = 'RPSR'
for s in [*open(0)][1:]:
	print(t[t.find(Counter(s).most_common()[0][0]) + 1] * (len(s) - 1))


import sys
from collections import defaultdict as dd
from collections import deque
from fractions import Fraction as f
from copy import *
from bisect import *
from heapq import *
from math import *
from itertools import permutations

def eprint(*args):
	print(*args, file=sys.stderr)
zz = 1
if zz:
	input = sys.stdin.readline
else:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('all.txt', 'w')

def li():
	return [int(x) for x in input().split()]

def fli():
	return [float(x) for x in input().split()]

def comp(a, b):
	if a > b:
		return 2
	return 2 if a == b else 0

def gi():
	return [x for x in input().split()]

def fi():
	return int(input())

def swap(a, i, j):
	(a[i], a[j]) = (a[j], a[i])

def si():
	return list(input().rstrip())

def mi():
	return map(int, input().split())

def gh():
	sys.stdout.flush()

def graph(n, m):
	for i in range(m):
		(x, y) = mi()
		a[x].append(y)
		a[y].append(x)

def bo(i):
	return ord(i) - ord('a')
t = fi()
while t > 0:
	t -= 1
	s = si()
	n = len(s)
	r = s.count('R')
	p = s.count('P')
	ss = n - r - p
	if r >= ss and r >= p:
		print(n * 'P')
	elif p >= ss and p >= r:
		print(n * 'S')
	else:
		print(n * 'R')


import sys
input = sys.stdin.readline
from collections import Counter
result = {'R': 'P', 'P': 'S', 'S': 'R'}
n = int(input())
for _ in range(n):
	s = list(input().strip())
	cnt = Counter(s)
	most_common_char = cnt.most_common(1)[0][0]
	print(result[most_common_char] * len(s))


n = int(input())
for i in range(n):
	string = str(input())
	flag = 0
	r = 0
	s = 0
	p = 0
	for j in range(0, len(string)):
		if string[j] == 'R':
			r = r + 1
		elif string[j] == 'S':
			s = s + 1
		elif string[j] == 'P':
			p = p + 1
	m = 0
	if r >= s:
		if r >= p:
			for j in range(len(string)):
				print('P', end='')
			print()
		elif p >= s:
			for j in range(len(string)):
				print('S', end='')
			print()
		elif s >= p:
			for j in range(len(string)):
				print('R', end='')
			print()
		elif len(string) == 2:
			if s == 0:
				print('SS')
			elif r == 0:
				print('RR')
			elif p == 0:
				print('PP')
		else:
			print(string)
	elif s >= p:
		for j in range(len(string)):
			print('R', end='')
		print()
	elif p >= s:
		for j in range(len(string)):
			print('S', end='')
		print()
	elif len(string) == 2:
		if s == 0:
			print('SS')
		elif r == 0:
			print('RR')
		elif p == 0:
			print('PP')
	else:
		print(string)


from sys import *
input = stdin.readline
T = int(input())
for case in range(T):
	Combs = list(input().rstrip())
	L = len(Combs)
	(r, s, p) = (0, 0, 0)
	for i in Combs:
		if i == 'R':
			p += 1
		elif i == 'S':
			r += 1
		elif i == 'P':
			s += 1
	if p == max([r, s, p]):
		Ans = 'P' * L
	elif r == max([r, s, p]):
		Ans = 'R' * L
	elif s == max([r, s, p]):
		Ans = 'S' * L
	print(Ans)


from collections import Counter
d = {'S': 'R', 'P': 'S', 'R': 'P'}
for _ in range(int(input())):
	s = input()
	c = Counter(s).most_common(1)[0][0]
	print(d[c] * len(s))


cases = int(input())
for i in range(cases):
	s = input()
	rock = 'R'
	scis = 'S'
	pape = 'P'
	ans = ''
	r1 = s.count(rock)
	s1 = s.count(scis)
	p1 = s.count(pape)
	ma = max(r1, s1, p1)
	if ma == r1:
		ans += len(s) * 'P'
	elif ma == s1:
		ans += len(s) * 'R'
	elif ma == p1:
		ans += len(s) * 'S'
	print(ans)


for _ in range(int(input())):
	s = input()
	cntS = cntP = cntR = 0
	for x in s:
		if x == 'P':
			cntP += 1
		elif x == 'S':
			cntS += 1
		else:
			cntR += 1
	if cntR == max(cntR, cntS, cntP):
		print('P' * len(s))
	elif cntS == max(cntR, cntS, cntP):
		print('R' * len(s))
	elif cntP == max(cntR, cntS, cntP):
		print('S' * len(s))


import sys, bisect, string, math, time, functools, random, fractions
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
from itertools import permutations, combinations, groupby
rep = range

def Golf():
	(n, *t) = map(int, open(0).read().split())

def I():
	return int(input())

def S_():
	return input()

def IS():
	return input().split()

def LS():
	return [i for i in input().split()]

def MI():
	return map(int, input().split())

def LI():
	return [int(i) for i in input().split()]

def LI_():
	return [int(i) - 1 for i in input().split()]

def NI(n):
	return [int(input()) for i in range(n)]

def NI_(n):
	return [int(input()) - 1 for i in range(n)]

def StoLI():
	return [ord(i) - 97 for i in input()]

def ItoS(n):
	return chr(n + 97)

def LtoS(ls):
	return ''.join([chr(i + 97) for i in ls])

def RA():
	return map(int, open(0).read().split())

def GI(V, E, ls=None, Directed=False, index=1):
	org_inp = []
	g = [[] for i in R(V)]
	FromStdin = True if ls == None else False
	for i in R(E):
		if FromStdin:
			inp = LI()
			org_inp.append(inp)
		else:
			inp = ls[i]
		if len(inp) == 2:
			(a, b) = inp
			c = 1
		else:
			(a, b, c) = inp
		if index == 1:
			a -= 1
			b -= 1
		aa = (a, c)
		bb = (b, c)
		g[a].append(bb)
		if not Directed:
			g[b].append(aa)
	return (g, org_inp)

def GGI(h, w, search=None, replacement_of_found='.', mp_def={'#': 1, '.': 0}, boundary=1):
	mp = [boundary] * (w + 2)
	found = {}
	for i in R(h):
		s = input()
		for char in search:
			if char in s:
				found[char] = (i + 1) * (w + 2) + s.index(char) + 1
				mp_def[char] = mp_def[replacement_of_found]
		mp += [boundary] + [mp_def[j] for j in s] + [boundary]
	mp += [boundary] * (w + 2)
	return (h + 2, w + 2, mp, found)

def TI(n):
	return GI(n, n - 1)

def accum(ls):
	rt = [0]
	for i in ls:
		rt += [rt[-1] + i]
	return rt

def bit_combination(n, base=2):
	rt = []
	for tb in R(base ** n):
		s = [tb // base ** bt % base for bt in R(n)]
		rt += [s]
	return rt

def gcd(x, y):
	if y == 0:
		return x
	if x % y == 0:
		return y
	while x % y != 0:
		(x, y) = (y, x % y)
	return y

def YN(x):
	print(['NO', 'YES'][x])

def Yn(x):
	print(['No', 'Yes'][x])

def show(*inp, end='\n'):
	if show_flg:
		print(*inp, end=end)
mo = 10 ** 9 + 7
inf = float('inf')
FourNb = [(-1, 0), (1, 0), (0, 1), (0, -1)]
EightNb = [(-1, 0), (1, 0), (0, 1), (0, -1), (1, 1), (-1, -1), (1, -1), (-1, 1)]
compas = dict(zip('WENS', FourNb))
cursol = dict(zip('LRUD', FourNb))
l_alp = string.ascii_lowercase
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
input = lambda : sys.stdin.readline().rstrip()

class matrix:

	class MulShapeError(Exception):
		pass

	def __init__(self, arr_input):
		if hasattr(arr_input[0], '__getitem__'):
			self.arr = arr_input
		else:
			self.arr = [arr_input]
		self.shape = (len(self.arr), len(self.arr[0]))

	def __getitem__(self, key):
		return self.arr[key]

	def __setitem__(self, key, value):
		self.arr[key] = value

	def __iter__(self):
		return iter(self.arr)

	def __add__(self, B):
		if type(B) != matrix:
			return NotImplemented
		if B.shape != self.shape:
			return NotImplemented
		rt = [[0] * self.shape[1] for i in range(self.shape[0])]
		for i in range(self.shape[0]):
			for j in range(self.shape[1]):
				rt[i][j] = self.arr[i][j] + B.arr[i][j]
		return matrix(rt)

	def __iadd__(self, B):
		return self.__add__(B)

	def __sub__(self, B):
		if type(B) != matrix:
			return NotImplemented
		if B.shape != self.shape:
			return NotImplemented
		rt = [[0] * self.shape[1] for i in range(self.shape[0])]
		for i in range(self.shape[0]):
			for j in range(self.shape[1]):
				rt[i][j] = self.arr[i][j] - B.arr[i][j]
		return matrix(rt)

	def __isub__(self, B):
		return self.__sub__(B)

	def __mul__(self, M):
		if type(M) in [int, float, complex]:
			M = matrix([[M * (i == j) for j in range(self.shape[1])] for i in range(self.shape[1])])
		if type(M) != matrix:
			return NotImplemented
		if M.shape[0] != self.shape[1]:
			raise matrix.MulShapeError('mult is not applicable between the matrices of shape ' + str(self.shape) + ' and ' + str(M.shape))
		(ra, ca) = self.shape
		(rb, cb) = M.shape
		c = [[0] * cb for i in range(ra)]
		for i in range(ra):
			for j in range(cb):
				for k in range(ca):
					c[i][j] += self.arr[i][k] * M.arr[k][j]
		return matrix(c)

	def __imul__(self, M):
		return self.__mul__(M)

	def __rmul__(self, M):
		if type(M) in [int, float, complex]:
			M = matrix([[M * (i == j) for j in range(self.shape[1])] for i in range(self.shape[1])])
		if type(M) != matrix:
			return NotImplemented
		if M.shape[0] != self.shape[1]:
			raise matrix.MulShapeError('mult is not applicable between the matrix shape ' + str(self.shape) + ' and ' + str(M.shape))
		(ra, ca) = M.shape
		(rb, cb) = self.shape
		c = [[0] * cb for i in range(ra)]
		for i in range(ra):
			for j in range(cb):
				for k in range(ca):
					c[i][j] += M.arr[i][k] * self.arr[k][j]
		return matrix(c)

	def __mod__(self, p):
		if type(p) != int:
			return NotImplemented
		c = [[0] * self.shape[1] for i in range(self.shape[0])]
		for i in range(self.shape[0]):
			for j in range(self.shape[1]):
				c[i][j] = self.arr[i][j] % p
		return matrix(c)

	def __imod__(self, p):
		return self.__mod__(p)

	def __pow__(self, p, mod=10 ** 9 + 7):
		if type(p) != int or self.shape[0] != self.shape[1]:
			return NotImplemented
		A = matrix(self.arr)
		R = matrix([[1 * (i == j) for j in range(self.shape[0])] for i in range(self.shape[0])])
		while p > 0:
			if p & 1:
				R *= A
				R %= mod
			A *= A
			A %= mod
			p >>= 1
		return R

	def __neg__(self):
		return self.__mul__(-1)

	def __str__(self):
		rt = '['
		for i in self.arr:
			rt = rt + str(i) + ',\n'
		return rt[:-2] + ']'

	def T(self):
		rt = [[0] * self.shape[0] for i in range(self.shape[1])]
		for i in range(self.shape[0]):
			for j in range(self.shape[1]):
				rt[j][i] = self.arr[i][j]
		return matrix(rt)

	def resize(self, new_shape, fill=0):
		t_arr = []
		for i in self.arr:
			t_arr += i
		t_arr.reverse()
		(n, m) = new_shape
		self.shape = (n, m)
		self.arr = [[fill] * m for i in range(n)]
		for i in range(self.shape[0]):
			for j in range(self.shape[1]):
				if t_arr:
					self.arr[i][j] = t_arr.pop()
		return

	def view(self):
		for i in self.arr:
			print(i)
show_flg = False
show_flg = True
d = dict(zip('RSP', 'PRS'))
for _ in range(I()):
	s = input()
	x = 0
	y = -1
	for (i, j) in enumerate('RSP'):
		t = s.count(j)
		if t > y:
			x = i
			y = t
	print(d['RSP'[x]] * len(s))


import sys
import math

def II():
	return int(sys.stdin.readline())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def MI():
	return map(int, sys.stdin.readline().split())

def SI():
	return sys.stdin.readline().strip()
t = II()
for q in range(t):
	s = SI()
	ans = ''
	d = {'R': 'P', 'S': 'R', 'P': 'S'}
	m = 0
	if s.count('R') > m:
		m = s.count('R')
		ans = 'R'
	if s.count('S') > m:
		m = s.count('S')
		ans = 'S'
	if s.count('P') > m:
		ans = 'P'
	ans = d[ans]
	print(ans * len(s))


from collections import Counter
for _ in range(int(input())):
	inp = input()
	inps = Counter(inp)
	maxs = inps.most_common(1)[0][0]
	dcts = {'R': 'P', 'S': 'R', 'P': 'S'}
	answ = dcts[maxs] * len(inp)
	print(answ)


from collections import Counter
T = int(input())
for t in range(T):
	s = input()
	cc = Counter(s)
	fl = cc.most_common()[0][0]
	if fl == 'R':
		choice = 'P'
	elif fl == 'S':
		choice = 'R'
	else:
		choice = 'S'
	print(choice * len(s))


import sys
print = sys.stdout.write
dic = {'R': 'P', 'P': 'S', 'S': 'R'}
for _ in range(int(input())):
	s = input()
	a = max(['R', 'P', 'S'], key=s.count)
	print(dic[a] * len(s) + '\n')


from collections import Counter
t = int(input())
cnt = 0
while cnt < t:
	cnt += 1
	s = input()
	tot = len(s)
	s = Counter(s)
	a = s.most_common(1)
	if a[0][0] == 'R':
		print('P' * tot)
	elif a[0][0] == 'S':
		print('R' * tot)
	else:
		print('S' * tot)


import math
import os
import sys
input = lambda : sys.stdin.readline().strip('\r\n')

def cin():
	return sys.stdin.readline().strip('\r\n')

def fora():
	return list(map(int, sys.stdin.readline().strip().split()))

def string():
	return sys.stdin.readline().strip()

def cout(ans):
	sys.stdout.write(str(ans))

def endl():
	sys.stdout.write(str('\n'))

def ende():
	sys.stdout.write(str(' '))

def main():
	for _ in range(int(input())):
		s = string()
		mp = {}
		mp = dict.fromkeys(s, 0)
		maxt = 0
		for i in s:
			mp[i] += 1
			maxt = max(maxt, mp[i])
		for i in mp:
			if mp[i] == maxt:
				if i == 'P':
					p = 'S'
				elif i == 'R':
					p = 'P'
				else:
					p = 'R'
				for j in range(len(s)):
					cout(p)
				break
		endl()
main()


for _ in range(int(input())):
	s = input()
	dem1 = 0
	dem2 = 0
	dem3 = 0
	result = ''
	dem1 = s.count('R')
	dem2 = s.count('S')
	dem3 = s.count('P')
	m = max(dem1, dem2, dem3)
	if dem1 == m:
		ans = 'P'
	elif dem2 >= dem3 and dem2 >= dem1:
		ans = 'R'
	else:
		ans = 'S'
	print(ans * len(s))


t = int(input())
for _ in range(t):
	s = input()
	n = len(s)
	cnt_r = s.count('R')
	cnt_s = s.count('S')
	cnt_p = s.count('P')
	max_cnt = max(cnt_r, cnt_s, cnt_p)
	if max_cnt == cnt_r:
		print('P' * n)
	elif max_cnt == cnt_s:
		print('R' * n)
	else:
		print('S' * n)


import sys
INF = 10 ** 20
MOD = 10 ** 9 + 7
I = lambda : list(map(int, input().split()))
from math import gcd
from math import ceil
from collections import defaultdict as dd, Counter
from bisect import bisect_left as bl, bisect_right as br

def solve():
	s = input()
	n = len(s)
	r = {'R': 'P', 'S': 'R', 'P': 'S'}
	d = {}
	sm = 0
	for i in 'RSP':
		d[i] = s.count(i)
		sm += d[i]
	ok = {'R': 'SP', 'S': 'RP', 'P': 'RS'}
	for i in ok:
		if d[i] >= d[ok[i][0]] and d[i] >= d[ok[i][1]]:
			print(r[i] * n)
			return
	print(r[s[0]] * n)
(t,) = I()
while t:
	t -= 1
	solve()


def maximum(a, b, c):
	list = [a, b, c]
	return max(list)
n = int(input())
for i in range(0, n):
	s = str(input())
	a = list(s)
	countp = 0
	counts = 0
	countr = 0
	b = len(s)
	for j in range(b):
		if a[j] == 'R':
			countr += 1
		elif a[j] == 'P':
			countp += 1
		elif a[j] == 'S':
			counts += 1
	x = maximum(counts, countp, countr)
	if countp == x:
		for j in range(b):
			a[j] = 'S'
	if counts == x:
		for j in range(b):
			a[j] = 'R'
	if countr == x:
		for j in range(b):
			a[j] = 'P'
	z = ''.join(a)
	print(z)


import time, math as mt, bisect, sys
from sys import stdin, stdout
from collections import deque
from fractions import Fraction
from collections import Counter
from collections import OrderedDict
pi = 3.141592653589793

def II():
	return int(stdin.readline())

def IO():
	return stdin.readline()

def IP():
	return map(int, stdin.readline().split())

def L():
	return list(map(int, stdin.readline().split()))

def P(x):
	return stdout.write(str(x) + '\n')

def PI(x, y):
	return stdout.write(str(x) + ' ' + str(y) + '\n')

def lcm(a, b):
	return a * b // gcd(a, b)

def gcd(a, b):
	if a == 0:
		return b
	elif b == 0:
		return a
	if a > b:
		return gcd(a % b, b)
	else:
		return gcd(a, b % a)

def readTree():
	v = int(input())
	adj = [set() for i in range(v + 1)]
	for i in range(v - 1):
		(u1, u2) = In()
		adj[u1].add(u2)
		adj[u2].add(u1)
	return (adj, v)

def bfs(adj, v):
	visited = [False] * (v + 1)
	q = deque()
	while q:
		pass

def sieve():
	li = [True] * 1000001
	(li[0], li[1]) = (False, False)
	for i in range(2, len(li), 1):
		if li[i] == True:
			for j in range(i * i, len(li), i):
				li[j] = False
	prime = []
	for i in range(1000001):
		if li[i] == True:
			prime.append(i)
	return prime

def setBit(n):
	count = 0
	while n != 0:
		n = n & n - 1
		count += 1
	return count
mx = 10 ** 7
spf = [mx] * (mx + 1)

def SPF():
	spf[1] = 1
	for i in range(2, mx + 1):
		if spf[i] == mx:
			spf[i] = i
			for j in range(i * i, mx + 1, i):
				if i < spf[j]:
					spf[j] = i
	return
mod = 10 ** 9 + 7

def solve():
	s = input()
	d = {}
	for ele in s:
		d[ele] = d.get(ele, 0) + 1
	d = sorted(d.items(), key=lambda x: x[1], reverse=True)
	f = {'R': 'P', 'S': 'R', 'P': 'S'}
	new = f[d[0][0]] * len(s)
	P(new)
t = II()
for i in range(t):
	solve()


import os
import sys
import math
from io import BytesIO, IOBase
from fractions import Fraction
from collections import defaultdict
from itertools import permutations
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
for t in range(int(input())):
	s = input()
	rock = s.count('R')
	paper = s.count('P')
	scissor = s.count('S')
	mx = max(rock, paper, scissor)
	if mx == rock:
		print('P' * len(s), sep='')
	elif mx == paper:
		print('S' * len(s), sep='')
	else:
		print('R' * len(s), sep='')


for ty in range(int(input())):
	s = list(input())
	p = 0
	r = 0
	o = 0
	for i in range(len(s)):
		if s[i] == 'R':
			s[i] = 'P'
			p += 1
		elif s[i] == 'S':
			s[i] = 'R'
			r += 1
		else:
			s[i] = 'S'
			o += 1
	if max(p, o, r) == p:
		print('P' * len(s))
	elif max(p, o, r) == o:
		print('S' * len(s))
	else:
		print('R' * len(s))


def main():
	from sys import stdin, stdout
	for _ in range(int(stdin.readline())):
		inp = stdin.readline().strip()
		counter = {}
		for i in inp:
			if i not in counter:
				counter[i] = 1
			else:
				counter[i] += 1
		maxim = -1000000000.0
		maxletter = None
		for i in counter:
			if counter[i] > maxim:
				maxim = counter[i]
				maxletter = i
		ans = 'R' if maxletter == 'S' else 'S' if maxletter == 'P' else 'P'
		ans = ans * len(inp)
		stdout.write(ans + '\n')
main()


t = int(input())
for i in range(t):
	S = input()
	l = len(S)
	r = S.count('R')
	s = S.count('S')
	p = S.count('P')
	m = max(r, s, p)
	if m == r:
		print('P' * l)
	elif m == s:
		print('R' * l)
	else:
		print('S' * l)


numberOfTc = int(input())
for ctr in range(1, numberOfTc + 1):
	a = input().strip()
	rCount = a.count('R')
	sCount = a.count('S')
	pCount = a.count('P')
	f = [rCount, sCount, pCount]
	k = ['P', 'R', 'S']
	ind = k[f.index(max(f))]
	print(ind * len(a))


for _ in range(int(input())):
	s = input()
	cr = s.count('R')
	cp = s.count('P')
	cs = s.count('S')
	if cr >= cp and cr >= cs:
		print('P' * len(s))
	elif cp >= cr and cp >= cs:
		print('S' * len(s))
	else:
		print('R' * len(s))


t = int(input())
beating = {'R': 'P', 'P': 'S', 'S': 'R'}
for _ in range(t):
	s = input()
	counts = [s.count('R'), s.count('P'), s.count('S')]
	if counts[0] == max(counts):
		print(beating['R'] * len(s))
	elif counts[1] == max(counts):
		print(beating['P'] * len(s))
	else:
		print(beating['S'] * len(s))


t = int(input())
for _t in range(t):
	s = input()
	h = ['R', 'P', 'S']
	h2 = ['R', 'P', 'S', 'R']
	m = 0
	sol = ''
	for k in range(len(h)):
		if s.count(h[k]) > m:
			m = s.count(h[k])
			sol = h2[k + 1]
	for i in range(len(s)):
		print(sol, end='')
	print('')


t = int(input())
for k in range(t):
	a = input()
	(r, s, p) = (a.count('R'), a.count('S'), a.count('P'))
	now = max(r, s, p)
	if r == now:
		ans = ''.join(['P' for i in range(len(a))])
	elif s == now:
		ans = ''.join(['R' for i in range(len(a))])
	else:
		ans = ''.join(['S' for i in range(len(a))])
	print(ans)


from sys import stdin, stdout

def universal_solution(s):
	n = len(s)
	R = P = S = 0
	for c in s:
		if c == 'R':
			R += 1
		elif c == 'P':
			P += 1
		else:
			S += 1
	if R >= P and R >= S:
		return ['P'] * n
	elif P >= R and P >= S:
		return ['S'] * n
	else:
		return ['R'] * n
t = int(stdin.readline())
for i in range(t):
	s = stdin.readline().strip()
	res = universal_solution(s)
	stdout.write(''.join(res) + '\n')


t = int(input())
while t != 0:
	t -= 1
	string = input()
	r = 0
	p = 0
	s = 0
	for x in string:
		if x == 'R':
			r += 1
		elif x == 'P':
			p += 1
		else:
			s += 1
	if r == max([r, p, s]):
		print('P' * len(string))
	elif p == max([r, p, s]):
		print('S' * len(string))
	else:
		print('R' * len(string))


import sys
input = sys.stdin.readline
from collections import Counter
t = int(input())
for tests in range(t):
	S = input().strip()
	C2 = Counter(S)
	C = C2.most_common()
	if C[0][0] == 'S':
		print('R' * len(S))
	elif C[0][0] == 'R':
		print('P' * len(S))
	else:
		print('S' * len(S))


from collections import defaultdict as dc
import sys
import math
mod = 10 ** 9 + 7

def sinp():
	p = str(sys.stdin.readline())
	return p

def seive(n):
	p = [0] * (n + 1)
	for i in range(2, n):
		for j in range(2 * i, n + 1, i):
			p[i] = 1
	return p

def inp():
	p = int(sys.stdin.readline())
	return p

def line():
	p = list(map(int, sys.stdin.readline().split()))
	return p

def read_mat():
	n = inp()
	a = []
	for i in range(n):
		a.append(line())
	return a

def ind(a):
	return ord(a) - ord('A')

def digit(n):
	p = [int(i) for i in str(n)]
	return p

def check(s, k):
	for i in range(7):
		if s[i] != '?' and s[i] != k[i]:
			return 0
	return 1

def find_max(s, q, p):
	c = 0
	for i in range(len(s)):
		if p[s[i]] == q[i]:
			c += 1
	return c
t = inp()
for i in range(t):
	s = str(input())
	p = {'R': 'P', 'P': 'S', 'S': 'R'}
	c1 = s.count('R')
	c2 = s.count('P')
	c3 = s.count('S')
	n = len(s)
	z = max(c1, max(c2, c3))
	if z == c1:
		ans = p['R'] * n
		print(ans)
	elif z == c2:
		ans = p['P'] * n
		print(ans)
	else:
		ans = p['S'] * n
		print(ans)


import bisect as bi
import math as mt
import collections as cc
I = lambda : list(map(int, input().split()))
for tc in range(int(input())):
	s = input()
	f = {}
	f['S'] = 'R'
	f['R'] = 'P'
	f['P'] = 'S'
	ff = cc.Counter(s)
	x = max(ff, key=ff.get)
	print(f[x] * len(s))


ans = []
for _ in range(int(input())):
	s = list(input())
	n = len(s)
	cnt = [0] * 3
	for i in range(n):
		if s[i] == 'R':
			cnt[0] += 1
		elif s[i] == 'P':
			cnt[1] += 1
		else:
			cnt[2] += 1
	if cnt[0] == max(cnt):
		ansi = 'P' * n
	elif cnt[1] == max(cnt):
		ansi = 'S' * n
	else:
		ansi = 'R' * n
	ans.append(ansi)
print('\n'.join(ans))


from sys import stdin, stdout
t = int(stdin.readline().strip())
for _ in range(t):
	s = stdin.readline().strip()
	(R, S, P) = (0, 0, 0)
	for c in s:
		if c == 'R':
			R += 1
		elif c == 'S':
			S += 1
		else:
			P += 1
	m = max(R, S, P)
	if m == R:
		a = 'P'
	elif m == S:
		a = 'R'
	else:
		a = 'S'
	stdout.write(a * len(s) + '\n')


import sys
input = sys.stdin.readline

def int_array():
	return list(map(int, input().strip().split()))

def str_array():
	return input().strip().split()

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)
for _ in range(int(input())):
	arr = list(input())
	n = len(arr)
	(r, p, s) = (arr.count('R'), arr.count('P'), arr.count('S'))
	maxi = max(r, p, s)
	if r == maxi:
		print('P' * (n - 1))
	elif p == maxi:
		print('S' * (n - 1))
	else:
		print('R' * (n - 1))


t = int(input())
for i in range(t):
	s = input()
	s.upper()
	rcnt = 0
	pcnt = 0
	scnt = 0
	for x in s:
		if x == 'R':
			rcnt += 1
		elif x == 'P':
			pcnt += 1
		elif x == 'S':
			scnt += 1
	if rcnt >= scnt and rcnt >= pcnt:
		print('P' * len(s))
	elif scnt >= rcnt and scnt >= pcnt:
		print('R' * len(s))
	elif pcnt >= rcnt and pcnt >= scnt:
		print('S' * len(s))


t = int(input())
for _ in range(t):
	bot_string_as_list = list(input())
	count_r = bot_string_as_list.count('R')
	count_s = bot_string_as_list.count('S')
	count_p = bot_string_as_list.count('P')
	max_count = max(count_r, count_s, count_p)
	if max_count == count_r:
		print('P' * len(bot_string_as_list))
	elif max_count == count_s:
		print('R' * len(bot_string_as_list))
	elif max_count == count_p:
		print('S' * len(bot_string_as_list))


t = int(input())
for _ in range(t):
	(rock, paper, scissors) = (0, 0, 0)
	line = input()
	for i in line:
		if i == 'R':
			rock += 1
		elif i == 'P':
			paper += 1
		else:
			scissors += 1
	n = len(line)
	if rock >= paper and rock >= scissors:
		print(n * 'P')
	elif paper >= rock and paper >= scissors:
		print(n * 'S')
	else:
		print(n * 'R')


from collections import Counter

def solve():
	s = list(input())
	cs = Counter(s)
	win = {'R': 'P', 'P': 'S', 'S': 'R'}
	tmp = 0
	hand = 'R'
	for h in cs:
		if cs[h] > tmp:
			hand = h
			tmp = cs[h]
	print(win[hand] * len(s))
t = int(input())
for _ in range(t):
	solve()


t = int(input())
for _ in range(t):
	s = input()
	p = s.count('P')
	ss = s.count('S')
	r = s.count('R')
	if max(r, ss, p) == r:
		print('P' * len(s))
	elif max(r, ss, p) == ss:
		print('R' * len(s))
	elif max(r, ss, p) == p:
		print('S' * len(s))


from bisect import bisect_left as bl
from bisect import bisect_right as br
from heapq import heappush, heappop
import math
from collections import *
from functools import reduce, cmp_to_key, lru_cache
import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
M = mod = 10 ** 9 + 7

def factors(n):
	return sorted(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0))))

def inv_mod(n):
	return pow(n, mod - 2, mod)

def li():
	return [int(i) for i in input().rstrip().split()]

def st():
	return str(input().rstrip())[2:-1]

def val():
	return int(input().rstrip())

def li2():
	return [str(i)[2:-1] for i in input().rstrip().split()]

def li3():
	return [int(i) for i in st()]
for _ in range(val()):
	s = st()
	cnt = Counter(s)
	l = sorted(cnt, key=lambda x: -cnt[x])
	if l[0] == 'R':
		ans = 'P'
	elif l[0] == 'S':
		ans = 'R'
	else:
		ans = 'S'
	print(ans * len(s))


t = int(input())
for _ in range(t):
	st = input()
	(r, p, s) = (0, 0, 0)
	for c in st:
		if c == 'R':
			r += 1
		if c == 'P':
			p += 1
		if c == 'S':
			s += 1
	if r == max([r, p, s]):
		print('P' * len(st))
	elif p == max([r, p, s]):
		print('S' * len(st))
	else:
		print('R' * len(st))


import collections
t = int(input())
for i in range(t):
	s = input()
	dc = {'R': 'P', 'P': 'S', 'S': 'R'}
	res = ''
	d = collections.defaultdict(int)
	for i in s:
		d[i] += 1
	maxv = 0
	maxc = ''
	for (k, v) in d.items():
		if v > maxv:
			maxv = v
			maxc = k
	ans = dc[maxc]
	res += ans * len(s)
	print(res)


import sys

def rs():
	return sys.stdin.readline().rstrip()

def ri():
	return int(sys.stdin.readline())

def ria():
	return list(map(int, sys.stdin.readline().split()))

def ws(s):
	sys.stdout.write(s)
	sys.stdout.write('\n')

def wi(n):
	sys.stdout.write(str(n))
	sys.stdout.write('\n')

def wia(a, sep=' '):
	sys.stdout.write(sep.join([str(x) for x in a]))
	sys.stdout.write('\n')
from collections import Counter

def solve(s):
	c = Counter(s)
	mx = max(c.values())
	for (k, v) in c.items():
		if mx == v:
			if k == 'R':
				ws('P' * len(s))
			if k == 'S':
				ws('R' * len(s))
			if k == 'P':
				ws('S' * len(s))
			return

def main():
	for _ in range(ri()):
		s = rs()
		solve(s)
main()


def counter(s):
	if s == 'R':
		return 'P'
	elif s == 'P':
		return 'S'
	elif s == 'S':
		return 'R'
for t in range(int(input())):
	bot = input()
	n = len(bot)
	if len(set(bot)) == 1:
		print(counter(bot[0]) * n)
	else:
		d = {}
		l = ['R', 'P', 'S']
		for i in l:
			d[i] = bot.count(i)
		k = max(d, key=d.get)
		s = counter(k)
		print(s * n)


TC = int(input())
for tc in range(TC):
	S = input()
	P = 'RSP'
	r = 0
	s = 0
	p = 0
	for l in S:
		if l == 'R':
			r += 1
		elif l == 'S':
			s += 1
		else:
			p += 1
	maxi = max(r, p, s)
	if maxi == r:
		result = 'P' * len(S)
	elif maxi == p:
		result = 'S' * len(S)
	elif maxi == s:
		result = 'R' * len(S)
	else:
		result = 'NR'
	print(''.join(result))


for _ in range(int(input())):
	t = input()
	(r, s, p) = (t.count('R'), t.count('S'), t.count('P'))
	b = max(r, s, p)
	a = 'P' if r == b else 'R' if s == b else 'S'
	print(a * len(t))


from collections import Counter

def fast(S):
	n = len(S)
	ctr = Counter(S)
	c = ctr.most_common(1)[0][0]
	if c == 'R':
		return 'P' * n
	elif c == 'P':
		return 'S' * n
	else:
		return 'R' * n

def main():
	t = int(input())
	for _ in range(t):
		S = input()
		result = fast(S)
		print(result)
main()


for _ in range(int(input())):
	s = input()
	n = len(s)
	rct = s.count('R')
	pct = s.count('P')
	sct = s.count('S')
	mx = max(rct, pct, sct)
	if rct == mx:
		print('P' * n)
	elif pct == mx:
		print('S' * n)
	else:
		print('R' * n)


import sys
import math
from math import factorial, inf, gcd
from heapq import *
from functools import *
from itertools import *
from collections import *
from typing import *
sys.setrecursionlimit(10 ** 5)
t = int(input())
for ii in range(t):
	s = input()
	c = Counter(s)
	a = list(c.keys())[0]
	for (i, j) in c.items():
		if j > c[a]:
			a = i
	ans = 'P' if a == 'R' else 'R' if a == 'S' else 'S'
	print(ans * len(s))


for _ in range(int(input())):
	s = input()
	d = {'R': 'P', 'P': 'S', 'S': 'R'}
	ans = ''
	count = {}
	for i in s:
		count[i] = count.get(i, 0) + 1
	maxChar = -1
	charac = ''
	for char in count.keys():
		if count[char] > maxChar:
			maxChar = count[char]
			charac = char
	print(d[charac] * len(s))


import sys
input = sys.stdin.readline

def ceil(x):
	if x != int(x):
		x = int(x) + 1
	return x

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def nCr(n, k):
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res)

def upper_bound(a, x, lo=0, hi=None):
	if hi == None:
		hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if a[mid] < x:
			lo = mid + 1
		else:
			hi = mid
	return lo

def primefs(n):
	primes = {}
	while n % 2 == 0 and n > 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0 and n > 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime
MAXN = int(100000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def factoriazation(x):
	ret = {}
	while x != 1:
		ret[spf[x]] = ret.get(spf[x], 0) + 1
		x = x // spf[x]
	return ret

def int_array():
	return list(map(int, input().strip().split()))

def str_array():
	return input().strip().split()
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
for _ in range(int(input())):
	s = input().strip()
	n = len(s)
	(x, y, z) = (s.count('R'), s.count('S'), s.count('P'))
	k = max(x, y, z)
	if x == k:
		ans = ['P' for _ in range(n)]
	elif y == k:
		ans = ['R' for _ in range(n)]
	elif z == k:
		ans = ['S' for _ in range(n)]
	print(''.join(ans))


for _ in range(int(input())):
	s1 = input()
	n = len(s1)
	d = {'R': 'P', 'S': 'R', 'P': 'S'}
	(r, s, p) = (s1.count('R'), s1.count('S'), s1.count('P'))
	if r >= s and r >= p:
		res = d['R'] * n
	elif s >= r and s >= p:
		res = d['S'] * n
	elif p >= r and p >= s:
		res = d['P'] * n
	print(res)


for i in range(int(input())):
	a = input()
	(x, y, z) = (a.count('R'), a.count('P'), a.count('S'))
	if max(z, y, x) == x:
		print('P' * len(a))
	elif max(z, y, x) == z:
		print('R' * len(a))
	elif max(z, y, x) == y:
		print('S' * len(a))


import math
for _ in range(int(input())):
	st = input()
	p = 0
	r = 0
	s = 0
	for i in st:
		if i == 'R':
			r += 1
		elif i == 'P':
			p += 1
		else:
			s += 1
	m = max(r, s, p)
	c = ''
	if m == r:
		c = 'P'
	elif m == s:
		c = 'R'
	else:
		c = 'S'
	print(c * len(st))


t = int(input())
for _ in range(t):
	a = input()
	r = a.count('R')
	p = a.count('P')
	s = a.count('S')
	if r >= p and r >= s:
		print('P' * len(a))
	elif p >= r and p >= s:
		print('S' * len(a))
	elif s >= p and s >= r:
		print('R' * len(a))


t = int(input())
l = 'RSP'
r = 'PRS'

def solve():
	s = input()
	cnt = [0] * 3
	for c in s:
		for j in range(3):
			if l[j] == c:
				cnt[j] += 1
	print(r[cnt.index(max(cnt))] * len(s))
for test in range(t):
	solve()


from sys import stdin

def inp():
	return stdin.buffer.readline().rstrip().decode('utf8')

def itg():
	return int(stdin.buffer.readline())

def mpint():
	return map(int, stdin.buffer.readline().split())
from collections import Counter
for case in range(itg()):
	s = inp()
	most = Counter(s).most_common(1)[0][0]
	if most == 'R':
		print('P' * len(s))
	elif most == 'P':
		print('S' * len(s))
	elif most == 'S':
		print('R' * len(s))


for _ in range(int(input())):
	str1 = input()
	list1 = list(str1)
	countR = 0
	countP = 0
	countS = 0
	for i in range(len(list1)):
		if list1[i] == 'R':
			countR += 1
		elif list1[i] == 'P':
			countP += 1
		elif list1[i] == 'S':
			countS += 1
	newList = [countR, countP, countS]
	index = newList.index(max(newList))
	if index == 0:
		print('P' * len(list1))
	elif index == 1:
		print('S' * len(list1))
	elif index == 2:
		print('R' * len(list1))


t = int(input())
for hatt in range(t):
	s = input()
	(nr, np, ns) = (0, 0, 0)
	for i in s:
		if i == 'R':
			nr += 1
		elif i == 'S':
			ns += 1
		else:
			np += 1
	m = max(nr, np, ns)
	if m == nr:
		c = 'P'
	elif m == ns:
		c = 'R'
	else:
		c = 'S'
	print(c * len(s))


from collections import Counter
for cn in range(1, int(input()) + 1):
	s = input()
	c = Counter(s)
	cr = c['R']
	cp = c['P']
	cs = c['S']
	if cr >= max(cp, cs):
		ans = 'P'
	elif cp >= max(cr, cs):
		ans = 'S'
	else:
		ans = 'R'
	print(''.join([ans] * len(s)))


for i in range(int(input())):
	di = dict()
	n = input()
	for i in n:
		di[i] = di.get(i, 0) + 1
	b = max(di.values())
	if len(di) == 1:
		for (i, j) in di.items():
			if i == 'R':
				x = ['P'] * j
				print(*x, sep='')
			elif i == 'S':
				x = ['R'] * j
				print(*x, sep='')
			elif i == 'P':
				x = ['S'] * j
				print(*x, sep='')
	else:
		for (i, j) in di.items():
			if j == b:
				if i == 'R':
					x = ['P'] * len(n)
					print(*x, sep='')
					break
				elif i == 'S':
					x = ['R'] * len(n)
					print(*x, sep='')
					break
				elif i == 'P':
					x = ['S'] * len(n)
					print(*x, sep='')
					break
			else:
				continue


t = int(input())
for i in range(t):
	s = list(input())
	a = s.count('R')
	b = s.count('P')
	c = s.count('S')
	if a >= b and a >= c:
		print('P' * len(s))
	elif b >= a and b >= c:
		print('S' * len(s))
	else:
		print('R' * len(s))


def get_beating(x):
	if x == 'R':
		return 'P'
	elif x == 'P':
		return 'S'
	else:
		return 'R'
for _ in range(int(input())):
	play = input()
	output = ''
	R = play.count('R')
	S = play.count('S')
	P = play.count('P')
	if R >= S and R >= P:
		print(len(play) * get_beating('R'))
	elif S >= R and S >= P:
		print(len(play) * get_beating('S'))
	else:
		print(len(play) * get_beating('P'))


t = int(input())
for test in range(t):
	s = input()
	first = s.count('R')
	second = s.count('P')
	third = len(s) - first - second
	if first >= second and first >= third:
		print('P' * len(s))
	elif second >= first and second >= third:
		print('S' * len(s))
	else:
		print('R' * len(s))


for _ in range(int(input())):
	l = list(input())
	r = l.count('R')
	s = l.count('S')
	p = l.count('P')
	m = max(r, s, p)
	if r == m:
		for i in range(len(l)):
			print('P', end='')
		print()
	elif s == m:
		for i in range(len(l)):
			print('R', end='')
		print()
	else:
		for i in range(len(l)):
			print('S', end='')
		print()


t = int(input())
for i in range(t):
	a = input()
	n = len(a)
	k1 = 0
	k2 = 0
	k3 = 0
	for i in range(n):
		if a[i] == 'R':
			k1 += 1
		elif a[i] == 'P':
			k2 += 1
		else:
			k3 += 1
	if k1 >= k2 and k1 >= k3:
		print('P' * n)
	elif k2 >= k3 and k2 >= k1:
		print('S' * n)
	else:
		print('R' * n)


t = int(input())
for i in range(0, t):
	string = input()
	(R, P, S) = (string.count('R'), string.count('P'), string.count('S'))
	if max(R, S, P) == R:
		print('P' * len(string))
	elif max(R, S, P) == P:
		print('S' * len(string))
	else:
		print('R' * len(string))


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush, nsmallest
from math import ceil, floor, gcd, fabs, factorial, fmod, sqrt, inf
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
from decimal import Decimal
mod = pow(10, 9) + 7
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(var):
	sys.stdout.write(str(var) + '\n')

def outa(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def l():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
for _ in range(int(data())):
	s = data()
	n = len(s)
	c = C(s)
	(m, char) = (-1, 'x')
	for i in c.keys():
		if c[i] > m:
			char = i
			m = c[i]
	if char == 'R':
		out('P' * n)
		continue
	if char == 'P':
		out('S' * n)
		continue
	out('R' * n)


def solve(s1):
	sign = [0, 0, 0]
	for c in s1:
		if c == 'R':
			sign[0] += 1
		elif c == 'S':
			sign[1] += 1
		elif c == 'P':
			sign[2] += 1
	highest_count = sign.index(max(sign))
	ret = None
	if highest_count == 0:
		ret = 'P'
	elif highest_count == 1:
		ret = 'R'
	else:
		ret = 'S'
	for i in range(len(s1)):
		print(ret, end='')
	print()
	return
T = int(input())
for t in range(T):
	s = input()
	solve(s)


T = int(input())
for case in range(T):
	value = input()
	count = [0, 0, 0]
	for v in value:
		if v == 'R':
			count[0] += 1
		elif v == 'S':
			count[1] += 1
		elif v == 'P':
			count[2] += 1
	if count[0] >= count[1] and count[0] >= count[2]:
		print('P' * len(value))
	elif count[1] >= count[0] and count[1] >= count[2]:
		print('R' * len(value))
	else:
		print('S' * len(value))


for _ in range(int(input())):
	s = input()
	n = len(s)
	r = s.count('R')
	p = s.count('P')
	si = s.count('S')
	m = max(r, p, si)
	if r == m:
		print('P' * n)
	elif p == m:
		print('S' * n)
	else:
		print('R' * n)


n = int(input())
for _ in range(n):
	a = input()
	r = a.count('R')
	s = a.count('S')
	p = a.count('P')
	n = max(r, s, p)
	if n == r:
		k = 'P'
	elif n == s:
		k = 'R'
	elif n == p:
		k = 'S'
	answer = ''
	for i in range(len(a)):
		answer += k
	print(answer)


from collections import Counter
opp = {'S': 'R', 'R': 'P', 'P': 'S'}
for i in range(int(input())):
	s = input()
	d = Counter(s)
	print(opp[d.most_common(1)[0][0]] * len(s))


def solve(t):
	r = t.count('R')
	s = t.count('S')
	p = t.count('P')
	if r >= max(s, p):
		return 'P' * len(t)
	elif s >= max(r, p):
		return 'R' * len(t)
	else:
		return 'S' * len(t)
T = int(input())
for _ in range(T):
	print(solve(input()))


t = int(input())
for _ in range(t):
	s = input()
	(R, S, P) = (0, 0, 0)
	for i in s:
		if i == 'R':
			R += 1
		elif i == 'S':
			S += 1
		elif i == 'P':
			P += 1
	mV = max(R, S, P)
	if R == mV:
		print('P' * len(s))
	elif S == mV:
		print('R' * len(s))
	else:
		print('S' * len(s))


import collections
t = int(input())
for _ in range(t):
	s = input()
	ans = {'S': 'R', 'P': 'S', 'R': 'P'}
	freq = collections.Counter(s).most_common(1)[0][0]
	print(ans[freq] * len(s))


T = int(input())
moves = {'R': 'P', 'P': 'S', 'S': 'R'}
for _ in range(T):
	m = input()
	ans = ''
	r_count = m.count('R')
	p_count = m.count('P')
	s_count = m.count('S')
	ls = [r_count, p_count, s_count]
	mx = ls.index(max(ls))
	if mx == 0:
		ans += 'P' * len(m)
	if mx == 1:
		ans += 'S' * len(m)
	if mx == 2:
		ans += 'R' * len(m)
	print(ans)


for t in range(int(input())):
	s = input()
	a = ''
	j = 0
	num = [0, 0, 0]
	for i in range(len(s)):
		if s[i] == 'R':
			num[2] += 1
			if num[2] > num[j]:
				j = 2
				a = 'P'
		elif s[i] == 'S':
			if num[0] + 1 > num[j]:
				j = 0
				a = 'R'
			num[0] += 1
		elif s[i] == 'P':
			num[1] += 1
			if num[1] > num[j]:
				j = 1
				a = 'S'
	print(a * len(s))


from collections import Counter
d = {'R': 'P', 'P': 'S', 'S': 'R'}
n = int(input().strip())
for i in range(n):
	s = input().strip()
	count = dict(Counter(list(s)))
	c = max(count, key=lambda x: count[x])
	print(d[c] * len(s))


import bisect
import sys
import math
input = sys.stdin.readline
import functools
from collections import Counter
from collections import defaultdict

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def solve(case):
	s = input().rstrip()
	n = len(s)
	c = Counter(s)
	v = c.most_common(1)[0][0]
	if v == 'R':
		return 'P' * n
	elif v == 'S':
		return 'R' * n
	elif v == 'P':
		return 'S' * n
if len(sys.argv) > 1 and sys.argv[1].startswith('input'):
	f = open('./' + sys.argv[1], 'r')
	input = f.readline
T = inp()
for i in range(T):
	res = solve(i + 1)
	print(str(res))


for _ in range(int(input())):
	s = input()
	i = max(s.count('R'), max(s.count('S'), s.count('P')))
	if i == s.count('R'):
		print('P' * len(s))
	elif i == s.count('P'):
		print('S' * len(s))
	else:
		print('R' * len(s))


t = int(input())
while t:
	t -= 1
	s = input()
	rock = s.count('R')
	paper = s.count('P')
	scissors = s.count('S')
	m = max(rock, paper, scissors)
	if m == rock:
		print('P' * len(s))
	elif m == paper:
		print('S' * len(s))
	else:
		print('R' * len(s))


t = int(input())
for _ in range(t):
	sa = input()
	(r, p, s) = (0, 0, 0)
	for a in range(len(sa)):
		if sa[a] == 'R':
			r += 1
		elif sa[a] == 'P':
			p += 1
		else:
			s += 1
	if max(r, p, s) == r:
		print('P' * len(sa))
	elif max(r, p, s) == p:
		print('S' * len(sa))
	else:
		print('R' * len(sa))


t = int(input())
while t > 0:
	t -= 1
	a = input()
	a = list(a)
	l = len(a)
	r = 0
	s = 0
	p = 0
	ans = ''
	for i in a:
		if i == 'R':
			r += 1
		if i == 'S':
			s += 1
		if i == 'P':
			p += 1
	m = max(r, s, p)
	if m == r:
		i = 0
		while i < l:
			ans += 'P'
			i += 1
		print(ans)
		continue
	if m == s:
		i = 0
		while i < l:
			ans += 'R'
			i += 1
		print(ans)
		continue
	if m == p:
		i = 0
		while i < l:
			ans += 'S'
			i += 1
		print(ans)
		continue


import sys
input = sys.stdin.readline
t = int(input())
for ii in range(t):
	st = input()
	ans = ''
	r = st.count('S')
	s = st.count('P')
	p = st.count('R')
	l = [[r, 1], [s, 2], [p, 3]]
	l.sort()
	if l[-1][1] == 3:
		ans += 'P' * (len(st) - 1)
	if l[-1][1] == 2:
		ans += 'S' * (len(st) - 1)
	if l[-1][1] == 1:
		ans += 'R' * (len(st) - 1)
	print(ans)


def ans(z):
	(r, p, s) = (z.count('R'), z.count('P'), z.count('S'))
	if r >= max(p, s):
		return 'P' * len(z)
	if p >= max(r, s):
		return 'S' * len(z)
	if s >= max(p, r):
		return 'R' * len(z)
for i in range(int(input())):
	print(ans(input()))


from sys import stdin
t = int(stdin.readline())
for _ in range(t):
	ip = stdin.readline().rstrip()
	n = len(ip)
	r = ip.count('R')
	p = ip.count('P')
	s = ip.count('S')
	maxC = max(r, p, s)
	if r == maxC:
		print('P' * n)
	elif p == maxC:
		print('S' * n)
	else:
		print('R' * n)


import sys

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c] * b for i in range(a)]

def list3d(a, b, c, d):
	return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 19
MOD = 10 ** 9 + 7
for _ in range(INT()):
	S = input()
	N = len(S)
	rcnt = S.count('R')
	scnt = S.count('S')
	pcnt = S.count('P')
	mx = max(rcnt, scnt, pcnt)
	if mx == rcnt:
		ans = 'P' * N
	elif mx == scnt:
		ans = 'R' * N
	else:
		ans = 'S' * N
	print(ans)


t = int(input())
for _ in range(t):
	s = input()
	rcount = 0
	pcount = 0
	scount = 0
	for i in range(len(s)):
		if s[i] == 'R':
			rcount += 1
		if s[i] == 'S':
			scount += 1
		if s[i] == 'P':
			pcount += 1
	ans = []
	if rcount >= pcount and rcount >= scount:
		for i in range(len(s)):
			ans.append('P')
	elif scount >= pcount and scount >= rcount:
		for i in range(len(s)):
			ans.append('R')
	else:
		for i in range(len(s)):
			ans.append('S')
	print(''.join(ans))


t = int(input())
for i in range(t):
	s = input()
	numr = s.count('R')
	nums = s.count('S')
	nump = s.count('P')
	if numr >= nums:
		if numr >= nump:
			print('P' * len(s))
		else:
			print('S' * len(s))
	elif nums >= nump:
		print('R' * len(s))
	else:
		print('S' * len(s))


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
testcases = int(input())
for j in range(testcases):
	robot = [k for k in input()]
	dict1 = {'R': 0, 'S': 0, 'P': 0}
	for s in range(len(robot)):
		if robot[s] == 'R':
			dict1['R'] += 1
		elif robot[s] == 'S':
			dict1['S'] += 1
		else:
			dict1['P'] += 1
	highest = 0
	letter = 'R'
	for s in dict1.keys():
		if dict1[s] > highest:
			highest = dict1[s]
			letter = s
	counter = 'R'
	if letter == 'R':
		counter = 'P'
	if letter == 'P':
		counter = 'S'
	if letter == 'S':
		counter = 'R'
	outy = [counter for s in range(len(robot))]
	print(''.join(outy))


from __future__ import division, print_function
from sys import stdin, stdout
import bisect
import math
import heapq
i_m = 9223372036854775807

def inin():
	return int(input())

def stin():
	return input()

def spin():
	return map(int, stin().split())

def lin():
	return list(map(int, stin().split()))

def matrix(n):
	return [list(map(int, input().split())) for i in range(n)]

def calculate_sum(a, N):
	m = N / a
	sum = m * (m + 1) / 2
	ans = a * sum
	return ans

def series(N):
	return N * (N + 1) // 2

def count2Dmatrix(i, list):
	return sum((c.count(i) for c in list))

def modinv(n, p):
	return pow(n, p - 2, p)

def GCD(x, y):
	x = abs(x)
	y = abs(y)
	if min(x, y) == 0:
		return max(x, y)
	while y:
		(x, y) = (y, x % y)
	return x

def LCM(x, y):
	return x * y // GCD(x, y)

def Divisors(n):
	l = []
	for i in range(1, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n // i == i:
				l.append(i)
			else:
				l.append(i)
				l.append(n // i)
	return l

def isprime(n):
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0:
			return False
	return True
prime = []

def SieveOfEratosthenes(n):
	global prime
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	f = []
	for p in range(2, n):
		if prime[p]:
			f.append(p)
	return f
q = []

def dfs(n, d, v, c):
	global q
	v[n] = 1
	x = d[n]
	q.append(n)
	j = c
	for i in x:
		if i not in v:
			f = dfs(i, d, v, c + 1)
			j = max(j, f)
	return j
for _ in range(inin()):
	s = list(stin())
	n = []
	r = s.count('R')
	p = s.count('P')
	sc = s.count('S')
	mx = max([r, p, sc])
	if mx == r:
		print(''.join(['P'] * len(s)))
	elif mx == p:
		print(''.join(['S'] * len(s)))
	elif mx == sc:
		print(''.join(['R'] * len(s)))


for _ in range(int(input())):
	n = input()
	(r, p, s) = (0, 0, 0)
	for i in n:
		if i == 'R':
			r += 1
		elif i == 'P':
			p += 1
		else:
			s += 1
	if r >= p and r >= s:
		print('P' * len(n))
	elif p >= r and p >= s:
		print('S' * len(n))
	else:
		print('R' * len(n))


for t in range(int(input())):
	a = list(input())
	n = len(a)
	r = a.count('R')
	s = a.count('S')
	p = a.count('P')
	m = max(r, s, p)
	if m == r:
		print('P' * n)
	elif m == p:
		print('S' * n)
	elif m == s:
		print('R' * n)


from collections import Counter
steps = {'R': 'P', 'S': 'R', 'P': 'S'}
for _ in range(int(input())):
	bot_step = input()
	freq_step = max(Counter(bot_step).items(), key=lambda i: i[1])[0]
	print(steps[freq_step] * len(bot_step))


for _ in range(int(input())):
	sT = input()
	dic = {'R': 'P', 'P': 'S', 'S': 'R'}
	(r, p, s) = (sT.count('R'), sT.count('P'), sT.count('S'))
	c = ''
	if r >= p and r >= s:
		c = 'P' * len(sT)
	elif r <= p and p >= s:
		c = 'S' * len(sT)
	elif s >= p and r <= s:
		c = 'R' * len(sT)
	print(c)


import sys
import math
import bisect
from sys import stdin
from itertools import groupby
from heapq import heapify, heappop, heappush
from collections import deque, Counter, OrderedDict
input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__

def neo():
	return map(int, input().split())

def Neo():
	return list(map(int, input().split()))
for _ in range(int(input())):
	S = input()
	n = len(S)
	r = S.count('R')
	s = S.count('S')
	p = S.count('P')
	if r == max(s, r, p):
		print(n * 'P')
	elif s == max(s, r, p):
		print(n * 'R')
	else:
		print(n * 'S')


def main(s):
	hash = {}
	flip = {'S': 'R', 'R': 'P', 'P': 'S'}
	for i in s:
		if i not in hash:
			hash[i] = 1
		else:
			hash[i] += 1
	char = ''
	c = 0
	for i in hash:
		if hash[i] > c:
			c = hash[i]
			char = i
	print(flip[char] * len(s))
n = int(input())
for i in range(n):
	s = input()
	main(s)


from collections import Counter
win = {'R': 'P', 'P': 'S', 'S': 'R'}
t = int(input())
for tc in range(t):
	s = input()
	c = Counter(s).most_common(1)[0]
	n = len(s)
	print(win[c[0]] * n)


import math
import bisect
import copy
import time
from collections import Counter
for _ in range(int(input())):
	x = list(input())
	d = Counter(x)
	ma = 0
	ans = 0
	for (u, v) in d.items():
		if v > ma:
			ans = u
			ma = v
	d = {'R': 'P', 'P': 'S', 'S': 'R'}
	print(d[ans] * len(x))


from collections import Counter
t = int(input())
for _ in range(t):
	s = input()
	n = len(s)
	cntr = Counter(s)
	mc = cntr.most_common(1)[0][0]
	if mc == 'R':
		w = 'P'
	elif mc == 'P':
		w = 'S'
	else:
		w = 'R'
	print(w * n)


import sys
sys.setrecursionlimit(10 ** 5)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep='\n')

def II():
	return int(sys.stdin.readline())

def MI():
	return map(int, sys.stdin.readline().split())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI(rows_number):
	return [LI() for _ in range(rows_number)]

def SI():
	return sys.stdin.readline()[:-1]
for _ in range(II()):
	s = SI()
	hand = 'RSP'
	cnt = [0] * 3
	for c in s:
		i = hand.find(c)
		cnt[i] += 1
	mx = max(cnt)
	for i in range(3):
		if cnt[i] == mx:
			print(hand[i - 1] * len(s))
			break


T = int(input())
for _ in range(T):
	arr = input().strip()
	n = len(arr)
	(R, P, S) = (0, 0, 0)
	for ch in arr:
		if ch == 'R':
			R += 1
		elif ch == 'P':
			P += 1
		else:
			S += 1
	maxc = max(max(R, P), S)
	ans = ''
	if R == maxc:
		for i in range(n):
			ans += 'P'
	elif P == maxc:
		for i in range(n):
			ans += 'S'
	else:
		for i in range(n):
			ans += 'R'
	print(ans)


t = int(input())
while t:
	s = input()
	answ = ''
	(count_r, count_s, count_p) = (0, 0, 0)
	for i in s:
		if i == 'R':
			count_r += 1
		elif i == 'P':
			count_p += 1
		elif i == 'S':
			count_s += 1
	max_count = max(count_r, count_s, count_p)
	if max_count == count_r:
		answ = 'P' * len(s)
	elif max_count == count_p:
		answ = 'S' * len(s)
	elif max_count == count_s:
		answ = 'R' * len(s)
	print(answ)
	t -= 1


import math

def main():
	string = str(input())
	res = ''
	cntr = 0
	cnts = 0
	cntp = 0
	for i in string:
		if i == 'R':
			cntr += 1
		elif i == 'P':
			cntp += 1
		elif i == 'S':
			cnts += 1
	if cntr >= cnts and cntr >= cntp:
		res = 'P' * len(string)
	elif cntp >= cntr and cntp >= cnts:
		res = 'S' * len(string)
	else:
		res = 'R' * len(string)
	print(res)
	return

def test():
	t = int(input())
	while t:
		main()
		t -= 1
test()


import sys, os
from io import BytesIO, IOBase
import collections, itertools, bisect, heapq, math, string
from decimal import *
BUFSIZE = 8192
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def main():
	t = int(input())
	for i in range(t):
		s = str(input())
		n = len(s)
		rsp = [0, 0, 0]
		for x in s:
			if x == 'R':
				rsp[0] += 1
			elif x == 'S':
				rsp[1] += 1
			else:
				rsp[2] += 1
		res = sorted(enumerate(rsp), key=lambda x: -x[1])
		if res[0][0] == 0:
			print(''.join(['P'] * n))
		elif res[0][0] == 1:
			print(''.join(['R'] * n))
		else:
			print(''.join(['S'] * n))
main()


def sol(s: str) -> str:
	(R, S, P) = (s.count('R'), s.count('S'), s.count('P'))
	maxs = max(R, S, P)
	if maxs == R:
		return 'P' * len(s)
	elif maxs == S:
		return 'R' * len(s)
	else:
		return 'S' * len(s)
tmp = []
p = print

def print(*args, **kwargs):
	tmp.append((args, kwargs))

def flush():
	for (args, kwargs) in tmp:
		p(*args, **kwargs)
	return
T = int(input())
for _ in range(T):
	s = input()
	out = sol(s)
	print(out)
flush()


t = int(input())
for _ in range(t):
	a = input()
	rCount = 0
	sCount = 0
	pCount = 0
	for elem in a:
		if elem == 'R':
			rCount += 1
		if elem == 'P':
			pCount += 1
		if elem == 'S':
			sCount += 1
	if rCount >= sCount and rCount >= pCount:
		print('P' * len(a))
	elif sCount >= rCount and sCount >= pCount:
		print('R' * len(a))
	else:
		print('S' * len(a))


for _ in range(int(input())):
	s = input()
	l = len(s)
	r = s.count('R')
	si = s.count('S')
	p = s.count('P')
	if r >= si and r >= p:
		print('P' * l)
	elif si >= r and si >= p:
		print('R' * l)
	elif p >= si and p >= r:
		print('S' * l)


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	s = input().strip('\n')
	n = len(s)
	(R, P, S) = (s.count('R'), s.count('P'), s.count('S'))
	if max(R, P, S) == R:
		print('P' * n)
	elif max(R, P, S) == P:
		print('S' * n)
	else:
		print('R' * n)


from sys import stdin
T = int(stdin.readline().strip())
mp = dict()
mp['R'] = 'P'
mp['S'] = 'R'
mp['P'] = 'S'
for caso in range(T):
	s = stdin.readline().strip()
	ans = ''
	r = s.count('R')
	s1 = s.count('S')
	p = s.count('P')
	n = len(s)
	if r >= s1 and r >= p:
		print('P' * n)
	elif s1 >= r and s1 >= p:
		print('R' * n)
	else:
		print('S' * n)


for _ in range(int(input())):
	s = str(input())
	l = list(s)
	x = l.count('R')
	y = l.count('S')
	z = l.count('P')
	if x >= y and x >= z:
		for i in range(len(s)):
			print('P', end='')
	elif y >= x and y >= z:
		for i in range(len(s)):
			print('R', end='')
	elif z >= x and z >= y:
		for i in range(len(s)):
			print('S', end='')
	print()


for _ in range(int(input())):
	s = list(input())
	R = s.count('R')
	S = s.count('S')
	P = s.count('P')
	m = max(R, max(S, P))
	R -= m
	S -= m
	P -= m
	if R == 0:
		print('P' * len(s))
	elif S == 0:
		print('R' * len(s))
	elif P == 0:
		print('S' * len(s))


for t in range(int(input())):
	s = list(input())
	a = s.count('R')
	b = s.count('S')
	c = s.count('P')
	m = max(a, max(b, c))
	if m == a:
		print('P' * len(s))
	elif m == b:
		print('R' * len(s))
	else:
		print('S' * len(s))


t = int(input())
for you in range(t):
	s = input()
	n = len(s)
	numofr = 0
	numofs = 0
	numofp = 0
	for i in s:
		if i == 'R':
			numofr += 1
		elif i == 'S':
			numofs += 1
		else:
			numofp += 1
	z = max(numofr, numofp, numofs)
	if z == numofr:
		print('P' * n)
	elif z == numofs:
		print('R' * n)
	else:
		print('S' * n)


from collections import Counter
k = []
for _ in range(int(input())):
	k.append(input())
for i in k:
	t = Counter(i)
	z = t.most_common()
	if z[0][0] == 'R':
		print('P' * len(i))
	elif z[0][0] == 'P':
		print('S' * len(i))
	else:
		print('R' * len(i))


for _ in range(int(input())):
	n = input()
	c = max('RSP', key=n.count)
	ans = {'R': 'P', 'P': 'S', 'S': 'R'}[c]
	print(ans * len(n))


t = int(input())
while t:
	t += -1
	(r, p, s) = (0, 0, 0)
	ss = input()
	for i in ss:
		if i == 'R':
			r -= -1
		if i == 'P':
			p -= -1
		if i == 'S':
			s -= -1
	if r >= p and r >= s:
		print('P' * len(ss))
	elif p >= r and p >= s:
		print('S' * len(ss))
	else:
		print('R' * len(ss))


n = int(input())
for i in range(0, n):
	st = input()
	r = st.count('R')
	s = st.count('S')
	p = st.count('P')
	if r >= p and r >= s:
		ans = 'P' * len(st)
	elif p >= r and p >= s:
		ans = 'S' * len(st)
	else:
		ans = 'R' * len(st)
	print(ans)


from collections import Counter

def f(s):
	if s == 'R':
		return 'P'
	if s == 'P':
		return 'S'
	if s == 'S':
		return 'R'
for w in range(int(input())):
	s = str(input())
	d = Counter(s)
	u = 'RSP'
	m = 0
	for i in u:
		if d[i] > m:
			m = d[i]
			v = i
	print(f(v) * len(s))


t = int(input())
for i in range(t):
	m = input()
	d = {}
	x = ''
	(r, s, p) = (0, 0, 0)
	for j in range(len(m)):
		if m[j] == 'R':
			r += 1
		elif m[j] == 'S':
			s += 1
		else:
			p += 1
	f = len(m)
	if r >= s and r >= p:
		print('P' * f)
	elif s >= r and s >= p:
		print('R' * f)
	else:
		print('S' * f)


import sys
input = sys.stdin.readline
from collections import *
for _ in range(int(input())):
	s = input()[:-1]
	R = s.count('R')
	S = s.count('S')
	P = s.count('P')
	M = max(R, S, P)
	if R == M:
		print('P' * len(s))
	elif S == M:
		print('R' * len(s))
	else:
		print('S' * len(s))


t = int(input())
for _ in range(t):
	s = input()
	arr = [x for x in list(s)]
	n = len(arr)
	choice = {'R': 'P', 'S': 'R', 'P': 'S'}
	l = ''
	dic = {}
	for i in arr:
		if i not in dic:
			dic[i] = 1
		else:
			dic[i] += 1
	d = list(dic.items())
	d.sort(key=lambda x: x[1], reverse=True)
	ans = d[0][0]
	print(choice[ans] * n)


from collections import Counter, defaultdict, deque
import sys
input = sys.stdin.readline

def solve():
	s = input().strip()
	c = Counter(s)
	a = max(c.items(), key=lambda x: x[1])[0]
	t = {'R': 'P', 'P': 'S', 'S': 'R'}
	print(t[a] * len(s))
tt = int(input())
for test in range(tt):
	solve()


T = int(input())
for ii in range(T):
	s = input()
	n = len(s)
	R = 0
	P = 0
	S = 0
	for i in s:
		if i == 'R':
			R += 1
		elif i == 'P':
			P += 1
		else:
			S += 1
	if max(R, P, S) == R:
		result = 'P' * n
	elif max(R, P, S) == P:
		result = 'S' * n
	else:
		result = 'R' * n
	print(result)


from math import ceil

def main():
	t = int(input())
	for i in range(t):
		s = input()
		count_p = 0
		count_s = 0
		count_r = 0
		for i in s:
			if i == 'R':
				count_p += 1
			elif i == 'S':
				count_r += 1
			else:
				count_s += 1
		if count_p >= count_r and count_p >= count_s:
			print('P' * len(s))
		elif count_r >= count_p and count_r >= count_s:
			print('R' * len(s))
		else:
			print('S' * len(s))
main()


import sys
from collections import defaultdict
input = lambda : sys.stdin.readline().strip()
t = int(input())
while t:
	t -= 1
	s = input()
	d = defaultdict(int)
	for i in s:
		d[i] += 1
	ans = ''
	if d['R'] == max(d['R'], d['P'], d['S']):
		ans = 'P' * len(s)
	elif d['P'] == max(d['R'], d['P'], d['S']):
		ans = 'S' * len(s)
	else:
		ans = 'R' * len(s)
	print(ans)


import sys
input = lambda : sys.stdin.readline().rstrip()
for _ in range(int(input())):
	s = input()
	n = len(s)
	(r, s, p) = (s.count('R'), s.count('S'), s.count('P'))
	mx = max(r, s, p)
	if mx == r:
		print('P' * n)
	elif mx == s:
		print('R' * n)
	else:
		print('S' * n)


import io
import os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline

def get_str():
	return input().decode().strip()

def rint():
	return map(int, input().split())

def oint():
	return int(input())
t = oint()
for i in range(t):
	s = get_str()
	rc = s.count('R')
	sc = s.count('S')
	pc = s.count('P')
	if rc >= sc and rc >= pc:
		print('P' * len(s))
	elif sc >= rc and sc >= pc:
		print('R' * len(s))
	else:
		print('S' * len(s))


import sys
import math
import itertools
import functools
import collections
import operator
import fileinput
import copy
ORDA = 97

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return [int(i) for i in input().split()]

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def revn(n):
	return str(n)[::-1]

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=2):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base):
	new_number = 0
	while number > 0:
		new_number += number % base
		number //= base
	return new_number

def cdiv(n, k):
	return n // k + (n % k != 0)

def ispal(s):
	for i in range(len(s) // 2 + 1):
		if s[i] != s[-i - 1]:
			return False
	return True

def main():
	for _ in range(ii()):
		s = input()
		ss = collections.Counter(s)
		k = max(ss, key=ss.get)
		if k == 'R':
			print('P' * len(s))
		elif k == 'S':
			print('R' * len(s))
		else:
			print('S' * len(s))
main()


import sys
import math
from collections import defaultdict, Counter
t = int(input())
for i in range(t):
	s = input()
	n = len(s)
	c = Counter(s)
	m = 0
	for j in c:
		if c[j] > m:
			m = c[j]
			s1 = j
	if s1 == 'P':
		s1 = 'S'
	elif s1 == 'R':
		s1 = 'P'
	else:
		s1 = 'R'
	print(s1 * n)


for _ in range(int(input())):
	s = input()
	ss = list(s)
	rcount = ss.count('R')
	scount = ss.count('S')
	pcount = ss.count('P')
	mymax = max(pcount, scount, rcount)
	if mymax == rcount:
		print('P' * len(s))
	elif mymax == scount:
		print('R' * len(s))
	else:
		print('S' * len(s))


def win(s):
	l = len(s)
	r = s.count('R')
	S = s.count('S')
	p = s.count('P')
	m = max(r, S, p)
	if r == m:
		return 'P' * l
	if S == m:
		return 'R' * l
	else:
		return 'S' * l
t = int(input())
for _ in range(t):
	s = input()
	print(win(s))


abc = int(input())
for x in range(abc):
	s = input()
	n = len(s)
	n1 = s.count('R')
	n2 = s.count('P')
	n3 = n - n1 - n2
	A = []
	m = max(n1, n2, n3)
	if m == n1:
		A.append('P' * n)
	elif m == n2:
		A.append('S' * n)
	else:
		A.append('R' * n)
	print(''.join(A))


for _ in range(0, int(input())):
	s = list(input())
	rock = s.count('R')
	paper = s.count('P')
	scissors = s.count('S')
	if rock >= paper and rock >= scissors:
		print('P' * len(s))
	elif paper >= rock and paper >= scissors:
		print('S' * len(s))
	else:
		print('R' * len(s))


from math import *
sInt = lambda : int(input())
mInt = lambda : map(int, input().split())
lInt = lambda : list(map(int, input().split()))
t = sInt()
for _ in range(t):
	s = input()
	s = list(s)
	(vs, vr, vp) = (0, 0, 0)
	for i in range(len(s)):
		if s[i] == 'S':
			vs += 1
		elif s[i] == 'R':
			vr += 1
		else:
			vp += 1
	if vr >= vs and vr >= vp:
		ans = 'P' * len(s)
	elif vs >= vr and vs >= vp:
		ans = 'R' * len(s)
	else:
		ans = 'S' * len(s)
	print(ans)


from collections import Counter
for _ in range(int(input())):
	a = list(input())
	n = len(a)
	c = Counter(a).most_common(1)[0][0]
	if c == 'R':
		print('P' * n)
	elif c == 'P':
		print('S' * n)
	elif c == 'S':
		print('R' * n)


import collections

def main():
	s = list(input())
	m = {'R': 'P', 'S': 'R', 'P': 'S'}
	c = collections.Counter(s).most_common(3)
	print(m[c[0][0]] * len(s))
for _ in range(int(input())):
	main()


production = True
import sys, math, collections

def input(input_format=0, multi=0):
	if multi > 0:
		return [input(input_format) for i in range(multi)]
	else:
		next_line = sys.stdin.readline()[:-1]
		if input_format >= 10:
			use_list = False
			input_format = int(str(input_format)[-1])
		else:
			use_list = True
		if input_format == 0:
			formatted_input = [next_line]
		elif input_format == 1:
			formatted_input = list(map(int, next_line.split()))
		elif input_format == 2:
			formatted_input = list(map(float, next_line.split()))
		elif input_format == 3:
			formatted_input = list(next_line)
		elif input_format == 4:
			formatted_input = list(map(int, list(next_line)))
		elif input_format == 5:
			formatted_input = next_line.split()
		else:
			formatted_input = [next_line]
		return formatted_input if use_list else formatted_input[0]

def out(output_line, output_format=0, newline=True):
	formatted_output = ''
	if output_format == 0:
		formatted_output = str(output_line)
	elif output_format == 1:
		formatted_output = ' '.join(map(str, output_line))
	elif output_format == 2:
		formatted_output = '\n'.join(map(str, output_line))
	print(formatted_output, end='\n' if newline else '')

def log(*args):
	if not production:
		print('$$$', end='')
		print(*args)
enu = enumerate
ter = lambda a, b, c: b if a else c
ceil = lambda a, b: -(-a // b)

def mapl(iterable, format=0):
	if format == 0:
		return list(map(int, iterable))
	elif format == 1:
		return list(map(str, iterable))
	elif format == 2:
		return list(map(list, iterable))

def solve():
	s = input(3)
	u = [0] * 3
	for i in s:
		if i == 'R':
			u[0] += 1
		elif i == 'P':
			u[1] += 1
		elif i == 'S':
			u[2] += 1
	log(u)
	y = 0
	p = 0
	for (i, j) in enu(u):
		if j > y:
			y = j
			p = i
	if p == 0:
		a = 'P'
	elif p == 1:
		a = 'S'
	elif p == 2:
		a = 'R'
	out(a * len(s))
	return
for i in range(input(11)):
	solve()


t = int(input())
for _ in range(t):
	s = input()
	n = len(s)
	a = s.count('P')
	b = s.count('R')
	c = s.count('S')
	if b >= c and b >= a:
		print('P' * n)
	elif a >= b and a >= c:
		print('S' * n)
	else:
		print('R' * n)


from sys import stdin
inp = lambda : stdin.readline().strip()
t = int(inp())
for _ in range(t):
	s = inp()
	count = [0] * 3
	for i in s:
		if i == 'R':
			count[0] += 1
		if i == 'S':
			count[1] += 1
		if i == 'P':
			count[2] += 1
	if count[0] == max(count):
		print('P' * len(s))
	elif count[1] == max(count):
		print('R' * len(s))
	else:
		print('S' * len(s))


for test_i in range(int(input())):
	s = input()
	l = len(s)
	(n1, n2, n3) = (s.count('R'), s.count('S'), s.count('P'))
	if n2 <= n1 >= n3:
		print('P' * l)
	elif n1 <= n2 >= n3:
		print('R' * l)
	else:
		print('S' * l)


t = int(input())
for s in range(t):
	string = input()
	(r, s, p) = (0, 0, 0)
	for i in string:
		if i == 'R':
			r += 1
		elif i == 'S':
			s += 1
		else:
			p += 1
	maxi = max(r, s, p)
	add = r + s + p
	x = 0
	if maxi == r:
		x = 'P'
	elif maxi == s:
		x = 'R'
	else:
		x = 'S'
	for i in range(add):
		print(x, end='')
	print()


t = input()
t = int(t)

def max(a, b):
	if a > b:
		return a
	return b
while t > 0:
	t -= 1
	s = input()
	l = [0, 0, 0]
	for i in range(0, len(s)):
		if s[i] == 'R':
			l[0] += 1
		elif s[i] == 'P':
			l[1] += 1
		else:
			l[2] += 1
	max1 = max(max(l[0], l[1]), l[2])
	ans = 'R'
	if max1 == l[0]:
		ans = 'P'
	elif max1 == l[1]:
		ans = 'S'
	for i in range(0, len(s)):
		print(ans, end='')
	print('')


for test in range(int(input())):
	s = input()
	r = s.count('R')
	p = s.count('P')
	s1 = s.count('S')
	if r >= p and r >= s1:
		print('P' * len(s))
	elif p >= r and p >= s1:
		print('S' * len(s))
	else:
		print('R' * len(s))


t = int(input())
while t:
	dict1 = {'R': 'P', 'P': 'S', 'S': 'R'}
	dict2 = {}
	s = input()
	for i in s:
		if i in dict2:
			dict2[i] += 1
		else:
			dict2[i] = 1
	max1 = 0
	ans = ''
	for i in dict2:
		if max1 < dict2[i]:
			ans = i
			max1 = dict2[i]
	ans1 = ''
	for i in range(len(s)):
		ans1 += dict1[ans]
	print(ans1)
	t -= 1


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from math import gcd, ceil

def pre(s):
	n = len(s)
	pi = [0] * n
	for i in range(1, n):
		j = pi[i - 1]
		while j and s[i] != s[j]:
			j = pi[j - 1]
		if s[i] == s[j]:
			j += 1
		pi[i] = j
	return pi

def prod(a):
	ans = 1
	for each in a:
		ans = ans * each
	return ans

def lcm(a, b):
	return a * b // gcd(a, b)

def binary(x, length=16):
	y = bin(x)[2:]
	return y if len(y) >= length else '0' * (length - len(y)) + y
for _ in range(int(input()) if True else 1):
	st = input().lower()
	(r, s, p) = (0, 0, 0)
	for i in st:
		if i == 'r':
			r += 1
		if i == 's':
			s += 1
		if i == 'p':
			p += 1
	m = max(r, s, p)
	n = len(st)
	if m == r:
		print('P' * n)
	elif m == s:
		print('R' * n)
	elif m == p:
		print('S' * n)


from sys import stdin, gettrace
from collections import Counter
if gettrace():
	inputi = input
else:

	def input():
		return next(stdin)[:-1]

	def inputi():
		return stdin.buffer.readline()

def solve():
	ss = input()
	css = Counter(ss)
	(a, _) = css.most_common(1)[0]
	if a == 'R':
		b = 'P'
	elif a == 'P':
		b = 'S'
	else:
		b = 'R'
	print(b * len(ss))

def main():
	t = int(inputi())
	for _ in range(t):
		solve()
main()


from collections import Counter
ch = {'R': 'P', 'S': 'R', 'P': 'S'}
for _ in range(int(input())):
	ca = input()
	s = Counter(ca)
	print(ch[s.most_common(1)[0][0]] * len(ca))


for i in range(int(input())):
	s = input()
	n = len(s)
	cnt1 = s.count('R')
	cnt2 = s.count('P')
	cnt3 = s.count('S')
	m = max(cnt1, cnt2, cnt3)
	if m == cnt1:
		print(n * 'P')
	elif m == cnt2:
		print(n * 'S')
	else:
		print(n * 'R')


for _ in range(int(input())):
	t = input()
	l = len(t)
	r = p = s = 0
	for i in t:
		if i == 'R':
			r += 1
		elif i == 'P':
			p += 1
		else:
			s += 1
	if p <= r >= s:
		print('P' * l)
	elif r <= p >= s:
		print('S' * l)
	else:
		print('R' * l)


def ri():
	return int(input())

def rl():
	return list(map(int, input().split()))
t = ri()
for _ in range(t):
	word = input()
	n = len(word)
	r = word.count('R')
	p = word.count('P')
	s = word.count('S')
	maxi = max(r, p, s)
	if r == maxi:
		print('P' * n)
	elif p == maxi:
		print('S' * n)
	elif s == maxi:
		print('R' * n)


t = int(input())
while t:
	z = input()
	n = len(z)
	(r, s, p) = (0, 0, 0)
	for i in range(n):
		if z[i] == 'R':
			r += 1
		if z[i] == 'P':
			p += 1
		if z[i] == 'S':
			s += 1
	if r >= s and r >= p:
		for i in range(n):
			print('P', end='')
	elif p >= s and p >= r:
		for i in range(n):
			print('S', end='')
	else:
		for i in range(n):
			print('R', end='')
	print()
	t -= 1


t = int(input())
for _ in range(t):
	l = input()
	d = {'R': 'P', 'P': 'S', 'S': 'R'}
	figures = ['R', 'P', 'S']
	counts = [l.count('R'), l.count('P'), l.count('S')]
	print(d[figures[counts.index(max(counts))]] * len(l))


t = int(input())
x = ['R', 'S', 'P']
for _ in range(t):
	s = list(input())
	n = len(s)
	cnt = [s.count(x[i]) for i in range(3)]
	c = x[(cnt.index(max(cnt)) - 1) % 3]
	print(c * n)


for _ in range(int(input())):
	s = list(input())
	r = s.count('R')
	se = s.count('S')
	p = s.count('P')
	a = max(r, se, p)
	if a == r:
		print('P' * len(s))
	elif a == se:
		print('R' * len(s))
	else:
		print('S' * len(s))


MOD = 1000000007
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
from collections import Counter
for _ in range(ii()):
	a = list(si())
	C = Counter(a)
	n = len(a)
	b = []
	k = []
	for c in C:
		b.append(C[c])
		k.append(c)
	if k[b.index(max(b))] == 'R':
		print('P' * n)
	elif k[b.index(max(b))] == 'P':
		print('S' * n)
	else:
		print('R' * n)


from collections import Counter
for i in range(int(input())):
	s = input()
	states = Counter()
	for j in range(len(s)):
		states[s[j]] += 1
	if states['R'] >= states['S'] and states['R'] >= states['P']:
		print('P' * int(len(s)))
	elif states['S'] >= states['P'] and states['S'] >= states['R']:
		print('R' * int(len(s)))
	else:
		print('S' * int(len(s)))


for _ in range(int(input())):
	st = input()
	le = len(st)
	ro = 0
	pa = 0
	sc = 0
	for i in st:
		if i == 'R':
			ro += 1
		elif i == 'P':
			pa += 1
		else:
			sc += 1
	ma = max(ro, pa, sc)
	if ro == ma:
		print('P' * le)
	elif pa == ma:
		print('S' * le)
	else:
		print('R' * le)


from sys import stdin, stdout
from math import gcd, ceil, sqrt
from collections import Counter
from bisect import bisect_left, bisect_right
ii1 = lambda : int(stdin.readline().strip())
is1 = lambda : stdin.readline().strip()
iia = lambda : list(map(int, stdin.readline().strip().split()))
isa = lambda : stdin.readline().strip().split()
mod = 1000000007
tc = ii1()
for _ in range(tc):
	s = is1()
	d = Counter(s)
	max_ele = max(d, key=lambda x: d[x])
	if max_ele == 'P':
		print('S' * len(s))
	elif max_ele == 'R':
		print('P' * len(s))
	else:
		print('R' * len(s))


t = int(input())
for i in range(t):
	s = input()
	v1 = s.count('R')
	v2 = s.count('P')
	v3 = s.count('S')
	n = max(v1, v2, v3)
	if n == v1:
		l = 'P' * len(s)
	elif n == v2:
		l = 'S' * len(s)
	else:
		l = 'R' * len(s)
	print(l)


from sys import stdin

def iinput():
	return int(stdin.readline())

def minput():
	return map(int, stdin.readline().split())

def linput():
	return list(map(int, stdin.readline().split()))
from collections import Counter
d = {'S': 'R', 'R': 'P', 'P': 'S'}
t = iinput()
while t:
	t -= 1
	s = input()
	m = Counter(s).most_common()[0][0]
	print(d[m] * len(s))


T = input()
for t in range(int(T)):
	S = input()
	maxOccurrence = 0
	myChoices = ''
	rCount = S.count('R')
	sCount = S.count('S')
	pCount = S.count('P')
	if rCount >= sCount and rCount >= pCount:
		maxOccurrence = 'R'
	elif sCount >= rCount and sCount >= pCount:
		maxOccurrence = 'S'
	else:
		maxOccurrence = 'P'
	if maxOccurrence == 'R':
		myChoices = 'P' * len(S)
	elif maxOccurrence == 'S':
		myChoices = 'R' * len(S)
	else:
		myChoices = 'S' * len(S)
	print(myChoices)


t = int(input())
for _ in range(t):
	msg = input()
	(r, s, p) = (0, 0, 0)
	for w in msg:
		if w == 'R':
			r += 1
		if w == 'S':
			s += 1
		if w == 'P':
			p += 1
	if max(r, s, p) == r:
		print('P' * len(msg))
	elif max(r, s, p) == s:
		print('R' * len(msg))
	elif max(r, s, p) == p:
		print('S' * len(msg))


from math import *
t = int(input())
for _ in range(t):
	s = list(input())
	n = len(s)
	l = []
	k = s.count('R')
	m = s.count('S')
	b = s.count('P')
	a = max(k, m, b)
	if a == k:
		l = ['P'] * n
	elif a == m:
		l = ['R'] * n
	elif a == b:
		l = ['S'] * n
	for i in range(n):
		print(l[i], end='')
	print()


for _ in range(int(input())):
	s = input()
	o = max('RSP', key=lambda x: s.count(x))
	if o == 'R':
		o = 'P'
	elif o == 'S':
		o = 'R'
	else:
		o = 'S'
	print(o * len(s))


for _ in range(int(input())):
	st = list(input())
	n = len(st)
	ans = str()
	for i in range(n):
		if st[i] == 'R':
			ans += 'P'
		if st[i] == 'P':
			ans += 'S'
		if st[i] == 'S':
			ans += 'R'
	t = ans.count('P')
	y = ans.count('R')
	w = ans.count('S')
	if max(t, y, w) == t:
		sd = 'P'
		print(sd * n)
	elif max(t, y, w) == y:
		sd = 'R'
		print(sd * n)
	elif max(t, y, w) == w:
		sd = 'S'
		print(sd * n)


t = int(input())
for _ in range(t):
	s = str(input())
	n = len(s)
	R = s.count('R')
	S = s.count('S')
	P = s.count('P')
	m = max(P, R, S)
	if R == m:
		print('P' * n)
	elif S == m:
		print('R' * n)
	else:
		print('S' * n)


from collections import Counter
dic = {'R': 'P', 'P': 'S', 'S': 'R'}
for _ in range(int(input())):
	s = input()
	if len(set(s)) == 1:
		print(dic[s[0]] * len(s))
	else:
		arr = Counter(s)
		maxi = arr.most_common(1)[0][0]
		ans = dic[maxi] * len(s)
		print(ans)


from os import path
import sys, time
from math import ceil, floor, gcd, log, log2, factorial, cos, sin, pi
from collections import defaultdict, Counter, OrderedDict, deque
from itertools import combinations, accumulate
from string import ascii_lowercase, ascii_uppercase
from bisect import *
from functools import reduce
from operator import mul
maxx = float('inf')
I = lambda : int(sys.stdin.buffer.readline())
tup = lambda : map(int, sys.stdin.buffer.readline().split())
lint = lambda : [int(x) for x in sys.stdin.buffer.readline().split()]
S = lambda : sys.stdin.readline().strip('\n')
grid = lambda r: [lint() for i in range(r)]
stpr = lambda x: sys.stdout.write(f'{x}' + '\n')
star = lambda x: print(' '.join(map(str, x)))
localsys = 0
start_time = time.time()
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
d = {'R': 'P', 'P': 'S', 'S': 'R'}
for _ in range(I()):
	st = S()
	print(d[Counter(st).most_common()[0][0]] * len(st))
if localsys:
	print('\n\nTime Elased :', time.time() - start_time, 'seconds')


from os import path
import sys
from heapq import heappush, heappop
from functools import cmp_to_key as ctk
from collections import deque, defaultdict as dd
from bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right
from itertools import permutations
from datetime import datetime
from math import ceil, sqrt, log, gcd

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().split())

def li():
	return list(mi())
abc = 'abcdefghijklmnopqrstuvwxyz'
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def bo(i):
	return ord(i) - ord('a')
file = 1

def solve():
	for _ in range(ii()):
		s = si()
		s1 = ''
		n = len(s) - 1
		m = dd(int)
		for i in s:
			m[i] += 1
		x = 0
		for i in m.keys():
			if m[i] > x:
				c = i
				x = m[i]
		if c == 'R':
			c = 'P'
		elif c == 'P':
			c = 'S'
		elif c == 'S':
			c = 'R'
		print(c * n)
if file:
	if path.exists('input1.txt'):
		sys.stdin = open('input1.txt', 'r')
		sys.stdout = open('output1.txt', 'w')
	else:
		input = sys.stdin.readline
solve()


for _ in range(int(input())):
	str = input()
	ans = ''
	freq = {'R': 0, 'S': 0, 'P': 0}
	for i in str:
		if i == 'R':
			freq['R'] += 1
		elif i == 'S':
			freq['S'] += 1
		else:
			freq['P'] += 1
	k = max(freq['R'], freq['S'], freq['P'])
	if k == freq['R']:
		ans = 'P' * len(str)
	elif k == freq['S']:
		ans = 'R' * len(str)
	else:
		ans = 'S' * len(str)
	print(ans)


for _ in range(int(input())):
	st = input()
	n = len(st)
	(r, p, s) = (0, 0, 0)
	for i in range(n):
		if st[i] == 'R':
			r += 1
		elif st[i] == 'P':
			p += 1
		else:
			s += 1
	x = max(r, p, s)
	if x == r:
		print('P' * n)
	elif x == p:
		print('S' * n)
	else:
		print('R' * n)


from collections import defaultdict
for _ in range(int(input())):
	(d, a, b, c) = (defaultdict(lambda : 0), 0, 0, 0)
	for i in input():
		d[i] += 1
	for j in d:
		c += d[j]
		if d[j] > a:
			b = j
			a = d[j]
	if b == 'R':
		print('P' * c)
	elif b == 'P':
		print('S' * c)
	else:
		print('R' * c)


from collections import Counter
d = {'R': 'P', 'S': 'R', 'P': 'S'}
for _ in range(int(input())):
	a = input()
	n = len(a)
	di = Counter(a)
	maxi = max(di, key=di.get)
	print(d[maxi] * n)


import collections
dictt = {'R': 'P', 'S': 'R', 'P': 'S'}
for _ in range(int(input())):
	s = str(input())
	a = collections.Counter(s).most_common()[0][0]
	q = dictt[a]
	print(q * len(s))


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def fact(x):
	if x == 0:
		return 1
	else:
		return x * fact(x - 1)

def lower_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] >= num:
			answer = middle
			end = middle - 1
		else:
			start = middle + 1
	return answer

def upper_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] <= num:
			answer = middle
			start = middle + 1
		else:
			end = middle - 1
	return answer

def abs(x):
	return x if x >= 0 else -x

def binary_search(li, val, lb, ub):
	ans = 0
	while lb <= ub:
		mid = (lb + ub) // 2
		if li[mid] > val:
			ub = mid - 1
		elif val > li[mid]:
			lb = mid + 1
		else:
			ans = 1
			break
	return ans

def sieve_of_eratosthenes(n):
	ans = []
	arr = [1] * (n + 1)
	(arr[0], arr[1], i) = (0, 0, 2)
	while i * i <= n:
		if arr[i] == 1:
			j = i + i
			while j <= n:
				arr[j] = 0
				j += i
		i += 1
	for k in range(n):
		if arr[k] == 1:
			ans.append(k)
	return ans

def nc2(x):
	if x == 1:
		return 0
	else:
		return x * (x - 1) // 2

def kadane(x):
	sum_so_far = 0
	current_sum = 0
	for i in x:
		current_sum += i
		if current_sum < 0:
			current_sum = 0
		else:
			sum_so_far = max(sum_so_far, current_sum)
	return sum_so_far

def mex(li):
	check = [0] * 1001
	for i in li:
		check[i] += 1
	for i in range(len(check)):
		if check[i] == 0:
			return i

def sumdigits(n):
	ans = 0
	while n != 0:
		ans += n % 10
		n //= 10
	return ans
from math import *
for _ in range(int(input())):
	st = input()
	ans = ['P', 'R', 'S']
	c = [0, 0, 0]
	for i in st:
		if i == 'R':
			c[0] += 1
		elif i == 'S':
			c[1] += 1
		else:
			c[2] += 1
	string = ans[c.index(max(c))] * len(st)
	print(string)


for _ in ' ' * int(input()):
	b = input()
	r = len(b)
	z = b.count('R')
	z1 = b.count('P')
	z2 = b.count('S')
	if z == max(z, z1, z2):
		print('P' * r)
	elif z1 == max(z, z1, z2):
		print('S' * r)
	else:
		print('R' * r)


t = int(input())
for _ in range(t):
	ip = input()
	n = len(ip)
	l = [0, 0, 0]
	d = {'r': 0, 'p': 0, 's': 0}
	for i in ip:
		if i == 'R':
			d['r'] += 1
		elif i == 'P':
			d['p'] += 1
		else:
			d['s'] += 1
	d1 = sorted(d.items(), key=lambda x: x[1], reverse=True)
	temp = d1[0][0]
	if temp == 'r':
		print('P' * n)
	elif temp == 'p':
		print('S' * n)
	else:
		print('R' * n)


from sys import stdin
from collections import deque
mod = 10 ** 9 + 7
import sys
import random
from queue import PriorityQueue
from collections import Counter as cc
from bisect import bisect_right
from bisect import bisect_left
from collections import defaultdict
from math import sqrt, factorial, gcd, log2, inf, ceil
import heapq
input = lambda : sys.stdin.readline().rstrip()
from sys import stdin, stdout
from heapq import heapify, heappush, heappop
from itertools import permutations
from math import factorial as f

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p
import sys
t = int(input())
for _ in range(t):
	s = input()
	n = len(s)
	x = s.count('R')
	y = s.count('P')
	z = s.count('S')
	if x >= y and x >= z:
		print('P' * n)
	elif y >= x and y >= z:
		print('S' * n)
	elif z >= x and z >= y:
		print('R' * n)


t = int(input())
from collections import defaultdict
while t > 0:
	s = input()
	out = []
	d = defaultdict(int)
	for i in s:
		d[i] += 1
	maxi = 0
	p = 0
	for i in d.keys():
		if d[i] > maxi:
			maxi = d[i]
			p = i
	if p == 'P':
		p = 'S'
	elif p == 'R':
		p = 'P'
	else:
		p = 'R'
	for i in range(len(s)):
		print(p, end='')
	print()
	t -= 1


t = int(input())
for _ in range(t):
	s = str(input())
	n = len(s)
	d = {}
	for x in s:
		if x in d:
			d[x] += 1
		else:
			d[x] = 1
	mn = -1
	fx = None
	for x in d:
		if mn < d[x]:
			mn = d[x]
			fx = x
	if fx == 'R':
		c = 'P' * n
	elif fx == 'P':
		c = 'S' * n
	else:
		c = 'R' * n
	print(c)


t = int(input())
l = []
for i in range(t):
	n = input()
	l.append(n)
for x in l:
	rcount = 0
	pcount = 0
	scount = 0
	for a in x:
		if a == 'R':
			rcount += 1
		if a == 'S':
			scount += 1
		if a == 'P':
			pcount += 1
	h = [rcount, scount, pcount]
	if max(h) == rcount:
		print('P' * len(x))
	elif max(h) == scount:
		print('R' * len(x))
	elif max(h) == pcount:
		print('S' * len(x))


for _ in range(int(input())):
	s = input()
	(x, y, z) = (0, 0, 0)
	k = ''
	for i in range(len(s)):
		if s[i] == 'R':
			x += 1
		elif s[i] == 'S':
			y += 1
		else:
			z += 1
	if x >= y and x >= z:
		k = k + 'P' * len(s)
	elif y >= x and y >= z:
		k = k + 'R' * len(s)
	elif z >= x and z >= y:
		k = k + 'S' * len(s)
	print(k)


import sys
for _ in range(int(sys.stdin.readline().rstrip())):
	s = sys.stdin.readline().rstrip()
	re = ''
	cnt = {}
	for i in s:
		if i not in cnt:
			cnt[i] = 1
		else:
			cnt[i] += 1
	max_v = -1
	re = ''
	for (i, v) in cnt.items():
		if max_v < v:
			max_v = v
			re = i
	if re == 'R':
		re = 'P'
	elif re == 'S':
		re = 'R'
	elif re == 'P':
		re = 'S'
	print(re * len(s))


t = int(input())
from collections import Counter
for i in range(t):
	s = input()
	n = len(s)
	c = Counter(s)
	x = ''
	for (a, b) in c.most_common(1):
		x = a
	if x == 'R':
		print('P' * n)
	elif x == 'P':
		print('S' * n)
	else:
		print('R' * n)


d = {}
d['R'] = 'P'
d['P'] = 'S'
d['S'] = 'R'
for n in range(int(input())):
	s = list(input())
	v = {}
	v['R'] = s.count('R')
	v['P'] = s.count('P')
	v['S'] = s.count('S')
	mx = max(v['R'], v['P'], v['S'])
	for n in v:
		if v[n] == mx:
			print(d[n] * len(s))
			break


import sys
input = sys.stdin.readline
from collections import Counter

def print(val):
	sys.stdout.write(val)
	sys.stdout.write('\n')

def prog():
	win = {'R': 'P', 'S': 'R', 'P': 'S'}
	for _ in range(int(input())):
		s = input().strip()
		n = len(s)
		s1 = Counter(s)
		letter = s1.most_common(1)[0][0]
		print(win[letter] * n)
prog()


import sys
input = sys.stdin.readline
MOD = 1000000007
MOD2 = 998244353
ii = lambda : int(input().strip('\n'))
si = lambda : input().strip('\n')
dgl = lambda : list(map(int, input().strip('\n')))
f = lambda : map(int, input().strip('\n').split())
il = lambda : list(map(int, input().strip('\n').split()))
ls = lambda : list(input().strip('\n'))
lsc = lambda : list(input().strip('\n').split(' '))
lsi = lambda : [int(i) for i in ls()]
let = 'abcdefghijklmnopqrstuvwxyz'
for _ in range(ii()):
	s = si()
	n = len(s)
	rc = s.count('R')
	sc = s.count('S')
	pc = s.count('P')
	x = max(rc, pc, sc)
	if x == rc:
		print('P' * n)
	elif x == pc:
		print('S' * n)
	else:
		print('R' * n)


import sys
all_data = sys.stdin.read().split('\n')
for i in range(1, int(all_data[0]) + 1):
	if all_data[i].count('R') == max(all_data[i].count('R'), all_data[i].count('S'), all_data[i].count('P')):
		print('P' * len(all_data[i]))
	elif all_data[i].count('S') == max(all_data[i].count('R'), all_data[i].count('S'), all_data[i].count('P')):
		print('R' * len(all_data[i]))
	else:
		print('S' * len(all_data[i]))


t = int(input())
for _ in range(t):
	list1 = input().strip()
	r = list1.count('R')
	p = list1.count('P')
	s = list1.count('S')
	winner = max(r, p, s)
	if winner == r:
		choice = 'P'
	elif winner == p:
		choice = 'S'
	else:
		choice = 'R'
	for i in range(len(list1)):
		print(choice, end='')
	print()


from collections import Counter
n = int(input())
for i in range(n):
	s = input()
	bu = Counter(s)
	ma = max(bu, key=bu.get)
	if ma == 'R':
		gu = 'P'
	elif ma == 'S':
		gu = 'R'
	else:
		gu = 'S'
	for i in range(len(s)):
		print(gu, end='')
	print()


t = int(input())
for _ in range(t):
	s = input()
	n = len(s)
	c = ''
	dic = {}
	for i in s:
		if i in dic:
			dic[i] += 1
		else:
			dic[i] = 1
	m = 0
	x = ''
	for i in dic:
		if dic[i] > m:
			m = dic[i]
			x = i
	if x == 'R':
		c = 'P' * n
	if x == 'P':
		c = 'S' * n
	if x == 'S':
		c = 'R' * n
	print(c)


t = int(input())
for j in range(t):
	str = input()
	str = str.strip()
	cnt_R = cnt_P = cnt_S = 0
	for i in str:
		if i == 'R':
			cnt_R += 1
		elif i == 'P':
			cnt_P += 1
		elif i == 'S':
			cnt_S += 1
	if cnt_R >= cnt_P and cnt_R >= cnt_S:
		print('P' * len(str))
	elif cnt_P >= cnt_R and cnt_P >= cnt_S:
		print('S' * len(str))
	else:
		print('R' * len(str))


from collections import Counter
for _ in range(int(input())):
	s = list(input())
	c = Counter(s).most_common(1)[0][0]
	if c == 'R':
		print('P' * len(s))
	else:
		print('S' * len(s) if c == 'P' else 'R' * len(s))


t = int(input())
for _ in range(t):
	s = str(input())
	out = [int(0) for _ in range(3)]
	for move in s:
		if move == 'R':
			out[0] += 1
		elif move == 'P':
			out[1] += 1
		else:
			out[2] += 1
	if out[0] >= max(out[1], out[2]):
		print('P' * len(s))
	elif out[1] >= max(out[0], out[2]):
		print('S' * len(s))
	else:
		print('R' * len(s))


for t in range(int(input())):
	S = input()
	n = len(S)
	r = S.count('R')
	p = S.count('P')
	s = S.count('S')
	mx = max(r, p, s)
	if r == mx:
		ans = 'P' * n
	elif p == mx:
		ans = 'S' * n
	else:
		ans = 'R' * n
	print(ans)


for _ in range(int(input())):
	st = input()
	res = ''
	r = st.count('R')
	s = st.count('S')
	p = st.count('P')
	m = max(r, p, s)
	if m == r:
		for _ in range(len(st)):
			res += 'P'
	elif m == s:
		for _ in range(len(st)):
			res += 'R'
	else:
		for _ in range(len(st)):
			res += 'S'
	print(res)


for t in range(int(input())):
	a = input()
	arr = list(a)
	rc = arr.count('R')
	pc = arr.count('P')
	sc = arr.count('S')
	if max(rc, pc, sc) == rc:
		print('P' * len(arr))
	elif max(rc, pc, sc) == pc:
		print('S' * len(arr))
	else:
		print('R' * len(arr))


from collections import Counter

def ans(S):
	freqs = Counter(S)
	arg_max = max(freqs, key=freqs.get)
	d = {'R': 'P', 'P': 'S', 'S': 'R'}
	return d[arg_max] * len(S)
T = int(input())
for t in range(T):
	S = input()
	print(ans(S))


for t in range(int(input())):
	s = input()
	arr = [0] * 3
	for i in s:
		if i == 'R':
			arr[0] += 1
		elif i == 'P':
			arr[1] += 1
		else:
			arr[2] += 1
	ind = arr.index(max(arr))
	if ind == 0:
		v = 'P'
	elif ind == 1:
		v = 'S'
	else:
		v = 'R'
	print(v * len(s))


for _ in range(int(input())):
	data = list(input())
	out = [0, 0, 0]
	for i in range(len(data)):
		if data[i] == 'R':
			out[0] += 1
		elif data[i] == 'P':
			out[1] += 1
		elif data[i] == 'S':
			out[2] += 1
	m = out.index(max(out))
	lett = 0
	if m == 0:
		lett = 'P'
	if m == 1:
		lett = 'S'
	if m == 2:
		lett = 'R'
	print(lett * len(data))


t = int(input())
for _ in range(t):
	s = input()
	ctr = s.count('R')
	cts = s.count('S')
	ctp = s.count('P')
	if max(ctr, ctp, cts) == ctr:
		print('P' * len(s))
	elif max(ctr, ctp, cts) == cts:
		print('R' * len(s))
	else:
		print('S' * len(s))


def read_list():
	return list(map(int, input().split(' ')))

def print_list(l):
	print(' '.join(map(str, l)))

def judge():
	if dic[0] >= dic[1] and dic[0] >= dic[2]:
		return 'P'
	if dic[1] >= dic[0] and dic[1] >= dic[2]:
		return 'R'
	return 'S'
N = int(input())
for _ in range(N):
	s = input()
	dic = []
	dic.append(s.count('R'))
	dic.append(s.count('S'))
	dic.append(s.count('P'))
	print(judge() * len(s))


import sys
import math

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_string():
	return sys.stdin.readline().strip()
for t in range(int(input())):
	string = list(input())
	n = len(string)
	r = string.count('R')
	p = string.count('P')
	s = string.count('S')
	if r >= max(p, s):
		print('P' * n)
	elif p >= max(r, s):
		print('S' * n)
	else:
		print('R' * n)


from sys import stdin, stdout
import math, sys
from itertools import permutations, combinations
from collections import defaultdict, deque, OrderedDict
from os import path
import bisect as bi
import heapq

def yes():
	print('YES')

def no():
	print('NO')
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

	def I():
		return int(input())

	def In():
		return map(int, input().split())
else:

	def I():
		return int(stdin.readline())

	def In():
		return map(int, stdin.readline().split())

def dict(a):
	d = {}
	for x in a:
		if d.get(x, -1) != -1:
			d[x] += 1
		else:
			d[x] = 1
	return d

def main():
	try:
		l = list(input())
		(R, P, S) = (0, 0, 0)
		for x in l:
			if x == 'R':
				R += 1
			elif x == 'P':
				P += 1
			else:
				S += 1
		d = {}
		d['R'] = R
		d['S'] = S
		d['P'] = P
		t = max(R, S, P)
		for x in d:
			if d[x] == t:
				ans1 = x
				break
		n = len(l)
		if ans1 == 'R':
			ans = ['P'] * n
		elif ans1 == 'P':
			ans = ['S'] * n
		else:
			ans = ['R'] * n
		print(''.join(ans))
	except:
		pass
M = 998244353
P = 1000000007
for _ in range(I()):
	main()


for _ in range(int(input())):
	st = list(input())
	ans = ''
	n = len(st)
	r = st.count('R')
	s = st.count('S')
	p = st.count('P')
	if max(r, s, p) == r:
		print('P' * n)
	elif max(r, s, p) == s:
		print('R' * n)
	else:
		print('S' * n)


t = int(input())
for tt in range(t):
	x = input()
	d = {}
	for i in range(len(x)):
		d[x[i]] = d.get(x[i], 0) + 1
	v = list(d.values())
	u = list(d.keys())
	k = u[v.index(max(v))]
	if k == 'R':
		print('P' * len(x))
	elif k == 'P':
		print('S' * len(x))
	else:
		print('R' * len(x))


from collections import defaultdict
import sys, math
f = None
try:
	f = open('q1.input', 'r')
except IOError:
	f = sys.stdin
if 'xrange' in dir(__builtins__):
	range = xrange
sys.setrecursionlimit(10 ** 2)

def print_case_iterable(case_num, iterable):
	print('Case #{}: {}'.format(case_num, ' '.join(map(str, iterable))))

def print_case_number(case_num, iterable):
	print('Case #{}: {}'.format(case_num, iterable))

def print_iterable(A):
	print(' '.join(A))

def read_int():
	return int(f.readline().strip())

def read_int_array():
	return [int(x) for x in f.readline().strip().split(' ')]

def rns():
	a = [x for x in f.readline().split(' ')]
	return (int(a[0]), a[1].strip())

def read_string():
	return list(f.readline().strip())

def ri():
	return int(f.readline().strip())

def ria():
	return [int(x) for x in f.readline().strip().split(' ')]

def rns():
	a = [x for x in f.readline().split(' ')]
	return (int(a[0]), a[1].strip())

def rs():
	return list(f.readline().strip())

def bi(x):
	return bin(x)[2:]
from collections import deque
import math
NUMBER = 10 ** 9 + 7

def factorial(n):
	M = NUMBER
	f = 1
	for i in range(1, n + 1):
		f = f * i % M
	return f

def mult(a, b):
	return a * b % NUMBER

def minus(a, b):
	return (a - b) % NUMBER

def plus(a, b):
	return (a + b) % NUMBER

def egcd(a, b):
	if a == 0:
		return (b, 0, 1)
	else:
		(g, y, x) = egcd(b % a, a)
		return (g, x - b // a * y, y)

def modinv(a):
	m = NUMBER
	(g, x, y) = egcd(a, m)
	if g != 1:
		raise Exception('modular inverse does not exist')
	else:
		return x % m

def choose(n, k):
	if n < k:
		assert false
	return mult(factorial(n), modinv(mult(factorial(k), factorial(n - k)))) % NUMBER
from collections import deque, defaultdict
import heapq
from types import GeneratorType

def bootstrap(f, stack=[]):

	def wrappedfunc(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		else:
			to = f(*args, **kwargs)
			while True:
				if type(to) is GeneratorType:
					stack.append(to)
					to = next(to)
				else:
					stack.pop()
					if not stack:
						break
					to = stack[-1].send(to)
			return to
	return wrappedfunc

def dfs(g, timeIn, timeOut, depths, parents):
	cnt = 0
	stack = [[1, 0, 0, 0]]
	while stack:
		(v, neig_i, parent, depth) = stack[-1]
		parents[v] = parent
		depths[v] = depth
		if neig_i == 0:
			timeIn[v] = cnt
			cnt += 1
		while neig_i < len(g[v]):
			u = g[v][neig_i]
			if u == parent:
				neig_i += 1
				continue
			stack[-1][1] = neig_i + 1
			stack.append([u, 0, v, depth + 1])
			break
		if neig_i == len(g[v]):
			stack.pop()
			timeOut[v] = cnt
			cnt += 1
cnt = 0

@bootstrap
def dfs(v, adj, timeIn, timeOut, depths, parents, parent=0, depth=0):
	global cnt
	parents[v] = parent
	depths[v] = depth
	timeIn[v] = cnt
	cnt += 1
	for u in adj[v]:
		if u == parent:
			continue
		yield dfs(u, adj, timeIn, timeOut, depths, parents, v, depth + 1)
	timeOut[v] = cnt
	cnt += 1
	yield

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def lcm(a, b):
	return a * b / gcd(a, b)

def get_num_2_5(n):
	twos = 0
	fives = 0
	while n > 0 and n % 2 == 0:
		n //= 2
		twos += 1
	while n > 0 and n % 5 == 0:
		n //= 5
		fives += 1
	return (twos, fives)

def shift(a, i, num):
	for _ in range(num):
		(a[i], a[i + 1], a[i + 2]) = (a[i + 2], a[i], a[i + 1])

def equal(x, y):
	return abs(x - y) <= 1e-09

def getAngle(a, b, c):
	ang = math.degrees(math.atan2(c[1] - b[1], c[0] - b[0]) - math.atan2(a[1] - b[1], a[0] - b[0]))
	return ang + 360 if ang < 0 else ang

def getLength(a, b):
	return math.sqrt((a[0] - b[0]) ** 2 + (a[1] - b[1]) ** 2)
from heapq import heapify, heappush, heappop

def solution(s):
	(r, p, S) = (0, 0, 0)
	for x in s:
		if x == 'R':
			r += 1
		if x == 'P':
			p += 1
		if x == 'S':
			S += 1
	l = [r, S, p]
	if r == max(l):
		return 'P' * len(s)
	if S == max(l):
		return 'R' * len(s)
	return 'S' * len(s)

def main():
	T = 1
	T = ri()
	for i in range(T):
		s = rs()
		x = solution(s)
		if 'xrange' not in dir(__builtins__):
			print(x)
		else:
			(print >> output, str(x))
	if 'xrange' in dir(__builtins__):
		print(output.getvalue())
		output.close()
if 'xrange' in dir(__builtins__):
	import cStringIO
	output = cStringIO.StringIO()
main()


for t in range(int(input())):
	s = input()
	d = {}
	for i in s:
		if i in d:
			d[i] += 1
		else:
			d[i] = 1
	keylist = list(d.keys())
	vallist = list(d.values())
	m = 0
	for i in d:
		if m < d[i]:
			m = d[i]
	res = keylist[vallist.index(m)]
	if res == 'R':
		print('P' * len(s))
	elif res == 'S':
		print('R' * len(s))
	else:
		print('S' * len(s))


for _ in range(int(input())):
	l = list(input())
	a = l.count('R')
	b = l.count('S')
	c = l.count('P')
	m = max(a, max(b, c))
	if a == m:
		print(len(l) * 'P')
	elif b == m:
		print(len(l) * 'R')
	else:
		print(len(l) * 'S')


from collections import Counter

def func():
	freq = Counter(s)
	n = len(s)
	ch = max(freq, key=freq.get)
	if ch == 'R':
		ans = 'P' * n
	elif ch == 'P':
		ans = 'S' * n
	else:
		ans = 'R' * n
	print(ans)
for _ in range(int(input())):
	s = list(input())
	func()


a = int(input(''))
for i in range(0, a):
	b = input('')
	p = b.count('P')
	s = b.count('S')
	r = b.count('R')
	if r >= p and r >= s:
		print('P' * len(b))
	elif p >= r and p >= s:
		print('S' * len(b))
	else:
		print('R' * len(b))


from bisect import *
from collections import *
from math import gcd, ceil, sqrt, floor, inf
from heapq import *
from itertools import *
from operator import add, mul, sub, xor, truediv, floordiv
from functools import *
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def RL():
	return map(int, sys.stdin.readline().rstrip().split())

def RLL():
	return list(map(int, sys.stdin.readline().rstrip().split()))

def N():
	return int(input())
from types import GeneratorType

def bootstrap(f, stack=[]):

	def wrappedfunc(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		else:
			to = f(*args, **kwargs)
			while True:
				if type(to) is GeneratorType:
					stack.append(to)
					to = next(to)
				else:
					stack.pop()
					if not stack:
						break
					to = stack[-1].send(to)
			return to
	return wrappedfunc
farr = [1]
ifa = []

def fact(x, mod=0):
	if mod:
		while x >= len(farr):
			farr.append(farr[-1] * len(farr) % mod)
	else:
		while x >= len(farr):
			farr.append(farr[-1] * len(farr))
	return farr[x]

def ifact(x, mod):
	global ifa
	ifa.append(pow(farr[-1], mod - 2, mod))
	for i in range(x, 0, -1):
		ifa.append(ifa[-1] * i % mod)
	ifa = ifa[::-1]

def per(i, j, mod=0):
	if i < j:
		return 0
	if not mod:
		return fact(i) // fact(i - j)
	return farr[i] * ifa[i - j] % mod

def com(i, j, mod=0):
	if i < j:
		return 0
	if not mod:
		return per(i, j) // fact(j)
	return per(i, j, mod) * ifa[j] % mod

def catalan(n):
	return com(2 * n, n) // (n + 1)

def linc(f, t, l, r):
	while l < r:
		mid = (l + r) // 2
		if t > f(mid):
			l = mid + 1
		else:
			r = mid
	return l

def rinc(f, t, l, r):
	while l < r:
		mid = (l + r + 1) // 2
		if t < f(mid):
			r = mid - 1
		else:
			l = mid
	return l

def ldec(f, t, l, r):
	while l < r:
		mid = (l + r) // 2
		if t < f(mid):
			l = mid + 1
		else:
			r = mid
	return l

def rdec(f, t, l, r):
	while l < r:
		mid = (l + r + 1) // 2
		if t > f(mid):
			r = mid - 1
		else:
			l = mid
	return l

def isprime(n):
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			return False
	return True

def binfun(x):
	c = 0
	for w in arr:
		c += ceil(w / x)
	return c

def lowbit(n):
	return n & -n

def inverse(a, m):
	a %= m
	if a <= 1:
		return a
	return (1 - inverse(m, a) * m) // a % m

class BIT:

	def __init__(self, arr):
		self.arr = arr
		self.n = len(arr) - 1

	def update(self, x, v):
		while x <= self.n:
			self.arr[x] += v
			x += x & -x

	def query(self, x):
		ans = 0
		while x:
			ans += self.arr[x]
			x &= x - 1
		return ans

class DSU:

	def __init__(self, n):
		self.c = [-1] * n

	def same(self, x, y):
		return self.find(x) == self.find(y)

	def find(self, x):
		if self.c[x] < 0:
			return x
		self.c[x] = self.find(self.c[x])
		return self.c[x]

	def union(self, u, v):
		(u, v) = (self.find(u), self.find(v))
		if u == v:
			return False
		if self.c[u] < self.c[v]:
			(u, v) = (v, u)
		self.c[u] += self.c[v]
		self.c[v] = u
		return True

	def size(self, x):
		return -self.c[self.find(x)]

class UFS:

	def __init__(self, n):
		self.parent = [i for i in range(n)]
		self.ranks = [0] * n

	def find(self, x):
		if x != self.parent[x]:
			self.parent[x] = self.find(self.parent[x])
		return self.parent[x]

	def union(self, u, v):
		(pu, pv) = (self.find(u), self.find(v))
		if pu == pv:
			return False
		if self.ranks[pu] >= self.ranks[pv]:
			self.parent[pv] = pu
			if self.ranks[pv] == self.ranks[pu]:
				self.ranks[pu] += 1
		else:
			self.parent[pu] = pv

def Prime(n):
	c = 0
	prime = []
	flag = [0] * (n + 1)
	for i in range(2, n + 1):
		if not flag[i]:
			prime.append(i)
			c += 1
		for j in range(c):
			if i * prime[j] > n:
				break
			flag[i * prime[j]] = prime[j]
			if i % prime[j] == 0:
				break
	return prime

def dij(s, graph):
	d = {}
	d[s] = 0
	heap = [(0, s)]
	seen = set()
	while heap:
		(dis, u) = heappop(heap)
		if u in seen:
			continue
		for v in graph[u]:
			if v not in d or d[v] > d[u] + graph[u][v]:
				d[v] = d[u] + graph[u][v]
				heappush(heap, (d[v], v))
	return d

def GP(it):
	return [(ch, len(list(g))) for (ch, g) in groupby(it)]

class DLN:

	def __init__(self, val):
		self.val = val
		self.pre = None
		self.next = None
t = N()
for i in range(t):
	s = input()
	n = len(s)
	c = Counter(s)
	t = c.most_common(1)[0][0]
	d = {'R': 'P', 'P': 'S', 'S': 'R'}
	print(d[t] * n)


from collections import Counter
t = int(input())
for foo in range(t):
	s = input()
	cnt = Counter(s).most_common()
	mc = cnt[0][0]
	if mc == 'R':
		ans = 'P'
	elif mc == 'S':
		ans = 'R'
	elif mc == 'P':
		ans = 'S'
	print(ans * len(s))


t = int(input())
for _ in range(t):
	s = list(input())
	a = [s.count('R'), s.count('S'), s.count('P')]
	if a[0] == max(a):
		print('P' * len(s))
	elif a[1] == max(a):
		print('R' * len(s))
	else:
		print('S' * len(s))


for i in range(int(input())):
	s = input()
	n = len(s)
	(x, y, z) = (0, 0, 0)
	for i in range(n):
		if s[i] == 'R':
			y += 1
		elif s[i] == 'P':
			z += 1
		else:
			x += 1
	if y == max(x, y, z):
		for i in range(n):
			print('P', end='')
			y -= 1
	elif z == max(x, y, z):
		for i in range(n):
			print('S', end='')
			z -= 1
	elif x == max(x, y, z):
		for i in range(n):
			print('R', end='')
			x -= 1
	print()


t = int(input())
i = 0
while i < t:
	s = input('')
	n = len(s)
	rn = s.count('R')
	sn = s.count('S')
	pn = s.count('P')
	if max(rn, pn, sn) == rn:
		print(n * 'P')
	elif max(rn, pn, sn) == sn:
		print(n * 'R')
	elif max(rn, pn, sn) == pn:
		print(n * 'S')
	i += 1


for _ in range(int(input())):
	s = input()
	d = {'R': 'P', 'S': 'R', 'P': 'S'}
	print(d[max('RSP', key=lambda x: s.count(x))] * len(s))


def solve():
	string = input()
	solution = {'R': 'P', 'S': 'R', 'P': 'S'}
	counts = {'R': 0, 'S': 0, 'P': 0}
	for c in string:
		if c == 'R':
			counts['R'] += 1
		if c == 'S':
			counts['S'] += 1
		if c == 'P':
			counts['P'] += 1
	mx_count = max(counts.values())
	max_char = 'R' if counts['R'] == mx_count else 'S' if counts['S'] == mx_count else 'P'
	print(solution[max_char] * len(string))
t = int(input())
while t != 0:
	t -= 1
	solve()


tests = int(input())
for t in range(tests):
	string = input()
	roks = 0
	paper = 0
	scissor = 0
	for n in range(len(string)):
		if string[n] == 'R':
			roks += 1
		elif string[n] == 'P':
			paper += 1
		else:
			scissor += 1
	print_str = 'P' * (roks >= max(scissor, paper)) + 'S' * (paper > max(roks, scissor)) + 'R' * (scissor > max(roks, paper))
	if len(print_str) == 0:
		print_str = 'P' * (roks == paper > scissor) + 'R' * (roks == scissor > paper) + 'S' * (scissor == paper > roks)
	print(print_str * len(string))


import sys
import math
cases = int(input())
while cases > 0:
	s = input()
	(rc, pc, sc) = (0, 0, 0)
	for e in s:
		if e == 'S':
			sc += 1
		elif e == 'P':
			pc += 1
		else:
			rc += 1
	n = len(s)
	if rc >= pc and rc >= sc:
		ans = ''.join(['P' for e in range(n)])
	elif pc >= rc and pc >= sc:
		ans = ''.join(['S' for e in range(n)])
	else:
		ans = ''.join(['R' for e in range(n)])
	print(ans)
	cases -= 1


from sys import stdin, stdout, setrecursionlimit
from collections import deque, defaultdict, Counter
from heapq import heappush, heappop
import math
rl = lambda : stdin.readline()
rll = lambda : stdin.readline().split()
rli = lambda : map(int, stdin.readline().split())
rlf = lambda : map(float, stdin.readline().split())
(INF, NINF) = (float('inf'), float('-inf'))

def main():
	T = int(rl())
	for _ in range(T):
		s = rll()[0]
		n = len(s)
		F = Counter(s)
		x = sorted(F.keys(), key=lambda k: F[k], reverse=True)[0]
		if x == 'R':
			print('P' * n)
		elif x == 'S':
			print('R' * n)
		else:
			print('S' * n)
	stdout.close()
main()


from bisect import *
from collections import *
from itertools import *
import functools
import sys
import math
from decimal import *
from copy import *
from heapq import *
from fractions import *
getcontext().prec = 30
MAX = sys.maxsize
MAXN = 1000010
MOD = 10 ** 9 + 7
spf = [i for i in range(MAXN)]
spf[0] = spf[1] = -1

def sieve():
	for i in range(2, MAXN, 2):
		spf[i] = 2
	for i in range(3, int(MAXN ** 0.5) + 1):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def fib(n, m):
	if n == 0:
		return [0, 1]
	else:
		(a, b) = fib(n // 2)
		c = a % m * (b % m * 2 - a % m) % m
		d = a % m * (a % m) % m + b % m * b % m % m
		if n % 2 == 0:
			return [c, d]
		else:
			return [d, c + d]

def charIN(x=' '):
	return sys.stdin.readline().strip().split(x)

def arrIN(x=' '):
	return list(map(int, sys.stdin.readline().strip().split(x)))

def ncr(n, r):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % MOD
		den = den * (i + 1) % MOD
	return num * pow(den, MOD - 2, MOD) % MOD

def flush():
	return sys.stdout.flush()
for _ in range(int(input())):
	s = list(input())
	x = [s.count('R'), s.count('P'), s.count('S')]
	idx = x.index(max(x))
	if idx == 0:
		print('P' * len(s))
	elif idx == 1:
		print('S' * len(s))
	else:
		print('R' * len(s))


d = {'S': 'R', 'P': 'S', 'R': 'P'}
for _ in range(int(input())):
	s = input()
	m = 0
	c = ''
	for i in d:
		x = s.count(i)
		if x >= m:
			m = x
			c = i
	ans = d[c] * len(s)
	print(ans)


from collections import Counter
for _ in range(int(input())):
	a = input()
	t = {'R': 'P', 'P': 'S', 'S': 'R'}
	c = Counter(a).most_common()
	print(t[c[0][0]] * len(a))


tests = int(input())
for t in range(tests):
	input_str = input()
	res = ''
	count_r = 0
	count_s = 0
	count_p = 0
	for i in input_str:
		if i == 'R':
			count_r += 1
		if i == 'S':
			count_s += 1
		if i == 'P':
			count_p += 1
	if count_r >= count_s and count_r >= count_p:
		res = ['P' for i in range(len(input_str))]
	elif count_s >= count_r and count_s >= count_p:
		res = ['R' for i in range(len(input_str))]
	else:
		res = ['S' for i in range(len(input_str))]
	print(''.join(res))


t = int(input())
for k in range(t):
	s = input()
	hr = s.count('R')
	hp = s.count('P')
	hs = s.count('S')
	if hr == max(hr, hp, hs):
		print('P' * len(s))
	elif hp == max(hr, hp, hs):
		print('S' * len(s))
	else:
		print('R' * len(s))


for _ in range(int(input())):
	s = input()
	L = len(s)
	count = [0] * 3
	for i in s:
		if i == 'R':
			count[0] += 1
		elif i == 'P':
			count[1] += 1
		else:
			count[2] += 1
	if count[0] == max(count):
		print('P' * L)
	elif count[1] == max(count):
		print('S' * L)
	else:
		print('R' * L)


t = int(input())
for _ in range(t):
	s = input()
	n = len(s)
	ans = ''
	d = {}
	for i in s:
		if i not in d:
			d[i] = 1
		else:
			d[i] += 1
	a = list(d.keys())
	move = a[0]
	for i in d:
		if d[i] > d[move]:
			move = i
	if move == 'R':
		move = 'P'
	elif move == 'P':
		move = 'S'
	else:
		move = 'R'
	ans = n * move
	print(ans)


def problemA():
	n = int(input())
	l = list(map(int, input().split()))
	i = 0
	while i < n - 1 and l[i] > l[i + 1]:
		i += 1
	if i == n - 1:
		print('NO')
		return
	j = i + 1
	while j < n - 1 and l[j] < l[j + 1]:
		j += 1
	if j == n - 1:
		print('NO')
		return
	print('YES')
	print(i + 1, j + 1, j + 2)

def problemB():
	s = input().strip()
	a = [0] * 3
	for i in s:
		if i == 'R':
			a[0] += 1
		elif i == 'S':
			a[1] += 1
		else:
			a[2] += 1
	m = max(a)
	if a[0] == m:
		print('P' * sum(a))
	elif a[1] == m:
		print('R' * sum(a))
	else:
		print('S' * sum(a))
cases = int(input())
for _ in range(cases):
	problemB()


n = int(input())
while n:
	s = input()
	R = 0
	P = 0
	S = 0
	for i in s:
		if i == 'R':
			R += 1
		elif i == 'P':
			P += 1
		else:
			S += 1
	if max(R, P, S) == R:
		for _ in range(len(s)):
			print('P', end='')
	elif max(R, P, S) == P:
		for _ in range(len(s)):
			print('S', end='')
	else:
		for _ in range(len(s)):
			print('R', end='')
	print('')
	n -= 1


from collections import Counter

def main():
	dict1 = {'R': 'P', 'S': 'R', 'P': 'S'}
	for _ in range(int(input())):
		str1 = input()
		count = Counter(str1).most_common(1)[0]
		print(dict1[count[0]] * len(str1))
main()


for _ in range(int(input())):
	a = list(input())
	str1 = ''
	r = 0
	p = 0
	s = 0
	d = {}
	for i in a:
		if i == 'R':
			r = r + 1
		elif i == 'P':
			p = p + 1
		else:
			s = s + 1
	if max(r, p, s) == r:
		str1 = 'P' * len(a)
	elif max(r, p, s) == p:
		str1 = 'S' * len(a)
	else:
		str1 = 'R' * len(a)
	print(str1)


def solution():
	for _ in range(int(input())):
		s = input()
		ans = ''
		r = 0
		p = 0
		sc = 0
		for i in s:
			if i == 'S':
				sc += 1
			elif i == 'P':
				p += 1
			else:
				r += 1
		if max([r, sc, p]) == r:
			ans = 'P' * len(s)
		elif max([r, sc, p]) == p:
			ans = 'S' * len(s)
		else:
			ans = 'R' * len(s)
		print(ans)
solution()


for _ in range(int(input())):
	s = input()
	n = len(s)
	d = {'R': 'P', 'P': 'S', 'S': 'R'}
	freq = {}
	for i in s:
		freq[i] = freq.get(i, 0) + 1
	maxx = max(freq, key=freq.get)
	ans = d[maxx] * n
	print(ans)


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().strip().split(' '))

def msi():
	return map(str, input().strip().split(' '))

def li():
	return list(mi())

def dmain():
	sys.setrecursionlimit(1000000)
	threading.stack_size(1024000)
	thread = threading.Thread(target=main)
	thread.start()
import sys
input = sys.stdin.readline
scanner = lambda : int(input())
string = lambda : input().rstrip()
get_list = lambda : list(read())
read = lambda : map(int, input().split())
get_float = lambda : map(float, input().split())

def ceil(x):
	if x != int(x):
		x = int(x) + 1
	return x

def factorial(x, m):
	val = 1
	while x > 0:
		val = val * x % m
		x -= 1
	return val

def fact(x):
	val = 1
	while x > 0:
		val *= x
		x -= 1
	return val

def swaparr(arr, a, b):
	temp = arr[a]
	arr[a] = arr[b]
	arr[b] = temp

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)

def lcm(a, b):
	return a * b // math.gcd(a, b)

def is_integer(n):
	return math.ceil(n) == math.floor(n)

def nCr(n, k):
	if k > n:
		return 0
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res / (i + 1)
	return int(res)

def primefs(n):
	primes = {}
	while n % 2 == 0 and n > 0:
		primes[2] = primes.get(2, 0) + 1
		n = n // 2
	for i in range(3, int(n ** 0.5) + 2, 2):
		while n % i == 0 and n > 0:
			primes[i] = primes.get(i, 0) + 1
			n = n // i
	if n > 2:
		primes[n] = primes.get(n, 0) + 1
	return primes

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def swap(a, b):
	temp = a
	a = b
	b = temp
	return (a, b)

def find(x, link):
	p = x
	while p != link[p]:
		p = link[p]
	while x != p:
		nex = link[x]
		link[x] = p
		x = nex
	return p

def union(x, y, link, size):
	x = find(x, link)
	y = find(y, link)
	if size[x] < size[y]:
		(x, y) = swap(x, y)
	if x != y:
		size[x] += size[y]
		link[y] = x

def sieve(n):
	prime = [True for i in range(n + 1)]
	(prime[0], prime[1]) = (False, False)
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime

def phi(n):
	result = n
	p = 2
	while p * p <= n:
		if n % p == 0:
			while n % p == 0:
				n = n // p
			result = result * (1.0 - 1.0 / float(p))
		p = p + 1
	if n > 1:
		result = result * (1.0 - 1.0 / float(n))
	return int(result)

def is_prime(n):
	if n == 0:
		return False
	if n == 1:
		return True
	for i in range(2, int(n ** (1 / 2)) + 1):
		if not n % i:
			return False
	return True

def next_prime(n, primes):
	while primes[n] != True:
		n += 1
	return n
MAXN = int(100000.0 + 5)

def spf_sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(MAXN ** 0.5), 2):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i
spf = [0 for i in range(MAXN)]

def factoriazation(x):
	res = []
	for i in range(2, int(x ** 0.5) + 1):
		while x % i == 0:
			res.append(i)
			x //= i
	if x != 1:
		res.append(x)
	return res

def factors(n):
	res = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			res.append(i)
			res.append(n // i)
	return list(set(res))

def int_array():
	return list(map(int, input().strip().split()))

def float_array():
	return list(map(float, input().strip().split()))

def str_array():
	return input().strip().split()

def binary_search(low, high, w, h, n):
	while low < high:
		mid = low + (high - low) // 2
		if check(mid, w, h, n):
			low = mid + 1
		else:
			high = mid
	return low

def check(beauty, s, n, count):
	pass
MOD = int(1000000000.0) + 7
CMOD = 998244353
INF = float('inf')
NINF = -float('inf')
alphs = 'abcdefghijklmnopqrstuvwxyz'
from itertools import permutations
import math
import bisect as bis
import random
import sys
import collections as collect

def solve():
	bot = string()
	RPS = {'rock': 0, 'paper': 0, 'scissor': 0}
	choose = {'rock': 'P', 'paper': 'S', 'scissor': 'R'}
	for x in bot:
		if x == 'R':
			RPS['rock'] += 1
		elif x == 'P':
			RPS['paper'] += 1
		else:
			RPS['scissor'] += 1
	val = max(RPS.values())
	for x in RPS:
		if RPS[x] == val:
			req = x
			break
	print(choose[req] * len(bot))
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
for i in range(scanner()):
	solve()


for _ in range(int(input())):
	ss = input()
	count = {}
	for e in ss:
		if e not in count:
			count[e] = 1
		else:
			count[e] += 1
	s = 0
	d = 'R'
	for (e, f) in count.items():
		if f > s:
			s = f
			d = e
	if d == 'R':
		ans = 'P' * len(ss)
	elif d == 'S':
		ans = 'R' * len(ss)
	else:
		ans = 'S' * len(ss)
	print(ans)


for _ in range(int(input())):
	ans = {}
	lst = input()
	for i in lst:
		if i not in ans:
			ans[i] = 1
		else:
			ans[i] += 1
	count = 0
	for i in ans:
		if ans[i] > count:
			count = ans[i]
			final = i
	if final == 'R':
		final = 'P'
	elif final == 'S':
		final = 'R'
	else:
		final = 'S'
	print(final * len(lst))


import sys
from collections import Counter
n = int(sys.stdin.readline().strip())
for i in range(n):
	m = sys.stdin.readline().strip()
	x = Counter(m)
	R = x['R']
	S = x['S']
	P = x['P']
	if R >= S and R >= P:
		print('P' * len(m))
	elif S >= R and S >= P:
		print('R' * len(m))
	elif P >= S and P >= R:
		print('S' * len(m))


def in1():
	return int(input())
for _ in range(in1()):
	s = list(input())
	d = [0, 0, 0]
	for i in range(len(s) - 1, -1, -1):
		if s[i] == 'R':
			d[0] += 1
		elif s[i] == 'S':
			d[1] += 1
		else:
			d[2] += 1
	s1 = ''
	t1 = max(d)
	t2 = d.index(t1)
	if t2 == 0:
		s1 = 'P' * len(s)
	elif t2 == 1:
		s1 = 'R' * len(s)
	else:
		s1 = 'S' * len(s)
	print(s1)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from collections import Counter
for _ in range(int(input())):
	c = {'R': 'P', 'P': 'S', 'S': 'R'}
	s = input()
	d = Counter(list(s))
	m = 0
	for i in d:
		if d[i] > m:
			ans = i
		m = max(m, d[i])
	print(c[ans] * len(s))


t = int(input())
for u in range(t):
	a = input()
	r = 0
	p = 0
	s = 0
	for x in a:
		if x == 'R':
			r += 1
		if x == 'S':
			s += 1
		if x == 'P':
			p += 1
	t = max(r, s, p)
	if t == r:
		otv = 'P' * len(a)
	elif t == s:
		otv = 'R' * len(a)
	else:
		otv = 'S' * len(a)
	print(otv)


from sys import stdin, stdout
import sys
INF = 100000000000.0
import bisect

def get_int():
	return int(stdin.readline().strip())

def get_ints():
	return map(int, stdin.readline().strip().split())

def get_array():
	return list(map(int, stdin.readline().strip().split()))

def get_string():
	return stdin.readline().strip()

def op(c):
	return stdout.write(c)
from collections import defaultdict
import math
for t in range(int(stdin.readline())):
	s = get_string()
	d = defaultdict(int)
	for i in s:
		d[i] += 1
	mx = -1
	ch = 'R'
	for i in d:
		if d[i] > mx:
			mx = d[i]
			ch = i
	if ch == 'R':
		ans = 'P' * len(s)
	elif ch == 'P':
		ans = 'S' * len(s)
	elif ch == 'S':
		ans = 'R' * len(s)
	print(ans)


for i in range(int(input())):
	s = input()
	countR = 0
	countS = 0
	countP = 0
	for j in s:
		if j == 'R':
			countP += 1
		elif j == 'S':
			countR += 1
		else:
			countS += 1
	if countP == max(countR, countS, countP):
		print('P' * len(s))
	elif countR == max(countR, countS, countP):
		print('R' * len(s))
	else:
		print('S' * len(s))


from collections import Counter
t = int(input())
for testcase in range(t):
	s = input()
	x = Counter(s).most_common(1)[0][0]
	moves = ['R', 'P', 'S']
	print(moves[(moves.index(x) + 1) % 3] * len(s))


from collections import Counter
for _ in range(int(input())):
	di = {'R': 'P', 'P': 'S', 'S': 'R'}
	a = input()
	g = Counter(a).most_common()[0][0]
	print(di[g] * len(a))


n = int(input())
while n > 0:
	n -= 1
	s = input()
	l = len(s)
	r = sc = p = 0
	r = s.count('R')
	sc = s.count('S')
	p = s.count('P')
	if r >= sc and r >= p:
		print('P' * l)
	elif p >= sc and p >= r:
		print('S' * l)
	else:
		print('R' * l)


for i in range(int(input())):
	s = list(input())
	d = {}
	for i in range(len(s)):
		if s[i] not in d:
			d[s[i]] = 0
		d[s[i]] += 1
	mx = 0
	for i in d:
		if d[i] > mx:
			mx = d[i]
			ind = i
	if ind == 'R':
		sol = len(s) * ['P']
	elif ind == 'P':
		sol = len(s) * ['S']
	elif ind == 'S':
		sol = len(s) * ['R']
	print(*sol, sep='')


from sys import stdin, stdout
import math
input = stdin.readline

def print(x='', y='', end='\n'):
	if y == '':
		stdout.write(str(x) + end)
	else:
		stdout.write(str(x) + ' ' + str(y) + end)

def solve():
	s = list(input())[:-1]
	d = {'R': 'P', 'P': 'S', 'S': 'R'}
	ans = []
	cnt = {}
	for i in s:
		if i in cnt:
			cnt[i] += 1
		else:
			cnt[i] = 1
	maxx = ''
	cnm = 0
	for i in cnt:
		if cnt[i] > cnm:
			cnm = cnt[i]
			maxx = i
	print(str(d[maxx]) * len(s))
tt = 1
tt = int(input())
for __ in range(tt):
	solve()


t = int(input())
for _ in range(t):
	st = input().strip()
	r = st.count('R')
	s = st.count('S')
	p = st.count('P')
	if max(r, s, p) == r:
		print('P' * len(st))
	elif max(r, s, p) == s:
		print('R' * len(st))
	else:
		print('S' * len(st))


from sys import *
input = stdin.readline
t = int(input())
for _ in range(t):
	st = input()
	n = len(st)
	r = 0
	p = 0
	s = 0
	for i in st:
		if i == 'R':
			r += 1
		elif i == 'S':
			s += 1
		elif i == 'P':
			p += 1
	m = max(r, p, s)
	n -= 1
	if m == r:
		res = 'P' * n
	elif m == s:
		res = 'R' * n
	elif m == p:
		res = 'S' * n
	print(res)


import math
t = int(input())
for g in range(0, t):
	string = input()
	p = 0
	r = 0
	s = 0
	for i in range(0, len(string)):
		if string[i] == 'P':
			p += 1
		elif string[i] == 'R':
			r += 1
		else:
			s += 1
	if r >= p and r >= s:
		ans = 'P' * len(string)
		print(ans)
	elif p >= r and p >= s:
		ans = 'S' * len(string)
		print(ans)
	else:
		ans = 'R' * len(string)
		print(ans)


from sys import stdin, stdout
int_in = lambda : int(stdin.readline())
arr_in = lambda : [int(x) for x in stdin.readline().split()]
mat_in = lambda rows: [arr_in() for _ in range(rows)]
str_in = lambda : stdin.readline().strip()
out = lambda o: stdout.write('{}\n'.format(o))
arr_out = lambda o: out(' '.join(map(str, o)))
bool_out = lambda o: out('YES' if o else 'NO')
tests = lambda : range(1, int_in() + 1)
case_out = lambda i, o: out('Case #{}: {}'.format(i, o))
from collections import defaultdict

def solve(s):
	count = defaultdict(lambda : 0)
	for char in s:
		count[char] += 1
	if count['R'] >= count['S'] and count['R'] >= count['P']:
		return 'P' * len(s)
	if count['S'] >= count['R'] and count['S'] >= count['P']:
		return 'R' * len(s)
	return 'S' * len(s)
for _ in tests():
	s = str_in()
	out(solve(s))


from collections import Counter
t = int(input())
for _ in range(t):
	s = list(input())
	d = Counter(s).most_common()
	if d[0][0] == 'R':
		print('P' * len(s))
	elif d[0][0] == 'P':
		print('S' * len(s))
	else:
		print('R' * len(s))


import sys
t = int(sys.stdin.readline().strip())
for _ in range(t):
	s = sys.stdin.readline().strip()
	(x, y, z) = (s.count('R'), s.count('S'), s.count('P'))
	if max(x, y, z) == x:
		print('P' * len(s))
	elif max(x, y, z) == y:
		print('R' * len(s))
	else:
		print('S' * len(s))


import sys, io, os, time
from collections import defaultdict
from collections import OrderedDict
from collections import deque
from itertools import combinations
from itertools import permutations
import bisect, math, heapq
alphabet = 'abcdefghijklmnopqrstuvwxyz'
for ii in range(int(input())):
	s = input()
	n = len(s)
	win = {'R': 'P', 'P': 'S', 'S': 'R'}
	count = defaultdict(int)
	for i in s:
		count[i] += 1
	count = sorted(count.items(), key=lambda x: x[1], reverse=True)
	c = count[0][0]
	print(win[c] * n)


t = int(input())
for i in range(t):
	inputstr = input()
	output = ''
	count = {}
	for i in inputstr:
		if i not in count:
			count[i] = 1
		else:
			count[i] += 1
	dict2 = {'R': 'P', 'P': 'S', 'S': 'R'}
	output = dict2[max(count, key=lambda i: count[i])] * len(inputstr)
	print(output)


t = int(input())
for _ in range(t):
	s = str(input())
	n = len(s)
	a = {'R', 'P', 'S'}
	r = s.count('R')
	p = s.count('P')
	s = s.count('S')
	if r == max(r, p, s):
		ans = n * 'P'
	elif p == max(r, p, s):
		ans = n * 'S'
	else:
		ans = n * 'R'
	print(ans)


from sys import *
t = int(stdin.readline())
while t > 0:
	s = stdin.readline()
	d = dict()
	for i in range(len(s)):
		if s[i] not in d:
			d[s[i]] = 1
		else:
			d[s[i]] += 1
	dk = max(d, key=d.get)
	if dk == 'R':
		ans = 'P'
	if dk == 'P':
		ans = 'S'
	if dk == 'S':
		ans = 'R'
	l = [ans for i in range(len(s) - 1)]
	print(''.join(l))
	t -= 1


from collections import Counter
n = int(input())
vet = []
for _ in range(n):
	inp = input()
	res = Counter(inp)
	aux = res.most_common()
	if aux[0][0] == 'P':
		vet.append('S' * len(inp))
	elif aux[0][0] == 'R':
		vet.append('P' * len(inp))
	elif aux[0][0] == 'S':
		vet.append('R' * len(inp))
print(*vet, sep='\n')


from sys import stdin, stdout
import math, queue, heapq
fastinput = stdin.readline
fastout = stdout.write
t = int(fastinput())
while t:
	t -= 1
	s = input()
	rock = s.count('R')
	scisoor = s.count('S')
	paper = s.count('P')
	x = ''
	if rock >= scisoor and rock >= paper:
		x += 'P' * len(s)
	elif paper >= scisoor and paper >= rock:
		x += 'S' * len(s)
	else:
		x += 'R' * len(s)
	print(x)


tc = int(input())
for _ in range(tc):
	str1 = input()
	dic = {}
	for c in str1:
		if c not in dic:
			dic[c] = 1
			continue
		dic[c] += 1
	keys = list(dic.keys())
	values = list(dic.values())
	ma = index = 0
	for i in range(len(values)):
		if values[i] > ma:
			ma = values[i]
			index = i
	ans = ''
	x = {'R': 'P', 'S': 'R', 'P': 'S'}
	for i in range(len(str1)):
		ans += x[keys[index]]
	print(ans)


import math
import heapq, bisect
import sys
from collections import deque, defaultdict
from fractions import Fraction
mod = 10 ** 9 + 7
mod1 = 998244353
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

class TreeNode:

	def __init__(self, k, v):
		self.key = k
		self.value = v
		self.left = None
		self.right = None
		self.parent = None
		self.height = 1
		self.num_left = 1
		self.num_total = 1

class AvlTree:

	def __init__(self):
		self._tree = None

	def add(self, k, v):
		if not self._tree:
			self._tree = TreeNode(k, v)
			return
		node = self._add(k, v)
		if node:
			self._rebalance(node)

	def _add(self, k, v):
		node = self._tree
		while node:
			if k < node.key:
				if node.left:
					node = node.left
				else:
					node.left = TreeNode(k, v)
					node.left.parent = node
					return node.left
			elif node.key < k:
				if node.right:
					node = node.right
				else:
					node.right = TreeNode(k, v)
					node.right.parent = node
					return node.right
			else:
				node.value = v
				return

	@staticmethod
	def get_height(x):
		return x.height if x else 0

	@staticmethod
	def get_num_total(x):
		return x.num_total if x else 0

	def _rebalance(self, node):
		n = node
		while n:
			lh = self.get_height(n.left)
			rh = self.get_height(n.right)
			n.height = max(lh, rh) + 1
			balance_factor = lh - rh
			n.num_total = 1 + self.get_num_total(n.left) + self.get_num_total(n.right)
			n.num_left = 1 + self.get_num_total(n.left)
			if balance_factor > 1:
				if self.get_height(n.left.left) < self.get_height(n.left.right):
					self._rotate_left(n.left)
				self._rotate_right(n)
			elif balance_factor < -1:
				if self.get_height(n.right.right) < self.get_height(n.right.left):
					self._rotate_right(n.right)
				self._rotate_left(n)
			else:
				n = n.parent

	def _remove_one(self, node):
		replacement = node.left or node.right
		if node.parent:
			if AvlTree._is_left(node):
				node.parent.left = replacement
			else:
				node.parent.right = replacement
			replacement.parent = node.parent
			node.parent = None
		else:
			self._tree = replacement
			replacement.parent = None
		node.left = None
		node.right = None
		node.parent = None
		self._rebalance(replacement)

	def _remove_leaf(self, node):
		if node.parent:
			if AvlTree._is_left(node):
				node.parent.left = None
			else:
				node.parent.right = None
			self._rebalance(node.parent)
		else:
			self._tree = None
		node.parent = None
		node.left = None
		node.right = None

	def remove(self, k):
		node = self._get_node(k)
		if not node:
			return
		if AvlTree._is_leaf(node):
			self._remove_leaf(node)
			return
		if node.left and node.right:
			nxt = AvlTree._get_next(node)
			node.key = nxt.key
			node.value = nxt.value
			if self._is_leaf(nxt):
				self._remove_leaf(nxt)
			else:
				self._remove_one(nxt)
			self._rebalance(node)
		else:
			self._remove_one(node)

	def get(self, k):
		node = self._get_node(k)
		return node.value if node else -1

	def _get_node(self, k):
		if not self._tree:
			return None
		node = self._tree
		while node:
			if k < node.key:
				node = node.left
			elif node.key < k:
				node = node.right
			else:
				return node
		return None

	def get_at(self, pos):
		x = pos + 1
		node = self._tree
		while node:
			if x < node.num_left:
				node = node.left
			elif node.num_left < x:
				x -= node.num_left
				node = node.right
			else:
				return (node.key, node.value)
		raise IndexError('Out of ranges')

	@staticmethod
	def _is_left(node):
		return node.parent.left and node.parent.left == node

	@staticmethod
	def _is_leaf(node):
		return node.left is None and node.right is None

	def _rotate_right(self, node):
		if not node.parent:
			self._tree = node.left
			node.left.parent = None
		elif AvlTree._is_left(node):
			node.parent.left = node.left
			node.left.parent = node.parent
		else:
			node.parent.right = node.left
			node.left.parent = node.parent
		bk = node.left.right
		node.left.right = node
		node.parent = node.left
		node.left = bk
		if bk:
			bk.parent = node
		node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1
		node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)
		node.num_left = 1 + self.get_num_total(node.left)

	def _rotate_left(self, node):
		if not node.parent:
			self._tree = node.right
			node.right.parent = None
		elif AvlTree._is_left(node):
			node.parent.left = node.right
			node.right.parent = node.parent
		else:
			node.parent.right = node.right
			node.right.parent = node.parent
		bk = node.right.left
		node.right.left = node
		node.parent = node.right
		node.right = bk
		if bk:
			bk.parent = node
		node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1
		node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)
		node.num_left = 1 + self.get_num_total(node.left)

	@staticmethod
	def _get_next(node):
		if not node.right:
			return node.parent
		n = node.right
		while n.left:
			n = n.left
		return n
avl = AvlTree()

class SegmentTree1:

	def __init__(self, data, default='z', func=lambda a, b: min(a, b)):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class SegmentTree:

	def __init__(self, data, default=0, func=lambda a, b: a + b):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class Factorial:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorials = [1, 1]
		self.invModulos = [0, 1]
		self.invFactorial_ = [1, 1]

	def calc(self, n):
		if n <= -1:
			print('Invalid argument to calculate n!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.factorials):
			return self.factorials[n]
		nextArr = [0] * (n + 1 - len(self.factorials))
		initialI = len(self.factorials)
		prev = self.factorials[-1]
		m = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * i % m
		self.factorials += nextArr
		return self.factorials[n]

	def inv(self, n):
		if n <= -1:
			print('Invalid argument to calculate n^(-1)')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		p = self.MOD
		pi = n % p
		if pi < len(self.invModulos):
			return self.invModulos[pi]
		nextArr = [0] * (n + 1 - len(self.invModulos))
		initialI = len(self.invModulos)
		for i in range(initialI, min(p, n + 1)):
			next = -self.invModulos[p % i] * (p // i) % p
			self.invModulos.append(next)
		return self.invModulos[pi]

	def invFactorial(self, n):
		if n <= -1:
			print('Invalid argument to calculate (n^(-1))!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.invFactorial_):
			return self.invFactorial_[n]
		self.inv(n)
		nextArr = [0] * (n + 1 - len(self.invFactorial_))
		initialI = len(self.invFactorial_)
		prev = self.invFactorial_[-1]
		p = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * self.invModulos[i % p] % p
		self.invFactorial_ += nextArr
		return self.invFactorial_[n]

class Combination:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorial = Factorial(MOD)

	def ncr(self, n, k):
		if k < 0 or n < k:
			return 0
		k = min(k, n - k)
		f = self.factorial
		return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD

def powm(a, n, m):
	if a == 1 or n == 0:
		return 1
	if n % 2 == 0:
		s = powm(a, n // 2, m)
		return s * s % m
	else:
		return a * powm(a, n - 1, m) % m

def sort_list(list1, list2):
	zipped_pairs = zip(list2, list1)
	z = [x for (_, x) in sorted(zipped_pairs)]
	return z

def product(l):
	por = 1
	for i in range(len(l)):
		por *= l[i]
	return por

def binarySearchCount(arr, n, key):
	left = 0
	right = n - 1
	count = 0
	while left <= right:
		mid = int((right + left) / 2)
		if arr[mid] <= key:
			count = mid + 1
			left = mid + 1
		else:
			right = mid - 1
	return count

def countdig(n):
	c = 0
	while n > 0:
		n //= 10
		c += 1
	return c

def countGreater(arr, n, k):
	l = 0
	r = n - 1
	leftGreater = n
	while l <= r:
		m = int(l + (r - l) / 2)
		if arr[m] >= k:
			leftGreater = m
			r = m - 1
		else:
			l = m + 1
	return n - leftGreater
for ik in range(int(input())):
	s = input()
	e = [0, 0, 0]
	e[0] = s.count('R')
	e[1] = s.count('S')
	e[2] = s.count('P')
	r = e.index(max(e))
	ans = ['P', 'R', 'S']
	print(ans[r] * len(s))


from collections import defaultdict
for _ in range(int(input())):
	s = input()
	ctr = defaultdict(int)
	for c in s:
		ctr[c] += 1
	vals = [t[1] for t in ctr.items()]
	if ctr['R'] == max(vals):
		print('P' * len(s))
	elif ctr['P'] == max(vals):
		print('S' * len(s))
	else:
		print('R' * len(s))


from collections import Counter
for _ in range(int(input())):
	s = input()
	win = {'R': 'P', 'P': 'S', 'S': 'R'}
	a = Counter(s).most_common(1)[0][0]
	ans = win[a] * len(s)
	print(ans)


for _ in range(int(input())):
	s = input()
	a = [0] * 3
	for item in s:
		if item == 'R':
			a[0] += 1
		elif item == 'P':
			a[1] += 1
		else:
			a[2] += 1
	if max(a) == a[0]:
		print('P' * len(s))
	elif max(a) == a[1]:
		print('S' * len(s))
	else:
		print('R' * len(s))


for _ in range(int(input())):
	str = input()
	rock = 0
	sci = 0
	paper = 0
	for i in str:
		if i == 'R':
			rock += 1
		elif i == 'S':
			sci += 1
		elif i == 'P':
			paper += 1
	d = max(rock, sci)
	e = max(d, paper)
	if e == rock:
		print('P' * len(str))
	elif e == sci:
		print('R' * len(str))
	elif e == paper:
		print('S' * len(str))


I = input
for _ in range(int(I())):
	s = list(I())
	d = dict()
	for i in s:
		if i in d:
			d[i] += 1
		else:
			d[i] = 1
	m = 0
	c = ''
	for i in d:
		if d[i] > m:
			m = d[i]
			c = i
	d1 = {'R': 'P', 'S': 'R', 'P': 'S'}
	print(d1[c] * len(s))


from collections import deque
from collections import OrderedDict
import math
import sys
import os
import threading
import bisect
import operator
import heapq
from atexit import register
from io import BytesIO
import io
input = lambda : sys.stdin.readline().rstrip('\r\n')
for t in range(int(input())):
	s = input()
	cR = 0
	cS = 0
	cP = 0
	for i in range(len(s)):
		if s[i] == 'R':
			cR += 1
		elif s[i] == 'S':
			cS += 1
		else:
			cP += 1
	val = ''
	if cR >= cS and cR >= cP:
		val = 'P'
	elif cS >= cR and cS >= cP:
		val = 'R'
	else:
		val = 'S'
	for i in range(len(s)):
		print(val, end='')
	print('\n', end='')


from collections import Counter
for _ in range(int(input())):
	S = input()
	n = len(S)
	C = Counter(S)
	c = C.most_common(1)[0][0]
	if c == 'R':
		print('P' * n)
	elif c == 'P':
		print('S' * n)
	else:
		print('R' * n)


from collections import Counter
t = int(input())
for _ in range(t):
	s = input()
	choices = Counter(s)
	mode = choices.most_common(1)[0][0]
	if mode == 'R':
		print('P' * len(s))
	elif mode == 'P':
		print('S' * len(s))
	elif mode == 'S':
		print('R' * len(s))


import collections
for _ in range(int(input())):
	s = input()
	a = collections.Counter(s).most_common(1)[0]
	d = a[0] * len(s)
	if d[0] == 'R':
		print(len(d) * 'P')
	if d[0] == 'P':
		print(len(d) * 'S')
	if d[0] == 'S':
		print(len(d) * 'R')


T = int(input())
for _ in range(T):
	s = input().strip()
	rc = 0
	sc = 0
	pc = 0
	for c in s:
		if c == 'R':
			rc += 1
		elif c == 'S':
			sc += 1
		else:
			pc += 1
	if rc == max(rc, sc, pc):
		print('P' * len(s))
	elif sc == max(rc, sc, pc):
		print('R' * len(s))
	else:
		print('S' * len(s))


from sys import stdin
for _ in range(int(input())):
	s = input()
	a = b = c = 0
	for i in range(len(s)):
		if s[i] == 'R':
			a += 1
		elif s[i] == 'P':
			b += 1
		else:
			c += 1
	if a == max([a, b, c]):
		print('P' * len(s))
	elif b == max([a, b, c]):
		print('S' * len(s))
	else:
		print('R' * len(s))


from collections import Counter
for _ in range(int(input())):
	s = input()
	t = ''
	d = {'R': 'P', 'P': 'S', 'S': 'R'}
	c = Counter(list(s))
	x = c.most_common()[0][0]
	t = d[x] * len(s)
	print(t)


for _ in range(int(input())):
	s = input()
	tmp = {s.count('S'): 'S', s.count('P'): 'P', s.count('R'): 'R'}
	tmp = tmp[max(tmp)]
	ans = {'R': 'P', 'S': 'R', 'P': 'S'}
	print(ans[tmp] * len(s))


for t in range(int(input())):
	s = input()
	l = [0] * 3
	n = len(s)
	for z in range(n):
		if s[z] == 'R':
			l[0] += 1
		elif s[z] == 'P':
			l[1] += 1
		else:
			l[-1] += 1
	idx = l.index(max(l))
	if idx == 0:
		ans = ['P'] * n
	elif idx == 1:
		ans = ['S'] * n
	else:
		ans = ['R'] * n
	print(''.join(ans))


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().strip().split(' '))

def msi():
	return map(str, input().strip().split(' '))

def li():
	return list(mi())

def dmain():
	sys.setrecursionlimit(1000000)
	threading.stack_size(1024000)
	thread = threading.Thread(target=main)
	thread.start()
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def getKey(item):
	return item[1]

def sort2(l):
	return sorted(l, key=getKey, reverse=True)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def ntl(n):
	return [int(i) for i in str(n)]

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def ceil(x, y):
	if x % y == 0:
		return x // y
	else:
		return x // y + 1

def powerMod(x, y, p):
	res = 1
	x %= p
	while y > 0:
		if y & 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def read():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def main():
	for _ in range(ii()):
		s = si()
		n = len(s)
		x = s.count('R')
		y = s.count('S')
		z = s.count('P')
		if max(x, y, z) == x:
			print('P' * n)
		elif max(x, y, z) == y:
			print('R' * n)
		elif max(x, y, z) == z:
			print('S' * n)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


from sys import stdin, stdout

def INPUT():
	return list((int(i) for i in stdin.readline().split()))

def inp():
	return stdin.readline()

def out(x):
	return stdout.write(x)
import math
for _ in range(int(input())):
	s = input()
	A = list(s)
	r = 0
	s = 0
	p = 0
	for i in range(len(A)):
		if A[i] == 'R':
			r += 1
		elif A[i] == 'S':
			s += 1
		else:
			p += 1
	M = max(r, s, p)
	if M == r:
		ans = 'P' * len(A)
	elif M == s:
		ans = 'R' * len(A)
	else:
		ans = 'S' * len(A)
	print(ans)


import math, sys, bisect, heapq
from collections import defaultdict, Counter, deque
from itertools import groupby, accumulate
input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__
ilele = lambda : map(int, input().split())
alele = lambda : list(map(int, input().split()))

def Y(c):
	print(['NO', 'YES'][c])

def y(c):
	print(['no', 'yes'][c])

def Yy(c):
	print(['No', 'Yes'][c])
for _ in range(int(input())):
	S = input()
	Ans = ''
	n = len(S)
	C = Counter(S)
	i = C.most_common(1)[0][0]
	if i == 'R':
		Ans = 'P' * n
	elif i == 'S':
		Ans = 'R' * n
	else:
		Ans = 'S' * n
	print(Ans)


for _ in range(int(input())):
	s = input()
	an = ''
	dt = dict()
	dt['R'] = 'P'
	dt['P'] = 'S'
	dt['S'] = 'R'
	mx = 0
	for a in ['R', 'P', 'S']:
		if s.count(a) > mx:
			mx = s.count(a)
			an = dt[a]
	an *= len(s)
	print(an)


t = int(input())
for q in range(t):
	s = input()
	n = len(s)
	hs = [0, 0, 0]
	for i in range(n):
		if s[i] == 'R':
			hs[0] += 1
		elif s[i] == 'P':
			hs[1] += 1
		else:
			hs[2] += 1
	c = 'P'
	if hs[0] == max(hs):
		c = 'P'
	elif hs[1] == max(hs):
		c = 'S'
	else:
		c = 'R'
	for i in range(n):
		print(c, end='')
	print()


t = int(input())
for _ in range(t):
	s = input()
	c = max('RSP', key=s.count)
	response = {'R': 'P', 'P': 'S', 'S': 'R'}[c]
	print(len(s) * response)


def solve():
	s = input()
	ans = ''
	d = {}
	for i in s:
		d[i] = d.get(i, 0) + 1
	maxfreq = max(d.values())
	for i in d:
		if d[i] == maxfreq:
			ans = i
			break
	if ans == 'S':
		return 'R' * len(s)
	if ans == 'R':
		return 'P' * len(s)
	return 'S' * len(s)
	print(ans)
for _ in range(int(input())):
	ans = solve()
	print(ans)


t = int(input())
while t:
	n = input()
	(a, b, c) = (n.count('R'), n.count('P'), n.count('S'))
	d = max(a, b, c)
	if d == a:
		for x in range(len(n)):
			print('P', end='')
	elif d == b:
		for x in range(len(n)):
			print('S', end='')
	elif d == c:
		for x in range(len(n)):
			print('R', end='')
	print()
	t -= 1


t = int(input())
for i in range(t):
	rsp = list(input())
	rpsstring = ''
	rps = {'R': 'P', 'P': 'S', 'S': 'R'}
	rc = 0
	pc = 0
	sc = 0
	for k in rsp:
		if k == 'R':
			rc += 1
			continue
		elif k == 'P':
			pc += 1
			continue
		else:
			sc += 1
	if rc >= pc and rc >= sc:
		print('P' * (rc + pc + sc))
	elif pc > rc and pc >= sc:
		print('S' * (rc + pc + sc))
	elif sc > rc and sc > pc:
		print('R' * (rc + pc + sc))


for i in range(int(input())):
	a = input()
	if a.count('R') >= max(a.count('S'), a.count('P')):
		print('P' * len(a))
	elif a.count('S') >= max(a.count('R'), a.count('P')):
		print('R' * len(a))
	else:
		print('S' * len(a))


import sys

def solve(a):
	result = [' '] * len(a)
	(nr, np, ns) = (0, 0, 0)
	for played in a:
		if played == 'R':
			nr += 1
		elif played == 'P':
			np += 1
		elif played == 'S':
			ns += 1
	MX = 'R'
	if max(nr, np, ns) == np:
		MX = 'S'
	if max(nr, np, ns) == nr:
		MX = 'P'
	for i in range(len(a)):
		result[i] = MX
	return ''.join([str(x) for x in result])
IN = [x.strip() for x in sys.stdin.readlines()]
T = int(IN[0])
cur = 1
for ti in range(T):
	a = [x for x in IN[cur]]
	result = solve(a)
	print(result)
	cur += 1


from collections import Counter

def solve(a):
	mp = {'R': 'P', 'P': 'S', 'S': 'R'}
	mx = -1
	counter = Counter(a)
	for i in counter:
		if counter[i] > mx:
			ans = i
			mx = counter[i]
	print(mp[ans] * len(a))

def main():
	inp = lambda : [int(x) for x in input().split()]
	tc = int(input())
	for _ in range(tc):
		a = input()
		solve(a)
main()


t = int(input())
from collections import Counter
for i in range(t):
	s = list(input())
	x = Counter(s)
	key = 0
	maxi = 0
	for m in x:
		if x[m] > maxi:
			maxi = x[m]
			key = m
	if key == 'R':
		print('P' * len(s), end='')
	elif key == 'S':
		print('R' * len(s), end='')
	else:
		print('S' * len(s), end='')
	print()


t = int(input())
while t:
	t -= 1
	s = input()
	R = s.count('R')
	S = s.count('S')
	P = s.count('P')
	if R == max([R, S, P]):
		print('P' * len(s))
	elif S == max([R, S, P]):
		print('R' * len(s))
	else:
		print('S' * len(s))


def solve(s):
	ans = ''
	r = 'R' * len(s)
	S = 'S' * len(s)
	p = 'P' * len(s)
	(cnt1, cnt2, cnt3) = (s.count('R'), s.count('S'), s.count('P'))
	if cnt1 >= cnt2 and cnt1 >= cnt3:
		print(p)
	elif cnt2 >= cnt1 and cnt2 >= cnt3:
		print(r)
	else:
		print(S)

def main():
	t = int(input())
	for i in range(t):
		solve(input())
main()


import sys, math, cmath, time
start_time = time.time()

def solve():
	s = insr()
	q = s.count('R')
	w = s.count('P')
	qw = s.count('S')
	if q >= w and q >= qw:
		qq = 'P' * len(s)
	elif w >= q and w >= qw:
		qq = 'S' * len(s)
	else:
		qq = 'R' * len(s)
	print(qq)

def main():
	global tt
	if not ONLINE_JUDGE:
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	t = 1
	t = inp()
	for tt in range(t):
		solve()
	if not ONLINE_JUDGE:
		print('Time Elapsed :', time.time() - start_time, 'seconds')
		sys.stdout.close()

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	return input().strip()

def invr():
	return map(int, input().split())

def counter(a, qw):
	q = [0] * qw
	for i in range(len(a)):
		q[a[i] - 1] = q[a[i] - 1] + 1
	return q

def counter_elements(a):
	q = dict()
	for i in range(len(a)):
		if a[i] not in q:
			q[a[i]] = 0
		q[a[i]] = q[a[i]] + 1
	return q

def string_counter(a):
	q = [0] * 26
	for i in range(len(a)):
		q[ord(a[i]) - 97] = (q[ord(a[i]) - 97], 1)
	return q

def factors(n):
	q = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			q.append(i)
			q.append(n // i)
	return list(sorted(list(set(q))))

def prime_factors(n):
	q = []
	while n % 2 == 0:
		q.append(2)
		n = n // 2
	for i in range(3, int(n ** 0.5) + 1, 2):
		while n % i == 0:
			q.append(i)
			n = n // i
	if n > 2:
		q.append(n)
	return list(sorted(q))

def transpose(a):
	(n, m) = (len(a), len(a[0]))
	b = [[0] * n for i in range(m)]
	for i in range(m):
		for j in range(n):
			b[i][j] = a[j][i]
	return b
ONLINE_JUDGE = __debug__
if ONLINE_JUDGE:
	input = sys.stdin.readline
main()


from collections import Counter
n = int(input())
for case in range(n):
	game = [s for s in input()]
	counter_g = Counter(game)
	r_qtt = counter_g['R']
	p_qtt = counter_g['P']
	s_qtt = counter_g['S']
	if r_qtt >= p_qtt and r_qtt >= s_qtt:
		print('P' * len(game))
	elif p_qtt >= s_qtt and p_qtt >= r_qtt:
		print('S' * len(game))
	elif s_qtt >= p_qtt and s_qtt >= r_qtt:
		print('R' * len(game))


import math
from collections import deque
import sys
sys.setrecursionlimit(10 ** 4)

def Divisors(n):
	l = []
	i = 2
	while i <= math.sqrt(n):
		if n % i == 0:
			if n // i == i:
				l.append(i)
			else:
				l.append(i)
				l.append(n // i)
		i = i + 1
	return l

def SieveOfEratosthenes(n):
	l = []
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	for p in range(2, n + 1):
		if prime[p]:
			l.append(p)
	return l

def primeFactors(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			l.append(i)
			n = n / i
	if n > 2:
		l.append(n)
	return l

def Factors(n):
	result = []
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0:
			if i == n / i:
				result.append(i)
			else:
				result.append(i)
				result.append(n // i)
	result.append(1)
	return result

def maxSubArraySum(a):
	max_so_far = 0
	max_ending_here = 0
	size = len(a)
	for i in range(0, size):
		max_ending_here = max_ending_here + a[i]
		if max_so_far < abs(max_ending_here):
			max_so_far = max_ending_here
	return max_so_far

def longestsubarray(arr, n, k):
	current_count = 0
	max_count = 0
	for i in range(0, n, 1):
		if arr[i] % k != 0:
			current_count += 1
		else:
			current_count = 0
		max_count = max(current_count, max_count)
	return max_count

def main():
	s = input()
	n = len(s)
	s1 = ''
	c1 = 0
	c2 = 0
	c3 = 0
	for i in range(0, len(s)):
		if s[i] == 'R':
			c1 += 1
		if s[i] == 'S':
			c2 += 1
		if s[i] == 'P':
			c3 += 1
	if c1 >= c2 and c1 >= c3:
		for i in range(0, n):
			print('P', end='')
		print()
	elif c2 >= c1 and c2 >= c3:
		for i in range(0, n):
			print('R', end='')
		print()
	else:
		for i in range(0, n):
			print('S', end='')
		print()
t = int(input())
for i in range(0, t):
	main()


t = input()
for i in range(int(t)):
	string = input()
	frequency = [0, 0, 0]
	for j in string:
		if j == 'R':
			frequency[0] += 1
		elif j == 'S':
			frequency[1] += 1
		elif j == 'P':
			frequency[2] += 1
	a = max(frequency)
	if frequency.index(a) == 0:
		print('P' * len(string))
	elif frequency.index(a) == 1:
		print('R' * len(string))
	elif frequency.index(a) == 2:
		print('S' * len(string))


t = int(input())
from collections import Counter
for _ in range(t):
	s = list(str(input()))
	C = Counter(s)
	X = list(C.items())
	X.sort(key=lambda x: -x[1])
	if X[0][0] == 'R':
		ans = 'P' * len(s)
	elif X[0][0] == 'S':
		ans = 'R' * len(s)
	else:
		ans = 'S' * len(s)
	print(ans)


for _ in range(int(input())):
	s = input()
	rs = s.count('R')
	ps = s.count('P')
	ss = s.count('S')
	if rs >= ps and rs >= ss:
		print('P' * len(s))
	elif ps >= rs and ps >= ss:
		print('S' * len(s))
	else:
		print('R' * len(s))


for i in range(int(input())):
	st = input()
	n = len(st)
	(r, p, s) = (st.count('R'), st.count('P'), st.count('S'))
	if max(r, p, s) == r:
		print('P' * n)
	elif max(r, p, s) == p:
		print('S' * n)
	else:
		print('R' * n)


import math
t = int(input())
for _ in range(t):
	s = input()
	n = len(s)
	r = s.count('R')
	p = s.count('P')
	s = s.count('S')
	m = max(r, s, p)
	if r == m:
		ans = 'P' * n
	elif s == m:
		ans = 'R' * n
	elif p == m:
		ans = 'S' * n
	print(ans)


T = int(input())
for t in range(T):
	s = input()
	RPS = [0, 0, 0]
	for c in s:
		if c == 'R':
			RPS[0] += 1
		elif c == 'P':
			RPS[1] += 1
		else:
			RPS[2] += 1
	max_i = RPS.index(max(RPS))
	if max_i == 0:
		print(''.join(['P' for x in range(len(s))]))
	elif max_i == 1:
		print(''.join(['S' for x in range(len(s))]))
	else:
		print(''.join(['R' for x in range(len(s))]))


t = int(input())
while t:
	s = input()
	count1 = 0
	count2 = 0
	count3 = 0
	for i in s:
		if i == 'R':
			count1 = count1 + 1
		elif i == 'S':
			count2 = count2 + 1
		else:
			count3 = count3 + 1
	if max(count1, count2, count3) == count1:
		print('P' * len(s))
	elif max(count1, count2, count3) == count2:
		print('R' * len(s))
	else:
		print('S' * len(s))
	t = t - 1


class Main:

	def main(self):
		t = int(input())
		for t1 in range(0, t):
			s = input()
			c1 = s.count('R')
			c2 = s.count('S')
			c3 = s.count('P')
			if max(c1, c2, c3) == c1:
				print('P' * len(s))
			elif max(c1, c2, c3) == c2:
				print('R' * len(s))
			else:
				print('S' * len(s))
Main().main()


t = int(input())
while t > 0:
	t = t - 1
	s = input()
	n = len(s)
	x = s.count('R')
	y = s.count('P')
	z = s.count('S')
	if x >= y and x >= z:
		c = 'P' * n
	elif y >= x and y >= z:
		c = 'S' * n
	elif z >= y and z >= x:
		c = 'R' * n
	print(c)


t = int(input())
for _ in range(t):
	r = 0
	s = 0
	p = 0
	pro = input()
	for i in range(len(pro)):
		if pro[i] == 'R':
			r = r + 1
		elif pro[i] == 'S':
			s = s + 1
		else:
			p = p + 1
	max_ = max(r, s, p)
	if max_ == r:
		print('P' * len(pro))
	elif max_ == s:
		print('R' * len(pro))
	else:
		print('S' * len(pro))


import sys
input = sys.stdin.readline
import heapq
import copy
import math
import decimal

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def insr2():
	s = input()
	return s[:len(s) - 1]

def invr():
	return map(int, input().split())

def pr_list(a):
	print(*a, sep=' ')

def main():
	tests = inp()
	mod = 1000000007
	limit = 10 ** 18
	ans = 0
	stack = []
	hashm = {}
	arr = []
	heapq.heapify(arr)
	for test in range(tests):
		s = insr()
		R = 'R'
		S = 'S'
		P = 'P'
		ans = ''
		rock = 0
		paper = 0
		sis = 0
		for i in s:
			if i == R:
				rock = rock + 1
			elif i == P:
				paper = paper + 1
			elif i == S:
				sis = sis + 1
		if max(sis, paper, rock) == rock:
			ans = P * len(s)
		elif max(sis, paper, rock) == paper:
			ans = S * len(s)
		else:
			ans = R * len(s)
		print(ans)
main()


t = int(input())
for i in range(t):
	s = input()
	b = []
	for j in s:
		b.append(j)
	n = len(b)
	x = b.count('R')
	y = b.count('P')
	z = b.count('S')
	m = max(x, y, z)
	if x == m:
		res = ['P'] * n
	elif y == m:
		res = ['S'] * n
	elif z == m:
		res = ['R'] * n
	print(''.join(res))


import collections
t = input()
t = int(t)
for i in range(t):
	s = input()
	s_i = collections.Counter(s).most_common(1)[0][0]
	if s_i == 'R':
		print('P' * len(s))
	if s_i == 'S':
		print('R' * len(s))
	if s_i == 'P':
		print('S' * len(s))


from sys import stdin
t = int(stdin.readline().strip())
for i in range(t):
	S = list(stdin.readline().strip())
	r = len([c for c in S if c == 'R'])
	s = len([c for c in S if c == 'S'])
	p = len([c for c in S if c == 'P'])
	if r == max(r, s, p):
		print('P' * len(S))
	elif s == max(r, s, p):
		print('R' * len(S))
	elif p == max(r, s, p):
		print('S' * len(S))


import os, io
from sys import stdout
import collections
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
import sys

def primes(n):
	sieve = [True] * n
	for i in range(3, int(n ** 0.5) + 1, 2):
		if sieve[i]:
			sieve[i * i::2 * i] = [False] * ((n - i * i - 1) // (2 * i) + 1)
	return [2] + [i for i in range(3, n, 2) if sieve[i]]

def binomial_coefficient(n, k):
	if 0 <= k <= n:
		ntok = 1
		ktok = 1
		for t in range(1, min(k, n - k) + 1):
			ntok *= n
			ktok *= t
			n -= 1
		return ntok // ktok
	else:
		return 0

def powerOfK(k, max):
	if k == 1:
		return [1]
	if k == -1:
		return [-1, 1]
	result = []
	n = 1
	while n <= max:
		result.append(n)
		n *= k
	return result

def divisors(n):
	i = 1
	result = []
	while i * i <= n:
		if n % i == 0:
			if n / i == i:
				result.append(i)
			else:
				result.append(i)
				result.append(n / i)
		i += 1
	return result

def distance(xa, ya, xb, yb):
	return ((ya - yb) ** 2 + (xa - xb) ** 2) ** 0.5

def digitsSum(n):
	if n == 0:
		return 0
	r = 0
	while n > 0:
		r += n % 10
		n //= 10
	return r

def isValid(i, j, n, m):
	return i >= 0 and i < n and (j >= 0) and (j < m)

def print_grid(grid):
	for line in grid:
		print(' '.join(map(str, line)))

def kadane(a, size):
	max_so_far = 0
	max_ending_here = 0
	for i in range(0, size):
		max_ending_here = max_ending_here + a[i]
		if max_so_far < max_ending_here:
			max_so_far = max_ending_here
		if max_ending_here < 0:
			max_ending_here = 0
	return max_so_far

def prefixSum(arr):
	for i in range(1, len(arr)):
		arr[i] = arr[i] + arr[i - 1]
	return arr

def ceil(n, d):
	if n % d == 0:
		return n // d
	else:
		return n // d + 1

def _abs(a, b):
	return int(abs(a - b))

def evenodd(l):
	even = [e for e in l if e & 1 == 0]
	odd = [e for e in l if e & 1]
	return (even, odd)
from collections import Counter
t = int(input())
map = {'R': 'P', 'P': 'S', 'S': 'R'}
for _ in range(t):
	s = input().decode('utf-8').strip()
	c = Counter(s)
	m = c.most_common()[0][0]
	print(map[m] * len(s))


import bisect
import copy
import fractions
import heapq
import math
import random
import sys
T = int(input())
for t in range(T):
	moves = input()
	cipher = {'R': 'P', 'P': 'S', 'S': 'R'}
	counts = {}
	for ch in moves:
		if ch not in counts:
			counts[ch] = 0
		counts[ch] += 1
	print(cipher[max(counts.items(), key=lambda x: x[1])[0]] * len(moves))


from collections import defaultdict
for _ in range(int(input())):
	s = input()
	mp = defaultdict(int)
	for x in s:
		mp[x] += 1
	n = len(s)
	ans = ''
	mex = -1
	for i in mp:
		mex = max(mp[i], mex)
	if mp['R'] == mex:
		print('P' * n)
	elif mp['S'] == mex:
		print('R' * n)
	else:
		print('S' * n)


for i in range(int(input())):
	n = input()
	a = n.count('R')
	b = n.count('S')
	c = n.count('P')
	l = len(n)
	print((a >= b and a >= c) * l * 'P' + (b >= c and b > a) * l * 'R' + (c > a and c > b) * l * 'S')


import os
import sys
from math import *
from collections import *
from fractions import *
from bisect import *
from heapq import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def value():
	return tuple(map(int, input().split()))

def array():
	return [int(i) for i in input().split()]

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]
for _ in range(Int()):
	s = input()
	win = {'R': 'P', 'P': 'S', 'S': 'R'}
	C = Counter(s)
	count = max(C.values())
	for i in C:
		if C[i] == count:
			ans = win[i]
			break
	print(ans * len(s))


for test_case in range(int(input())):
	string = input()
	ans = ''
	r = 0
	p = 0
	s = 0
	for x in string:
		if x == 'R':
			r += 1
		elif x == 'P':
			p += 1
		else:
			s += 1
	arr = [r, p, s]
	arr2 = ['P', 'S', 'R']
	ans = arr2[arr.index(max(arr))]
	ans = ans * len(string)
	print(ans)


import io
import os
from collections import Counter, defaultdict, deque

def solve(S):
	freq = Counter(S)
	opposite = {'R': 'P', 'P': 'S', 'S': 'R'}
	best = max(freq.keys(), key=lambda k: freq[k])
	N = len(S)
	return opposite[best] * N
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
T = int(input())
for t in range(T):
	S = input().decode().rstrip()
	ans = solve(S)
	print(ans)


from __future__ import division, print_function
import itertools, os, sys, threading
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from math import sqrt, floor, factorial, gcd, log
from collections import deque, Counter, defaultdict
from itertools import permutations, combinations
from math import gcd
from bisect import bisect
from random import randrange
input = lambda : sys.stdin.readline().rstrip('\r\n')
read = lambda : list(map(int, input().strip().split(' ')))

def main():
	for _ in range(int(input())):
		t = input()
		ans = ''
		dic = {'R': 'P', 'P': 'S', 'S': 'R'}
		c = Counter(t)
		s = c.most_common()[0][0]
		print(dic[s] * len(t))
main()


import sys
input = lambda : sys.stdin.readline()
int_arr = lambda : list(map(int, input().split()))
str_arr = lambda : list(map(str, input().split()))
get_str = lambda : map(str, input().split())
get_int = lambda : map(int, input().split())
get_flo = lambda : map(float, input().split())
mod = 1000000007

def solve(s):
	d = {'R': 'P', 'S': 'R', 'P': 'S'}
	(rr, ss, pp) = (0, 0, 0)
	for i in s:
		if i == 'R':
			rr += 1
		if i == 'S':
			ss += 1
		if i == 'P':
			pp += 1
	maxx = max(rr, ss, pp)
	if rr == maxx:
		print(d['R'] * len(s))
	elif ss == maxx:
		print(d['S'] * len(s))
	elif pp == maxx:
		print(d['P'] * len(s))
for _ in range(int(input())):
	s = str(input())[:-1]
	solve(s)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from itertools import permutations
from collections import *
from collections import deque
from operator import itemgetter, attrgetter
from decimal import *
import bisect
import math
import heapq as hq
MOD = 10 ** 9 + 7

def is_prime(n):
	if n == 2 or n == 3:
		return True
	if n < 2 or n % 2 == 0:
		return False
	if n < 9:
		return True
	if n % 3 == 0:
		return False
	r = int(n ** 0.5)
	f = 5
	while f <= r:
		if n % f == 0:
			return False
		if n % (f + 2) == 0:
			return False
		f += 6
	return True

def pow(a, b, m):
	ans = 1
	while b:
		if b & 1:
			ans = ans * a % m
		b //= 2
		a = a * a % m
	return ans

def ispalindrome(s):
	if s[:] == s[::-1]:
		return 1
	return 0
dp = []
limit = []
v = []

def dpdfs(u, t=-1):
	dp[0][u] = 0
	dp[1][u] = 0
	for i in v[u]:
		if i == t:
			continue
		if dp[1][i] == -1:
			dpdfs(i, u)
		dp[0][u] += max(abs(limit[0][u] - limit[1][i]) + dp[1][i], abs(limit[0][u] - limit[0][i]) + dp[0][i])
		dp[1][u] += max(abs(limit[1][u] - limit[1][i]) + dp[1][i], abs(limit[1][u] - limit[0][i]) + dp[0][i])
vis = []
f = 0

def dfs(i):
	vis[i] = 1
	act[i] = 1
	for j in v[i]:
		if act[j]:
			f = 1
			return -1
		if vis[j] == 0:
			if dfs(j) == -1:
				return -1
	act[i] = 0
	ans.append(i)
	return 0
from queue import PriorityQueue

def z_algorithm(s):
	res = [0] * len(s)
	res[0] = len(s)
	(i, j) = (1, 0)
	while i < len(s):
		while i + j < len(s) and s[j] == s[i + j]:
			j += 1
		res[i] = j
		if j == 0:
			i += 1
			continue
		k = 1
		while i + k < len(s) and k + res[k] < j:
			res[i + k] = res[k]
			k += 1
		(i, j) = (i + k, j - k)
	return res

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def lcm(a, b):
	return a / gcd(a, b) * b

def gcdExtended(a, b):
	if a == 0:
		return (b, 0, 1)
	(gcd, x1, y1) = gcdExtended(b % a, a)
	x = y1 - b // a * x1
	y = x1
	return (gcd, x, y)
import re
for _ in range(int(input())):
	cntP = 0
	cntR = 0
	cntS = 0
	s = input()
	l = []
	for i in s:
		if i == 'P':
			cntS += 1
		elif i == 'R':
			cntP += 1
		else:
			cntR += 1
	if cntP >= max(cntR, cntS):
		print(len(s) * 'P')
	elif cntS >= max(cntP, cntR):
		print(len(s) * 'S')
	else:
		print(len(s) * 'R')


from sys import stdin
for _ in range(int(input())):
	l = input()
	r = l.count('R')
	s = l.count('S')
	p = l.count('P')
	if r == max(r, s, p):
		print('P' * len(l))
	elif s == max(r, s, p):
		print('R' * len(l))
	else:
		print('S' * len(l))


for t in range(int(input())):
	a = input()
	r = 0
	s = 0
	p = 0
	for c in a:
		if c == 'R':
			r += 1
		if c == 'S':
			s += 1
		if c == 'P':
			p += 1
	if s <= r >= p:
		print('P' * len(a))
	elif s <= p >= r:
		print('S' * len(a))
	else:
		print('R' * len(a))