#include <bits/stdc++.h>
using namespace std;
const int maxn = 5e5 + 7;
int n, m;
vector<int> G[maxn];
int d[maxn];
int st[maxn][30];
void dfs(int u, int fa){ 
	d[u] = d[fa] + 1;
	for(int i = 0; i < G[u].size(); i++) {
		int v = G[u][i];
		if(v == fa) continue;
		dfs(v, u);
	}
	return;
}
int main() {
	freopen("query.in", "r", stdin);
	freopen("query.out", "w", stdout);
	scanf("%d", &n);
	for(int i = 1; i < n; i++) {
		int u, v;
		scanf("%d%d", &u, &v);
		G[u].push_back(v);
		G[v].push_back(u);
	}
	scanf("%d", &m);
	d[0] = -1;
	dfs(1, 0);
	for(int i = 1; i <= m; i++) {
		int l, r, k;
		scanf("%d%d%d", &l, &r, &k);
	}
	return 0;
}
