#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define int long long
#define ll long long
#define F(type, i, a, b, incr) for (type i = a; i <= (type)(b); i += (type)(incr))
#define RF(type, i, a, b, decr) for (type i = a; i >= (type)(b); i -= (type)(decr))
#define sz(a) sizeof(a)
#define deb(a) cerr << " [" << #a << "->" << a << "] "
#define next_line cerr << '\n'
#define all(a) a.begin(), a.end()
#define iter(it, s) for (auto it = s.begin(); it != s.end(); it++)
#define setbits(x) __builtin_popcountll(x)
using namespace __gnu_pbds;
using namespace std;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;

void solve()
{
    int n;
    cin>> n;
    string s, fir, sec;
    vector<string> parts(2);
    cin>>s;
    F(int,i, 0, n - 1, 1)
        fir += s[i];
    F(int,i, n, 2*n - 1, 1)
        sec += s[i];
    parts[0] = fir;
    parts[1] = sec;
    int q, t = 0;
    cin >> q;
    while(q --){
        int ty,a,b;
        cin >> ty >> a >> b;
        if(ty == 1){
            a --;
            b --;
            int a_id = (a < n)?0:1;
            if(a >= n)
                a-=n;
            int b_id = (b < n)?0:1;
            if(b >= n)
                b -= n;
            char c = parts[a_id ^ t][a];
            parts[a_id ^ t][a] = parts[b_id ^ t][b];
            parts[b_id ^ t][b] = c;
        }else{
            t ^= 1;
        }
        // deb(parts[0]);deb(parts[1]);next_line;
    }
    cout << parts[t] + parts[t ^ 1];
}

signed 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);
        // freopen("Debug.txt", "w", stderr);
    #else
    #endif
    // cout << fixed << setprecision(10);
    // int _t;
    // cin>>_t;
    // F(int, i, 1, _t, 1){
        // cout << "Case #" << i << ": ";
        solve();
    // }
}

#include <stdio.h>
#include <bits/stdc++.h>

int main()
{
	int i, N, A[2][131072];
	scanf("%d", &N);
	for (i = 1; i <= N; i++) scanf("%d", &(A[0][i]));
	for (i = 1; i <= N; i++) scanf("%d", &(A[1][i]));
	
	int j, k, l, r;
	const long long inf = -(1LL << 60);
	long long dp[2][131072];
	for (i = 0; i <= N; i++) {
		dp[0][i] = inf;
		dp[1][i] = inf;
	}
	dp[0][1] = A[0][1];
	dp[1][1] = A[1][1];
	for (i = 2; i <= N; i++) {
		if (i % 2 == 0) {
			dp[0][0] = dp[0][1] + A[0][i];
			if (dp[0][0] < dp[1][1] + A[1][i]) dp[0][0] = dp[1][1] + A[1][i];
		} else dp[1][0] = dp[0][0];
		k = (i < N - i)? i: N - i;
		l = i % 2;
		r = 1 - i % 2;
		for (j = 2 - l; j <= k; j += 2) {
			dp[0][j] = std::max(dp[0][j-1] + A[r][i], dp[0][j+1] + A[l][i]);
			dp[1][j] = std::max(dp[1][j-1] + A[l][i], dp[1][j+1] + A[r][i]);
		}
	}
	printf("%lld\n", dp[0][0]);
	fflush(stdout);
	return 0;
}