#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <memory.h>
#include <cmath>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <ctime>
#include <iostream>
#include <functional>
#include <complex>
#include <stdlib.h>
#include <fstream>
#include <random>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef pair<pii, int> p3i;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<p3i> v3i;
typedef vector<vii> vvii;
typedef vector<p3i> vp3i;
typedef long double ld;
typedef vector<ld> vld;

#define pb push_back
#define mp make_pair
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define REPD(i, n) for (int (i) = (n) - 1; (i) >= 0; (i)--)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define FORD(i,a, b) for (int (i) = (a); (i) >= (b); (i)--)
#define sz(v) (int)(v).size()
#define all(v) (v).begin(), (v).end()
#define rv(v) reverse(all(v))
#define CL(v, val) memset((v), (val), sizeof((v)))
#define SORT(a) sort(all(a))
#define un(v) SORT(v), (v).resize(unique(all(v)) - (v).begin())
#define eps 1.0e-9
#define X first
#define Y second
#define bit(n) (1 << (n))
#define bit64(n) (ll(1) << (n))
#define sqr(x) ((x) * (x))
#define sq5(x) ((x) * (x) * (x) * (x) * (x))
#define N 400005

ll t[N * 4];

void push(int v) {
	if (t[v]) {
		t[v * 2] += t[v];
		t[v * 2 + 1] += t[v];
		t[v] = 0;
	}
}

void upd(int v, int tl, int tr, int l, int r, ll val) {
	if (l > r) {
		return;
	}

	if (tl == l && tr == r)  {
		t[v] += val;

		return;
	}

	push(v);
	int tm = (tl + tr) / 2;

	upd(v * 2, tl, tm, l, min(tm, r), val);
	upd(v * 2 + 1, tm + 1, tr, max(tm + 1, l), r, val);
}

ll get(int v, int tl, int tr, int pos) {
	if (tl == tr) {
		return t[v];
	}

	push(v);
	int tm = (tl + tr) / 2;
	if (pos <= tm) {
		return get(v * 2, tl, tm, pos);
	}
	else {
		return get(v * 2 + 1, tm + 1, tr, pos);
	}
}

vector<vi>g;
int tIn[N], tOut[N];
int tt = 0;

void dfs(int v, int p = -1) {
	tIn[v] = tt++;

	REP(i, sz(g[v])) {
		int u = g[v][i];
		if (u != p) {
			dfs(u, v);
		}
	}

	tOut[v] = tt++;
}

bool inner(int a, int b) {
	return tIn[b] <= tIn[a] && tOut[a] <= tOut[b];
}

int main(void) {
	int n;
	scanf("%d", &n);
	g.resize(n);
	CL(tIn, -1);
	CL(tOut, -1);
	vii edges;
	REP(i, n - 1) {
		int x, y;
		scanf("%d%d", &x, &y);
		x--, y--;
		g[x].pb(y);
		g[y].pb(x);
		edges.pb(mp(x, y));
	}

	dfs(0);

	int q;
	scanf("%d", &q);
	REP(i, q) {
		int type, e;
		ll x;
		scanf("%d%d%lld", &type, &e, &x);
		e--;
		if (type == 1) {
			if (inner(edges[e].X, edges[e].Y)) {
				upd(1, 0, n * 2 - 1, tIn[edges[e].X], tOut[edges[e].X], x);
			}
			else {
				upd(1, 0, n * 2 - 1, 0, n * 2 - 1, x);
				upd(1, 0, n * 2 - 1, tIn[edges[e].Y], tOut[edges[e].Y], -x);
			}
		}
		else {
			if (inner(edges[e].Y, edges[e].X)) {
				upd(1, 0, n * 2 - 1, tIn[edges[e].Y], tOut[edges[e].Y], x);
			}
			else {
				upd(1, 0, n * 2 - 1, 0, n * 2 - 1, x);
				upd(1, 0, n * 2 - 1, tIn[edges[e].X], tOut[edges[e].X], -x);
			}
		}
	}

	REP(i, n) {
		printf("%lld\n", get(1, 0, n * 2 - 1, tIn[i]));
	}

}


#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define REP(i,j) for(int i=0;i<j;i++)
#define REPA(i,j) for(int i=1;i<=j;i++)
#define FORN(i,j,k) for(int i=j;i<k;i++)
#define vi vector<int>
#define vvi vector<vi >
#define pii pair<int,int>
#define vpii vector<pii >
#define all(a) a.begin(),a.end()
using namespace std;
const int INF=1<<30;
//const ll INF=1ll<<60;
const ll MOD=1e9+7;
inline void read(int &x){
//	short neg=1;
	x=0;
	char c=getchar();
	/*while(c<'0'||c>'9'){
		if(c=='-')neg=-1;
		c=getchar();
	}*/
	while(c>='0'&&c<='9'){
		x=(x<<3)+(x<<1)+(c^48),c=getchar();
	}
//	x*=neg;
}
ll quick_mod(ll A,ll B){//A^B
    ll ret=1;
    A%=MOD;
    while(B)
    {
        if(B&1)ret=ret*A%MOD;
        B>>=1;
        A=A*A%MOD;
    }
    return ret;
}
int n;
string s;
int q;
int t,a,b;
bool flag=0;
int main(void){
	cin>>n>>s;
	cin>>q;
	REP(ii,q){
		cin>>t>>a>>b;
		a--;
		b--;
		if(t==1){
			if(flag){
				if(a>=n)a-=n;
				else a+=n;
				if(b>=n)b-=n;
				else b+=n;
			}
			swap(s[a],s[b]);
		}
		else{
			flag=!flag;
		}
	}
	if(flag)cout<<s.substr(n,n)<<s.substr(0,n);
	else cout<<s; 
	return 0;
}

