#include <algorithm>
#include <cassert>
#include <chrono>
#include <cmath>
#include <complex>
#include <cstdint>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;
using ld = long double;
using ll = long long;
using ull = unsigned long long;
using pairll = pair<ll, ll>;
using pairint = pair<int, int>;
using vecll = vector<ll>;
using vecvecll = vector<vector<ll>>;
using vecpairll = vector<pair<ll, ll>>;
using vecstring = vector<string>;

#define rep(i, n) for (ll i = (0); i < (n); ++i)
#define Rep(i, a, b) for (ll i = (a); i < (b); ++i)
constexpr ll MOD = 1000000007;

template <typename T, typename U>
istream &operator>>(istream &is, pair<T, U> &p) {
  is >> p.first;
  is >> p.second;
  return is;
}
template <typename T>
istream &operator>>(istream &is, vector<T> &v) {
  for (auto &&x : v) is >> x;
  return is;
}
template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << p.first << ' ' << p.second;
  return os;
}
template <class T>
ostream &operator<<(ostream &os, vector<T> &v) {
  for (auto i = begin(v); i != end(v); ++i) {
    if (i != begin(v)) os << ' ';
    os << *i;
  }
  return os;
}
inline ll nizyou(ll x) { return x * x; }
bool isprime(long long N) {
  if (N <= 1) {
    return 0;
  }
  for (long long i = 2; i * i <= N; i++) {
    if (N % i == 0) {
      return 0;
    }
  }
  return 1;
}
map<long long, int> Prime_factorization(long long N) {
  map<long long, int> primefact;
  for (long long i = 2; i * i <= N; i++) {
    ll count = 0;
    while (N % i == 0) {
      count += 1;
      N /= i;
    }
    if (count > 0) {
      primefact[i] = count;
    }
  }
  if (N > 1) {
    primefact[N]++;
  }
  return primefact;
}
//整数の指数の累乗
ll expo(ll a, unsigned long long N) {
  if (N < 1) {
    return 1;
  }
  ll sum = a;
  for (ull i = 1; i < N; ++i) {
    sum *= a;
  }
  return sum;
}

ll modexpo(ll a, unsigned long long N, ll mod) {
  if (N < 1) {
    return 1;
  }

  ll sum = a;
  for (ull i = 1; i < N; ++i) {
    sum = sum * a % mod;
  }
  return sum;
}

template <typename T>
void exchange(T &a, T &b) {
  T c = a;
  a = b;
  b = c;
}

void YesOut() { cout << "Yes" << endl; }
void NoOut() { cout << "No" << endl; }
template <typename T>
bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

template <typename T>
bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

//デバッグ用表示関数 基本これを使うこと
template <typename T>
void checkOut(T s) {
  //非表示にするときはfalse 表示するときはtrueへ
  bool frag = false;
  if (frag) {
    cout << s << endl;
  }
}
const double PI = acos(-1);
//０～９のchar型のint変換
int ctoi(char c) { return c - '0'; }
ll ctoll(char c) { return static_cast<ll>(ctoi(c)); }
#define INF 10000000000

int main() {
  ll N, Q;
  string S;
  cin >> N >> S >> Q;
  string s1 = S.substr(0, N);
  string s2 = S.substr(N, N);
  rep(i, Q) {
    ll T, a, b;
    cin >> T >> a >> b;
    if (T == 1) {
      if (b <= N) {
        swap(s1[a - 1], s1[b - 1]);
      } else if (a <= N) {
        swap(s1[a - 1], s2[b - N - 1]);
      } else {
        swap(s2[a - 1 - N], s2[b - 1 - N]);
      }
    }
    if (T == 2) {
      swap(s1, s2);
    }
  }

  cout << s1 + s2 << endl;
  return 0;
}
/**
 *  In The Name Of God
 *  author : Behradm
 *  Idvwhu wkdq idvw, Txlfnhu wkdq txlfn, L dp Oljkwqlqj, Vshhg, L dp Vshhg :D :D
**/
#include "bits/stdc++.h"

using namespace std;

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  string s;
  cin >> s;
  int Q; cin >> Q;

  bool f = 1;
  while (Q--) {
    int t, a, b;
    cin >> t >> a >> b;
    --a, --b;
    if (t == 2) {
      f = !f;
    } else {
      if (!f) {
        if (a < n)
          a += n;
        else
          a -= n;
        if (b < n)
          b += n;
        else
          b -= n;
      }
      swap(s[a], s[b]);
    }
  }

  if (f) {
    cout << s << '\n';
    return 0;
  }

  for (int i = n; i < 2 * n; i++)
    cout << s[i];
  for (int i = 0; i < n; i++)
    cout << s[i];
  cout << '\n';
  return 0;
}


