// NOTE: it is recommended to use this even if you don't understand the following code.

#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>

#define MAXN 300000

int N, Q, ans, i, j;
int edges[MAXN-1][2];

int main() {
    // uncomment the two following lines if you want to read/write from files
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);

    assert(1 == scanf("%d", &N));

    for (j = 0; j < N-1; ++j) {
        for (i = 0; i < 2; ++i)
            assert(1 == scanf("%d", &edges[j][i]));
    }

    assert(1 == scanf("%d", &Q));

	while (Q--) {
		int op;
		assert(1 == scanf("%d", &op));

		if (op == 1) {
			int a, b;
			assert(2 == scanf("%d %d", &a, &b));
		}
		else {
			int k;
			assert(1 == scanf("%d", &k));

			int ans = 0;
			printf("%d\n", ans);
		}
	}

    return 0;
}
