#include <iostream>
#include <string>
#include <vector>

struct Query {
  int T;
  int A;
  int B;
};

std::istream& operator>>(std::istream& is, Query& q) {
  return std::cin >> q.T >> q.A >> q.B;
}

int main() {
  int N;
  std::cin >> N;

  std::string S;
  std::cin >> S;

  int Q;
  std::cin >> Q;

  std::vector<Query> queries(Q);
  for (auto&& q : queries) {
    std::cin >> q;
  }

  bool swapped = false;
  for (auto&& q : queries) {
    if (q.T == 1) {
      if (swapped) {
        const auto Ai = (q.A > N) ? (q.A - N) : q.A + N;
        const auto Bi = (q.B > N) ? (q.B - N) : q.B + N;
        std::swap(S[Ai - 1], S[Bi - 1]);
      } else {
        std::swap(S[q.A - 1], S[q.B - 1]);
      }
    } else {
      swapped = !swapped;
    }
  }

  if (swapped) {
    for (int i = N; i < 2*N; ++i) {
      std::cout << S[i];
    }
    for (int i = 0; i < N; ++i) {
      std::cout << S[i];
    }
    std::cout << std::endl;
  } else {
    std::cout << S << std::endl;
  }
}
#include<bits/stdc++.h>
using namespace std;
#define rep(i,m,n) for(int i=m;i<n;i++)
using ll=long long;
int main(){
  ll n;
  string s;
  cin>>n>>s;
  ll q;
  cin>>q;
  string sub1=s.substr(0,n);
  string sub2=s.substr(n,n);
  //cout<<sub1<<" "<<sub2<<endl;
  ll tcount=0;
  rep(i,0,q){
      ll t;
      ll a;
      ll b;
      cin>>t>>a>>b;
      if(t==1){
          if(tcount%2==0){
             if(a<=n&&b<=n){
                swap(sub1[a-1],sub1[b-1]);
             }
             else if(a<=n&&b>n){
                swap(sub1[a-1],sub2[b-n-1]);
             }
             else swap(sub2[a-n-1],sub2[b-n-1]);   
          }
          else{
               if(a<=n&&b<=n){
                swap(sub2[a-1],sub2[b-1]);
             }
             else if(a<=n&&b>n){
                swap(sub2[a-1],sub1[b-n-1]);
             }
             else swap(sub1[a-n-1],sub1[b-n-1]);   
          }
      }
      else{
          tcount++;
      }
  }
  if(tcount%2==0){
  cout<<sub1<<sub2<<endl;}
  else cout<<sub2<<sub1<<endl;
}