#include <bits/stdc++.h>

#define ll long long
#define ld long double
using namespace std;

const int N = 100 + 5;

int mod, k, dp[N][N], a[N];
string s;

int add(int a, int b){
    return (a + b) % mod;
}

int mul(int a, int b){
    return 1ll * a * b % mod;
}

int fp(int b, int p){
    if(p == 0) return 1;
    int ret = fp(b, p >> 1);
    ret = mul(ret, ret);
    if(p & 1) ret = mul(ret, b);
    return ret;
}

int beats(int a, int b){
    if(a == b) return a;
    if((a + 1) % 3 == b) return b;
    return a;
}

int solve(int idx, int k){
    if(k == 0) return a[idx];
    if(dp[idx][k] != -1) return dp[idx][k];

    int l = solve(idx, k - 1);
    int r = solve(add(idx, fp(2, k - 1)), k - 1);

    return dp[idx][k] = beats(l, r);
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin >> mod >> k >> s;
    for(int i = 0; i < mod; i++){
        if(s[i] == 'P') a[i] = 1;
        else if(s[i] == 'S') a[i] = 2;
    }
    memset(dp, -1, sizeof dp);
    int ans = solve(0, k);
    if(ans == 0) cout << 'R';
    else if(ans == 1) cout << 'P';
    else cout << 'S';

    return 0;
}




    #include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define MOD 1000000007ll 
#define pb push_back
#define vl vector<ll>
#define pll pair<ll,ll>
#define mp make_pair
using namespace std;
#define pi (long double)3.14159265358979323846 
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
 struct sch{
  ll s,e,t;
};
bool sortinrev(const struct sch &a, const struct sch &b) 
{ 
    return (a.s < b.s); 
}
ll gcd(ll a, ll b) 
{ 
    if (b == 0) 
        return a; 
    return gcd(b, a % b);  
      
}
ll lcm(ll a,ll b)
{
  return a*b/gcd(a,b);
}
ll power(ll x, ll y, ll p) 
{ 
    ll res = 1; 
    x = x % p;  
    while (y > 0) 
    {
        if (y & 1) 
            res = (res*x) % p; 
        y = y>>1; // y = y/2 
        x = (x*x) % p; 
    } 
    return res; 
}
int main()
{
    ll n,k;
    cin>>n>>k;
    string s;
    cin>>s;
    while(k--)
    {
        s = s+s;
        string tmp = "";
        for(int i=0;i<s.size();i+=2)
        {
            if((s[i]=='R' && s[i+1]=='P') || (s[i]=='P' && s[i+1]=='R'))
            {
                tmp += 'P';
            }
            else if((s[i]=='R' && s[i+1]=='S') || (s[i]=='S' && s[i+1]=='R'))
            {
                tmp += 'R';
            }
            else if((s[i]=='S' && s[i+1]=='P') || (s[i]=='P' && s[i+1]=='S'))
            {
                tmp += 'S';
            }
            else
            {
                tmp += s[i];
            }
        }
        s = tmp;
    }
    cout<<s[0]<<endl;
}