// Fearless
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define pii pair <int, int>
#define pll pair <long long, long long>
#define PI (2.0 * acos(0.0))
#define testcase ll T; cin >> T; for (ll tc = 1; tc <= T; tc++)
const long long M = 1e5 + 10, M2 = 1e6 + 10, oo = 1e9 + 7;
int k, n;
string s;
int ara[30][30], ln;
int bigmod (int n, int p) {
	if (p == 0) return 1;
	int ans = bigmod(n, p / 2);
	ans = (ans * ans) % ln;
	if (p % 2 == 1) ans = (ans * n) % ln;
	return ans;
}
char dp[102][102];
char get (int pos, int sz) {
	//cout << pos << " " << sz << endl;
	if (dp[pos][sz] != '?') return dp[pos][sz];
	if (sz == 0) {
		return s[pos];
	}
	char c1, c2;
	int mpos = (pos + bigmod(2, sz - 1)) % n;
	c1 = get(pos, sz - 1);
	c2 = get(mpos, sz - 1); 
	if (c1 == c2) return dp[pos][sz] = c1;
	return dp[pos][sz] = ara[min(c1 - 'A', c2 - 'A')][max(c1 - 'A', c2 - 'A')] + 'A';
}
void solve () {
	cin >> n >> k >> s;
	ln = n;
	ara['R' - 'A']['S' - 'A'] = 'R' - 'A'; 
	ara['P' - 'A']['R' - 'A'] = 'P' - 'A';
	ara['P' - 'A']['S' - 'A'] = 'S' - 'A';
	for (int i = 0; i <= 100; i++) {
		for (int j = 0; j <= 100; j++) dp[i][j] = '?';
	}
	cout << get(0, k) << endl;
}
int main () {
    //freopen("E:/newts/in.txt", "r", stdin);
    //freopen("E:/newts/out.txt", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //testcase {
        solve ();
    //}
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
char w[88][88];
int n,k;
string s;
int main(){
	cin>>n>>k>>s;
	w['R']['R']=w['R']['S']=w['S']['R']='R';
	w['S']['S']=w['P']['S']=w['S']['P']='S';
	w['P']['P']=w['P']['R']=w['R']['P']='P';
	while(k--){
		string ss=s+s;
		for(int i=0;i<n;i++){
			s[i]=w[ss[2*i]][ss[2*i+1]];
		}
	}
	cout<<s[0]<<endl;
	return 0;
}