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

#include <fstream>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main() {
    // uncomment the two following lines if you want to read/write from files
    // ifstream cin("input.txt");
    // ofstream cout("output.txt");
	
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);

    int N;
    cin >> N;

    vector<vector<int>> edges(N-1, vector<int>(2));
    for (int j = 0; j < N-1; ++j) {
        for (int i = 0; i < 2; ++i)
            cin >> edges[j][i];
    }

    int Q;
    cin >> Q;
	while (Q--) {
		int op;
		cin >> op;
		if (op == 1) {
			int a, b;
			cin >> a >> b;
		}
		else {
			int k;
			cin >> k;

			int ans = 0;
			cout << ans << "\n";
		}
	}

    return 0;
}
