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

#define fr(i,n) for(int i = 0; i<n; i++)
#define sz(v) (int)(v.size())
#define prin(a) cout << #a << " = " << a << endl
#define prinv(v) cout << #v << " = "; for(auto it : v) cout << it << ", "; cout << endl
#define all(v) (v).begin(),(v).end()

typedef long long ll;

#define rmin(a,b) a = min<ll>(a,b)
#define rmax(a,b) a = max<ll>(a,b)

#define fi first
#define se second

int main(){
	ios::sync_with_stdio(0); cin.tie(0);
	int n; cin >> n;
	string s; cin >> s;
	int q; cin >> q;
	bool is_flip = 0;
	fr(qq,q){
		int t, a, b; cin >> t >> a >> b;
		a--,b--;
		
		if(t==1){
			if(is_flip){
				if(a<n) a+=n;
				else a-=n;
				
				if(b<n) b+=n;
				else b-=n;
			}
			swap(s[a],s[b]);
		} else{
			is_flip = !is_flip;
		}
	}
	
	int i = 0;
	if(is_flip) i = n;
	fr(cnt,2*n){
		cout << s[i++];
		if(i==sz(s)) i = 0;
	}
	cout << "\n";
}
#include <bits/stdc++.h>
using namespace std;

int main() {
  int N, Q;
  string S, S1, S2;
  cin>>N>>S>>Q;
  vector <int> T (Q+1);
  vector <int> A (Q);
  vector <int> B (Q); 
  
  for (int i=0; i<Q; i++)
    cin>>T.at(i)>>A.at(i)>>B.at(i);
  
  T.at(Q)=1;
  
  for (int i=0; i<Q; i++){
    
    if (T.at(i)==1)
      swap(S.at(A.at(i)-1), S.at(B.at(i)-1));
    else if (T.at(i)==2 && T.at(i+1)==2)
      i+=1;
    else{
      S=S.substr(N, N)+S.substr(0, N);
    }
  }
  
  cout<<S;
}  
  
  