3 5
2 1 608591421 720962564
3 2 608591421 641991574
3 2 718110706 353409763
2 3 482786015 858341723
3 2 825397574 357507279
 2 1
2 1 317425595 636156322
 50000 1
20845 28516 904146168 997637433

Yes
641991574 1
2 
 Yes
0 0

 Yes
0 0


#include <bits/stdc++.h>
using namespace std;
#define pi pair < int, int >
#define pli pair < long long, int >
#define pll pair < long long, long long >
#define f first
#define s second
#define MASK bitset < 20 >

const int MAX = 1e5 + 2, logMAX = log2(MAX) + 1;
int n, m, q, x, y, k, level[MAX], parent[MAX][logMAX];
vector < int > adj[MAX], mini[MAX][logMAX], c[MAX];
bool visited[MAX];

void print(vector < int > v)
{
	cout << "Vector: ";
	for(const auto &x : v)
		cout << x << " ";
	cout << "\n";
}

vector < int > add(vector < int > &a, vector < int > &b)
{
	vector < int > ret;
	set < int > s(a.begin(), a.begin() + min((int)a.size(), 10));
	s.insert(b.begin(), b.begin() + min((int)b.size(), 10));
	ret.assign(s.begin(), s.end());

	if(ret.size() > 10)
		ret.erase(ret.begin() + 10, ret.end());

	return ret;
}

void dfs(int u)
{
	visited[u] = true;

	for(int j = 1; (1 << j) <= level[u]; j++)
	{
		parent[u][j] = parent[parent[u][j - 1]][j - 1];
		mini[u][j] = add(mini[parent[u][j - 1]][j - 1], mini[u][j - 1]);
	}

	for(const auto &v : adj[u])
		if(!visited[v])
		{
			level[v] = level[u] + 1;
			parent[v][0] = u;
			mini[v][0] = c[u];
			dfs(v);
		}
}

int lca(int u, int v, vector < int > &ans)
{
	if(level[u] < level[v])
		swap(u, v);

	int lg;
	for(lg = 1; (1 << lg) <= level[u]; lg++); lg--;

	for(int j = lg; j >= 0; j--)
	{
		int p = parent[u][j];

		if(level[p] >= level[v])
		{
			ans = add(ans, mini[u][j]);
			u = p;
		}
	}

	if(v == u)
		return u;

	for(int j = lg; j >= 0; j --)
	{
		int p1 = parent[u][j], p2 = parent[v][j];

		if(p1 != p2)
		{
			ans = add(ans, mini[u][j]);
			ans = add(ans, mini[v][j]);
			u = p1, v = p2;
		}
	}

	ans = add(ans, mini[u][0]);
	ans = add(ans, mini[v][0]);
	return parent[u][0];
}

void ans(int u, int v, int x)
{
	vector < int > ans;
	ans = add(ans, c[u]);
	ans = add(ans, c[v]);
	lca(u, v, ans);
	x = min(x, (int)ans.size());
	printf("%d ", x);

	for(int i = 0; i < x; i ++)
		printf("%d ", ans[i]);

	puts("");
}

int main()
{
	//ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	scanf("%d %d %d", &n, &m, &q);

	for(int i = 1; i < n; i ++)
	{
		scanf("%d %d", &x, &y);
		adj[x].push_back(y);
		adj[y].push_back(x);
	}

	for(int i = 1; i <= m; i ++)
	{
		scanf("%d", &x);
		c[x].push_back(i);
	}

	parent[1][0] = 1;
	dfs(1);

	while(q--)
	{
		scanf("%d %d %d", &x, &y, &k);
		ans(x, y, k);
	}
	return 0;
}
