/** @BY_KUTBILIM **/
#include <bits/stdc++.h>
using namespace std;

#define ff first
#define ss second
#define pb push_back

using ll = long long;
using ld = long double;

const long double pi = acos((ld) - 1.0);
const double eps = (double)1e-9;
const int inf = 1e9 + 7;

int main(){
   
   int n;
   cin >> n;
   string s;
   cin >> s;
   int q;
   cin >> q;
   int t[q], a[q], b[q];
   for(int i = 0; i < q; i++){
      cin >> t[i] >> a[i] >> b[i];
      a[i]--, b[i]--;
   }
   int ch_at[2*n];
   int cnt = 0;
   for(int i = 0; i < 2*n; i++)ch_at[i] = i;
   for(int i = 0; i < q; i++){
      if(t[i] == 2){
         cnt++;
         cnt %= 2;
      } else{
         if(cnt){
            if(a[i] < n)a[i] += n;
            else a[i] -= n;
            if(b[i] < n)b[i] += n;
            else b[i] -= n;
         }
         swap(ch_at[a[i]], ch_at[b[i]]);
      }
      
   }
   if(cnt){
      for(int i = 0; i < 2 * n; i++){
         if(i < n)cout << s[ch_at[i+n]];
         else cout << s[ch_at[i-n]];
      }
   } else{
      for(int i = 0; i < 2*n; i++){
         cout << s[ch_at[i]];
      }
   }
   return 0;
}

const int fastio=[](){
   ios::sync_with_stdio(false);
   cin.tie(nullptr); cout.tie(nullptr);
   return 0;
}();
///////////////////////////////
////ACくれなきゃ悪戯しちゃうぞ!////
///////////////////////////////
//include
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath> 
#include <iomanip>
#include <math.h>
#include <utility>
#include <functional>
#include <cstdlib>
#include <map>
#include <utility>
#include <set>
#include <deque>
//using
using namespace std;
using vi = vector <int>;
using vl = vector <long long>;
using vs = vector <string>;
using vc = vector <char>;
using ll= long long;
using vvl = vector<vector<ll> >;
using vvc = vector<vector<char> >;
using vd = vector <double>;
using vpl = vector <pair<ll,ll> >;
//define
#define rep(i,r) for(ll i=0;i<(r);i++)
#define Rep(i,l,r) for(ll i=(l);i<(r);i++)
#define print(n) cout<<n<<endl;
#define sortp(d) sort(d.begin(),d.end()) //1234
#define sortm(d) sort(d.rbegin(),d.rend()) //4321
#define all(n) n.begin(),n.end()
//素数判定　O(√A) 
bool is_prime(ll x){
 if(x<=1) return false;
 for(int i=2;i*i<=x;i++)
 if(x%i==0) return false;
 return true;
 }
 //各位の和　
int wa(ll x)
{
ll sum = 0;
while(x!=0){
  sum += x% 10;
  x /= 10;
}
return sum;
}
/*順列生成
do {
  // 順列に対する処理
} while (next_permutation(配列変数.begin(), 配列変数.end()));*/
//最大公約数　ユークリッドの互除法
ll gcd(ll a, ll b) {
    if (b==0) return a;
    else return gcd(b, a%b);
}
//最小公倍数　a*b/gcd
ll lcm(ll a, ll b) {
    return a/gcd(a, b)*b;
}
//10進→２進
ll binary(ll bina){
    ll ans = 0;
    for (ll i = 0; bina>0 ; i++)
    {
        ans = ans+(bina%2)*pow(10,i);
        bina = bina/2;
    }
    return ans;
}
//'A'65,'a'97
//reverse 回文
/*for(const auto& [x,y]:m)    mapの範囲for
  {
    q+=y*(y-1)/2;
  }*/
/*小数点精度指定
cout<<fixed<<setprecision(9)<<;
*/
//文字列の削除 erase(n)

//グローバル変数宣言等
ll p=0,q=0,r=0;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
#define inf 1000000000000 //10^12:∞
#define mod 1000000007 //10^9+7:合同式の法
char ja(char a,char b)
{
  if ((a=='R'&&b=='S')||(b=='R'&&a=='S')||(a=='R'&&b=='R'))
  {
    return 'R';
  }
  if ((a=='P'&&b=='S')||(b=='P'&&a=='S')||(a=='S'&&b=='S'))
  {
    return 'S';
  }
  if ((a=='R'&&b=='P')||(b=='R'&&a=='P')||(a=='P'&&b=='P'))
  {
    return 'P';
  }
}
int main()
{ 
  ll n,k;cin>>n>>k;
  string t;cin>>t;
  vs s(k+1);
  s[0]=t;
  r=inf;
  rep(j,k)
  {
    p=j+1;
    if((k-j)<=6)r=pow(2,(k-j));
    if(n%2==1)q=n*2;else q=n;
    for (int i = 0; i < q; i+=2)
    {
      char a=s[j][i%n],b=s[j][(i+1)%n];
      s[p]+=ja(a,b);
    }
    n=s[p].size();
  }
  print(s[k][0]);
}