#include<bits/stdc++.h>
#define int long long
#define pii pair<int,int>
#define S second
#define F first
using namespace std;
int n,q,t,a,b,k,p[400005];
string s;
signed main(){
    ios::sync_with_stdio(0),cin.tie(0);
    cin>>n>>s>>q;
    for(int i=0;i<2*n;i++)p[i]=i;
    while(q--){
        cin>>t>>a>>b;
        a--;
        b--;
        if(t==1){
            swap(p[(a+k)%(2*n)],p[(b+k)%(2*n)]);
        }
        else{
            k=(k+n)%(2*n);
        }
    }
    for(int i=0;i<2*n;i++)cout<<s[p[(i+k)%(2*n)]];
}

#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(obj) (obj).begin(), (obj).end()
typedef long long ll;
template <class T = ll>
T in() {
  T x;
  cin >> x;
  return (x);
}

int main() {
  int Ans = 0;
  ll N = in<ll>();
  string S = in<string>();
  ll Q = in<ll>();
  vector<int> T(Q);
  vector<ll> A(Q);
  vector<ll> B(Q);
  REP(i, Q) {
    cin >> T[i];
    cin >> A[i];
    cin >> B[i];
    if (i > 0) {
      if ((T[i - 1] == 2) && (T[i] == 2)) {
        T[i] = 0;
        T[i - 1] = 0;
      }
    }
  }

  REP(i, Q) {
    if (T[i] == 1) {
      swap(S[A[i]-1], S[B[i]-1]);
    } else if (T[i] == 2) {
      S = S.substr(N) + S.substr(0, N);
    }
  }
  cout << S << endl;
  return 0;
}
