#include <bits/stdc++.h>
using namespace std;
#define gc getchar_unlocked
#define fo(i, n) for (i = 0; i < n; i++)
#define Fo(i, k, n) for (i = k; k < n ? i < n : i > n; k < n ? i += 1 : i -= 1)
#define ll long long
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define PI 3.1415926535897932384626
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpii;
typedef vector<vi> vvi;
//=======================
const int MOD = 1000000007;
const int N = 2e6 + 13, M = N;
//=======================
vi g[N];
int arr[N];
vi a;
int n, m, k;
//=======================

void solve()
{
  int i, j;
  cin >> n;
  string s;
  int q;
  cin >> s >> q;
  int beg = 0;
  fo(i, q)
  {
    int t, a, b;
    cin >> t >> a >> b;
    if (t == 1)
    {
      a--;
      b--;
      if (beg == 0)
      {
        swap(s[a], s[b]);
      }
      else
      {
        if (a >= n)
        {
          a -= n;
        }
        else
        {
          a += n;
        }
        if (b >= n)
        {
          b -= n;
        }
        else
        {
          b += n;
        }
        swap(s[a], s[b]);
      }
    }
    else
    {
      if (beg == 0)
      {
        beg = n;
      }
      else
      {
        beg = 0;
      }
    }
  }
  if(beg == 0) cout << s << endl;
  else {
  for(i = n; i < 2*n; i++) cout << s[i];
  for(i = 0; i < n; i++) cout << s[i];
  }
}

int main()
{
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
  int t = 1;
  while (t--)
  {
    solve();
  }

  return 0;
}
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const int INF = 2000000000;
const int MOD = 1e9 + 7;
const int MAX = 30;
vector<vector<ll>> dp(MAX+1,vector<ll>(MAX+1));

string solve(int a,int b, ll k){
    if(a == 0) return string(b,'b');
    if(b == 0) return string(a,'a');
    if(k <= dp[a-1][b]) return string ("a") + solve(a-1,b,k);
    else return string("b") + solve(a,b - 1,k - dp[a-1][b]);
}

int main(){
    ll a,b,k;
    cin >> a >> b >> k;
    dp[0][0] = 1;
    rep(i,a+1){
        rep(j,b+1){
            if(i) dp[i][j] += dp[i-1][j];
            if(j) dp[i][j] += dp[i][j-1];
        }
    }
    cout << solve(a,b,k) << endl;
}
