------
## 最终结论
```python
def maximize_wins(t, test_cases):
    results = []
    for s in test_cases:
        count_R = s.count('R')
        count_S = s.count('S')
        count_P = s.count('P')

        # Determine the best strategy
        if count_R >= count_S and count_R >= count_P:
            # Bot plays R most often, we should play P
            results.append('P' * len(s))
        elif count_S >= count_R and count_S >= count_P:
            # Bot plays S most often, we should play R
            results.append('R' * len(s))
        else:
            # Bot plays P most often, we should play S
            results.append('S' * len(s))
    
    return results

# Read input
t = int(input().strip())
test_cases = [input().strip() for _ in range(t)]

# Get results
results = maximize_wins(t, test_cases)

# Print results
for result in results:
    print(result)
```