//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("O2")
//#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")
////
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
#include <bits/stdc++.h>

#define all(x) (x).begin(), (x).end()
#define allp(x) (x)->begin(), (x)->end()

#define pb push_back


using namespace std;
void dout() { cerr << endl; }
//typedef long long ll;
template <typename Head, typename... Tail>
void dout(Head H, Tail... T) {
    cerr << H << ' ';
    dout(T...);
}

using ll = long long;
//#ifdef __int128
//using hll = __int128;
//#endif
using pii = pair<ll, ll>;
using ld = long double;

template <typename T>
void do_uniq(vector<T> &vec){
    sort(all(vec));
    vec.resize(unique(all(vec)) - vec.begin());
}

#ifndef ONLINE_JUDGE

clock_t timestamp_start = clock();
void time_calc()
{
    cerr << (ld)(clock() - timestamp_start) / CLOCKS_PER_SEC << "\n";
}
#endif


#ifdef _getchar_nolock
#else
#    define _getchar_nolock getchar_unlocked
#endif

#define integer int

integer mod = 1e9 + 7;

integer ml(integer a, integer b) {
    return (a * 1ll * b) % mod;
}

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

integer sub(integer a, integer b) {
    return add(a, mod - b);
}

integer sq(integer a) {
    return ml(a, a);
}

integer b_p(integer b, integer p) {
    if (p == 0) return 1;
    if (p & 1) return ml(b, b_p(b, p - 1));
    return sq(b_p(b, p >> 1));
}

#define solvsh
//#define multi


#ifdef solvsh

void precalc() {
}

const int MAXN = 112;

int getbg(int k) {
    if (k > 30) return 1e9;
    return 1 << k;
}

char getwin(char l, char r) {
    if (l == 'R') {
        if (r == 'S') return l;
        return r;
    } else if (l == 'P') {
        if (r == 'R') return l;
        return r;
    } else {
        if (r == 'P') return l;
        return r;
    }
}

void solve() {

    int n, k;
    cin >> n >> k;

    string s;
    cin >> s;
    while (k) {

        string news = "";

        if (s.size() % 2 == 1) {
            s = s + s;
        }

        for (int i = 0; i < s.size(); i += 2) {
            news += getwin(s[i], s[i + 1]);
        }

        --k;
        int lenn = getbg(k);

        while (news.size() > lenn) news.pop_back();

        s = news;
    }


    cout << s << "\n";

}

#else

#endif

void multisolve() {
//    precalc();
    int t;

    cin >> t;

    int i = 1;
    while (t--) {
        solve();
        i++;
    }
}

#ifndef ONLINE_JUDGE

void gen() {

    int n = 2000;
    cout << n << "\n";
    for (int i = 0; i < n; ++i) {

        for (int j = 0; j < n; ++j) {
            if (i == 0 && j == 0) {
                cout << "S";
                continue;
            }
            if (i == n - 1 && j == n  - 1) {
                cout << "G";
                continue;
            }

            cout << char('a' + (rand() % 26)) << "";
        }
        cout << "\n";
    }
}


#endif

#define int int
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr), cout.tie(nullptr);
    cout << fixed << setprecision(20);

#ifdef multi
    //            gen();
        multisolve();
#else

    solve();
//    gen();
#endif
//     time_calc();
}

#include <bits/stdc++.h>
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;

char win(char a,char b){
    if (a == 'R' && b == 'P') return b;
    if (a == 'P' && b == 'S') return b;
    if (a == 'S' && b == 'R') return b;
    else return a;
}
int main(){
    int n,k;
    cin >> n >> k;
    string s;
    cin >> s;
    while(k--){
        s += s;
        string t;
        for(int i = 0;i<2*n;i+= 2){
            t += win(s[i],s[i+1]);
        }
        s = t;
    }
    cout << s[0] << endl;

    }
