#include<bits/stdc++.h>

using namespace std;

typedef pair<int,int>   II;
typedef vector< II >      VII;
typedef vector<int>     VI;
typedef vector< VI >  VVI;
typedef long long int   LL;
typedef unsigned long long int ULL;

#define pb push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (int)(a.size())
#define ALL(a) a.begin(),a.end()
#define SET(a,b) memset(a,b,sizeof(a))
#define LET(x,a) __typeof(a) x(a)
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)

#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
//Works for forward as well as backward iteration

#define gu getchar
#define pu putchar
#define si(n) scanf("%d",&n)
#define dout(n) printf("%d\n",n)
#define sll(n) scanf("%lld",&n)
#define lldout(n) printf("%lld\n",n)

#define DRT() int t; si(t); while(t--)

#define PlUSWRAP(index,n) index = (index+1)%n   //index++; if(index>=n) index=0
#define MINUSWRAP(index,n) index = (index + n -1)%n   //index--; if(index<0) index=n-1
#define ROUNDOFFINT(d) d = (int)((double)d + 0.5) //Round off d to nearest integer

#define FLUSHN while(gu()!='\n')
#define FLUSHS while(gu()!=' ')

#define TRACE

#ifdef TRACE
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;

#else

#define trace1(x)
#define trace2(x, y)
#define trace3(x, y, z)
#define trace4(a, b, c, d)
#define trace5(a, b, c, d, e)
#define trace6(a, b, c, d, e, f)

#endif

#define m(x) ((x)%mod);
#define mod (1e9)+7
const int maxn=(int)(1e5)+15;
const int a=10;
//FILE *fin = freopen("in","r",stdin);
//FILE *fout = freopen("out","w",stdout);
set <int> ss[maxn][30];
int P[maxn][30];
VI G[maxn];
int d[maxn];
void dfs(int x)
{
	for(auto i:G[x])
	{
		if(i!=P[x][0])
			P[i][0]=x,d[i]=d[x]+1,dfs(i);
	}
}
void preprocess(int n)
{
	int i,j;
	for(j=1;j<25;j++)
		for(i=1;i<=n;i++)
		{
			if(P[i][j-1]==0)
				continue;
			P[i][j]=P[P[i][j-1]][j-1];
			for(auto k:ss[i][j-1])
				ss[i][j].insert(k);
			for(auto k:ss[P[i][j-1]][j-1])
				ss[i][j].insert(k);
			while(ss[i][j].size()>a)
			{
				set <int> :: iterator it=--(ss[i][j].end());
				ss[i][j].erase(it);
			}
		}
}
set <int> ans;
void lca(int p,int q)
{
	ans.clear();
	int logp,i;
	if(d[p]<d[q])
		swap(p,q);
	logp=21;
	for(i=logp;i>=0;i--)
	{
		if(((d[p]-d[q])>>i)&1)
		{
			for(auto k:ss[p][i])
				ans.insert(k);
			while(ans.size()>a)
			{
				set <int> :: iterator it=--(ans.end());
				ans.erase(it);
			}
			p=P[p][i];
		}
	}
	if(p==q)
	{
		for(auto k:ss[p][0])
			ans.insert(k);
		while(ans.size()>a)
		{
			set <int> :: iterator it=--(ans.end());
			ans.erase(it);
		}
		return;
	}
	for(i=logp;i>=0 && P[p][0]!=P[q][0] ; i--)
	{
		if(P[p][i]!=P[q][i])
		{
			for(auto k:ss[p][i]){
				ans.insert(k);
				}
			for(auto k:ss[q][i]){
				ans.insert(k);
				}
			while(ans.size()>a)
			{
				set <int> :: iterator it=--(ans.end());
				ans.erase(it);
			}
			p=P[p][i];q=P[q][i];
		}
	}
	for(auto k:ss[p][1])
		ans.insert(k);
	for(auto k:ss[q][1])
		ans.insert(k);
}
int main()
{
	int n,m,q,u,v,i,a;
	si(n);si(m);si(q);
	for(i=1;i<n;i++)
	{
		si(u);si(v);
		G[u].pb(v);
		G[v].pb(u);
		//	trace1(i);
	}
	for(i=1;i<=m;i++)
		si(u),ss[u][0].insert(i);//trace1(u);
	dfs(1);
	preprocess(n);
	for(i=0;i<q;i++)
	{
		si(u);si(v);si(a);
		lca(u,v);
		printf("%d ",min((int)ans.size(),a));
		int r=0;
		for(auto j:ans){
			printf("%d ",j);
			r++;
			if(r==a){
				break;
			}
		}
		printf("\n");
	}
	return 0;
}


#include<bits/stdc++.h>

using namespace std;

typedef pair<int,int>   II;
typedef vector< II >      VII;
typedef vector<int>     VI;
typedef vector< VI >  VVI;
typedef long long int   LL;
typedef unsigned long long int ULL;

#define pb push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (int)(a.size())
#define ALL(a) a.begin(),a.end()
#define SET(a,b) memset(a,b,sizeof(a))
#define LET(x,a) __typeof(a) x(a)
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)

#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
//Works for forward as well as backward iteration

#define gu getchar
#define pu putchar
#define si(n) scanf("%d",&n)
#define dout(n) printf("%d\n",n)
#define sll(n) scanf("%lld",&n)
#define lldout(n) printf("%lld\n",n)

#define DRT() int t; si(t); while(t--)

#define PlUSWRAP(index,n) index = (index+1)%n   //index++; if(index>=n) index=0
#define MINUSWRAP(index,n) index = (index + n -1)%n   //index--; if(index<0) index=n-1
#define ROUNDOFFINT(d) d = (int)((double)d + 0.5) //Round off d to nearest integer

#define FLUSHN while(gu()!='\n')
#define FLUSHS while(gu()!=' ')

#define TRACE

#ifdef TRACE
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;

#else

#define trace1(x)
#define trace2(x, y)
#define trace3(x, y, z)
#define trace4(a, b, c, d)
#define trace5(a, b, c, d, e)
#define trace6(a, b, c, d, e, f)

#endif

#define m(x) ((x)%mod);
#define mod (1e9)+7
const int maxn=(int)(1e5)+15;
const int a=10;
//FILE *fin = freopen("in","r",stdin);
//FILE *fout = freopen("out","w",stdout);
set <int> ss[maxn][30];
int P[maxn][30];
VI G[maxn];
int d[maxn];
void dfs(int x)
{
	for(auto i:G[x])
	{
		if(i!=P[x][0])
			P[i][0]=x,d[i]=d[x]+1,dfs(i);
	}
}
void chc(set <int> &s,int v)
{
		s.insert(v);
		if(s.size()>10)
		s.erase(s.begin());
}
void preprocess(int n)
{
	int i,j;
	for(j=1;j<21;j++)
		for(i=1;i<=n;i++)
		{
			P[i][j]=P[P[i][j-1]][j-1];
			for(auto k:ss[i][j-1])
				chc(ss[i][j],k);
			for(auto k:ss[P[i][j-1]][j-1])
				chc(ss[i][j],k);
		}
}
set <int> ans;
void lca(int p,int q,int a)
{
	ans.clear();
	int logp,i;
	if(d[p]<d[q])
		swap(p,q);
	logp=21;
	for(i=logp;i>=0;i--)
	{
		if(((d[p]-d[q])>>i)&1)
		{
			for(auto k:ss[p][i])
				chc(ans,k);
			p=P[p][i];
		}
	}
	if(p==q)
	{
		for(auto k:ss[p][0])
				chc(ans,k);
		return;
	}
	for(i=logp;i>=0 && P[p][0]!=P[q][0] ; i--)
	{
		if(P[p][i]!=P[q][i])
		{
			for(auto k:ss[p][i])
				chc(ans,k);
			for(auto k:ss[q][i])
				chc(ans,k);
			p=P[p][i];q=P[q][i];
		}
	}
	for(auto k:ss[p][1])
				chc(ans,k);
	for(auto k:ss[q][1])
				chc(ans,k);
}
int arr[15];
int main()
{
	int n,m,q,u,v,i,a;
	si(n);si(m);si(q);
	for(i=1;i<n;i++)
	{
		si(u);si(v);
		G[u].pb(v);
		G[v].pb(u);
	}
	for(i=1;i<=m;i++){
		si(u);
		chc(ss[u][0],-i);
	}
	dfs(1);
	preprocess(n);
	for(i=0;i<q;i++)
	{
		si(u);si(v);si(a);
		lca(u,v,a);
		printf("%d ",min((int)ans.size(),a));
		int r=ans.size();
		for(auto j:ans){
			arr[--r]=-j;
			}
		for(int j=0;j<min(a,(int)ans.size());j++)
			printf("%d ",arr[j]);
		printf("\n");
	}
	return 0;
}


#include<bits/stdc++.h>

using namespace std;

typedef pair<int,int>   II;
typedef vector< II >      VII;
typedef vector<int>     VI;
typedef vector< VI >  VVI;
typedef long long int   LL;
typedef unsigned long long int ULL;

#define pb push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (int)(a.size())
#define ALL(a) a.begin(),a.end()
#define SET(a,b) memset(a,b,sizeof(a))
#define LET(x,a) __typeof(a) x(a)
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)

#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
//Works for forward as well as backward iteration

#define gu getchar
#define pu putchar
#define si(n) scanf("%d",&n)
#define dout(n) printf("%d\n",n)
#define sll(n) scanf("%lld",&n)
#define lldout(n) printf("%lld\n",n)

#define DRT() int t; si(t); while(t--)

#define PlUSWRAP(index,n) index = (index+1)%n   //index++; if(index>=n) index=0
#define MINUSWRAP(index,n) index = (index + n -1)%n   //index--; if(index<0) index=n-1
#define ROUNDOFFINT(d) d = (int)((double)d + 0.5) //Round off d to nearest integer

#define FLUSHN while(gu()!='\n')
#define FLUSHS while(gu()!=' ')

#define TRACE

#ifdef TRACE
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;

#else

#define trace1(x)
#define trace2(x, y)
#define trace3(x, y, z)
#define trace4(a, b, c, d)
#define trace5(a, b, c, d, e)
#define trace6(a, b, c, d, e, f)

#endif

#define m(x) ((x)%mod);
#define mod (1e9)+7
const int maxn=(int)(1e5)+15;
const int a=10;
//FILE *fin = freopen("in","r",stdin);
//FILE *fout = freopen("out","w",stdout);
set <int> ss[maxn][30];
int P[maxn][30];
VI G[maxn];
int d[maxn];
void dfs(int x)
{
	for(auto i:G[x])
	{
		if(i!=P[x][0])
			P[i][0]=x,d[i]=d[x]+1,dfs(i);
	}
}
void preprocess(int n)
{
	int i,j;
	for(j=1;j<25;j++)
		for(i=1;i<=n;i++)
		{
			if(P[i][j-1]==0)
				continue;
			P[i][j]=P[P[i][j-1]][j-1];
			for(auto k:ss[i][j-1])
				ss[i][j].insert(k);
			for(auto k:ss[P[i][j-1]][j-1])
				ss[i][j].insert(k);
			while(ss[i][j].size()>a)
			{
				set <int> :: iterator it=--(ss[i][j].end());
				ss[i][j].erase(it);
			}
		}
}
set <int> ans;
void lca(int p,int q)
{
	ans.clear();
	int logp,i;
	if(d[p]<d[q])
		swap(p,q);
	logp=21;
	for(i=logp;i>=0;i--)
	{
		if(((d[p]-d[q])>>i)&1){
			for(auto k:ss[p][i])
				ans.insert(k);
			while(ans.size()>a)
			{
				set <int> :: iterator it=--(ans.end());
				ans.erase(it);
			}
			p=P[p][i];
		}
	}
	if(p==q)
	{
		for(auto k:ss[p][0])
			ans.insert(k);
		while(ans.size()>a)
		{
			set <int> :: iterator it=--(ans.end());
			ans.erase(it);
		}
		return;
	}
	for(i=logp;i>=0 && P[p][0]!=P[q][0] ; i--)
	{
		if(P[p][i]!=P[q][i])
		{
			for(auto k:ss[p][i])
				ans.insert(k);
			for(auto k:ss[p][i])
				ans.insert(k);
			while(ans.size()>a)
			{
				set <int> :: iterator it=--(ans.end());
				ans.erase(it);
			}
			p=P[p][i];q=P[q][i];
		}
	}
	for(auto k:ss[p][1])
		ans.insert(k);
	for(auto k:ss[q][1])
		ans.insert(k);
}
int main()
{
	int n,m,q,u,v,i,a;
	si(n);si(m);si(q);
	for(i=1;i<n;i++)
	{
		si(u);si(v);
		G[u].pb(v);
		G[v].pb(u);
		//	trace1(i);
	}
	for(i=1;i<=m;i++)
		si(u),ss[u][0].insert(i);//trace1(u);
	dfs(1);
	preprocess(n);
	for(i=0;i<q;i++)
	{
		si(u);si(v);si(a);
		lca(u,v);
		printf("%d ",min((int)ans.size(),a));
		int r=0;
		for(auto j:ans){
			printf("%d ",j);
			r++;
			if(r==a){
				break;
			}
		}
		printf("\n");
	}
	return 0;
}


//~  Inshaallah
/*
ID: omarmuh1
PROG: test
LANG: C++
*/
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <ext/pb_ds/assoc_container.hpp>
#include <queue>
#include <map>
#include <ctime>
#include <iomanip>
#include <string.h>
#include <stdio.h>
#include <set>

using namespace std;
using namespace __gnu_pbds;

#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define pp pop_back
#define pii pair<int ,int>
#define pil pair<int , ll>
#define pli pair<ll , int>
#define pll pair<ll , ll>
#define mid(x , y)	(x+y)/2
#define sz(x) int(x.size())
#define db		cout << "****" << endl;
#define all(x) 	x.begin() , x.end()
#define lgn 	19
#define minn	1009
#define maxn 	100007
#define INF 	1000000009
#define LLINF 	1000000000000000009
#define tr(i, c) for(typeof((c).begin()) i = (c).begin(); i!=(c).end(); i++)
#define Help_me  ios_base::sync_with_stdio(false);

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> omar;

template<class T> bool umin(T& a, T b) { if(a > b){ a = b;return 1;}return 0;}
template<class T> bool umax(T& a, T b) { if(a < b){ a = b;return 1;}return 0;}

//~ ifstream cin("test.in");
//~ ofstream cout("test.out");

int a , b , c , d[maxn]  ,n , q , m , lvl[maxn] , P[maxn][lgn+2];
vector <int> co[maxn][lgn+2] , E[maxn] , pl , lp;

void dfs(int x , int y)
{
	P[x][0] = y;
	lvl[x] = lvl[y]+1;

	for(int i = 0 ; i < sz(E[x]) ; i++)
		if(E[x][i] != y)
			dfs(E[x][i] , x);
}

void form_LCA()
{
	for(int j = 1 ; j <= lgn ; j++)
	{
		for(int i = 1 ; i <= n ; i++)
		{
			if(P[i][j-1] > 0)
			{
				co[i][j].clear();
				pl.clear();

				for(int h = 0 ; h < sz(co[i][j-1]) ; h++)
					pl.pb(co[i][j-1][h]);

				for(int t = 0 ; t < sz(co[P[i][j-1]][j-1]) ; t++)
					pl.pb(co[P[i][j-1]][j-1][t]);

				sort(all(pl));

				for(int h = 0 ; h < min(10 , sz(pl)) ; h++)
					co[i][j].pb(pl[h]);

				P[i][j] = P[P[i][j-1]][j-1];
			}
		}
	}
}

void LCA(int x , int y , int z)
{
	lp.clear();

	if(lvl[x] < lvl[y])
		swap(x , y);

	for(int i = lgn ; i >= 0 ; i--)
	{
		//~ cout <<"? " << x << endl;
		if(lvl[x] - (1 << i) >= lvl[y])
		{
			pl.clear();

			for(int h = 0 ; h < sz(lp) ; h++)
				pl.pb(lp[h]);

			for(int h = 0 ; h < sz(co[x][i]) ; h++)
				pl.pb(co[x][i][h]);

			lp.clear();

			sort(all(pl));

			for(int h = 0 ; h < min(10 , sz(pl)) ; h++)
				lp.pb(pl[h]);

			x = P[x][i];
		}
	}

	if(x == y)
	{
		pl.clear();

		for(int h = 0 ; h < sz(lp) ; h++)
			pl.pb(lp[h]);

		for(int h = 0 ; h < sz(co[x][0]) ; h++)
			pl.pb(co[x][0][h]);

		lp.clear();

		sort(all(pl));

		for(int h = 0 ; h < min(10 , sz(pl)) ; h++)
			lp.pb(pl[h]);

		cout << min(z , sz(lp)) << " ";

		for(int i = 0 ; i < min(sz(lp) , z) ; i++)
			cout << lp[i] << " ";
		cout << endl;

		return;
	}

	for(int i = lgn ; i >= 0 ; i--)
	{
		if(P[x][i] > 0 && P[x][i] != P[y][i])
		{
			pl.clear();

			for(int h = 0 ; h < sz(lp) ; h++)
				pl.pb(lp[h]);

			for(int h = 0 ; h < sz(co[x][i]) ; h++)
				pl.pb(co[x][i][h]);

			for(int h = 0 ; h < sz(co[y][i]) ; h++)
				pl.pb(co[y][i][h]);

			lp.clear();

			sort(all(pl));

			for(int h = 0 ; h < min(10 , sz(pl)) ; h++)
				lp.pb(pl[h]);

			x = P[x][i] , y = P[y][i];
		}
	}

	pl.clear();

	for(int h = 0 ; h < sz(lp) ; h++)
		pl.pb(lp[h]);

	for(int h = 0 ; h < sz(co[x][0]) ; h++)
		pl.pb(co[x][0][h]);

	for(int h = 0 ; h < sz(co[y][0]) ; h++)
		pl.pb(co[y][0][h]);

	for(int h = 0 ; h < sz(co[P[x][0]][0]) ; h++)
		pl.pb(co[P[x][0]][0][h]);

	lp.clear();

	sort(all(pl));

	for(int h = 0 ; h < min(10 , sz(pl)) ; h++)
		lp.pb(pl[h]);

	cout << min(z , sz(lp)) << " ";

	for(int i = 0 ; i < min(sz(lp) , z) ; i++)
		cout << lp[i] << " ";
	cout << endl;

	return;
}

int main()
{
	scanf("%d%d%d" , &n , &m , &q);

	for(int i = 1 ; i < n ; i++)
	{
		scanf("%d%d" , &a , &b);

		E[a].pb(b);
		E[b].pb(a);
	}

	for(int i = 1 ; i <= m ; i++)
		scanf("%d" , d + i) , co[d[i]][0].pb(i);

	dfs(1 , 0);
	form_LCA();

	while(q--)
	{
		scanf("%d%d%d" , &a , &b , &c);

		LCA(a , b , c);
	}

	return 0;
}
/*
5 5 5
2 5
3 2
2 1
4 2
1 3 5 1 1
2 4 10
5 4 3
4 2 6
1 4 6
3 2 8
*/


//~  Inshaallah
/*
ID: omarmuh1
PROG: test
LANG: C++
*/
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <ext/pb_ds/assoc_container.hpp>
#include <queue>
#include <map>
#include <ctime>
#include <iomanip>
#include <string.h>
#include <stdio.h>
#include <set>

using namespace std;
using namespace __gnu_pbds;

#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define pp pop_back
#define pii pair<int ,int>
#define pil pair<int , ll>
#define pli pair<ll , int>
#define pll pair<ll , ll>
#define mid(x , y)	(x+y)/2
#define sz(x) int(x.size())
#define db		cout << "****" << endl;
#define all(x) 	x.begin() , x.end()
#define lgn 	19
#define minn	1009
#define maxn 	100007
#define INF 	1000000009
#define LLINF 	1000000000000000009
#define tr(i, c) for(typeof((c).begin()) i = (c).begin(); i!=(c).end(); i++)
#define Help_me  ios_base::sync_with_stdio(false);

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> omar;

template<class T> bool umin(T& a, T b) { if(a > b){ a = b;return 1;}return 0;}
template<class T> bool umax(T& a, T b) { if(a < b){ a = b;return 1;}return 0;}

//~ ifstream cin("test.in");
//~ ofstream cout("test.out");

int a , b , c , d[maxn]  ,n , q , m , lvl[maxn] , P[maxn][lgn+2];
vector <int> co[maxn][lgn+2] , E[maxn] , pl , lp;

void dfs(int x , int y)
{
	P[x][0] = y;
	lvl[x] = lvl[y]+1;

	for(int i = 0 ; i < sz(E[x]) ; i++)
		if(E[x][i] != y)
			dfs(E[x][i] , x);
}

void form_LCA()
{
	for(int j = 1 ; j <= lgn ; j++)
	{
		for(int i = 1 ; i <= n ; i++)
		{
			if(P[i][j-1] > 0)
			{
				co[i][j].clear();
				pl.clear();

				for(int h = 0 ; h < sz(co[i][j-1]) ; h++)
					pl.pb(co[i][j-1][h]);

				for(int t = 0 ; t < sz(co[P[i][j-1]][j-1]) ; t++)
					pl.pb(co[P[i][j-1]][j-1][t]);

				sort(all(pl));

				for(int h = 0 ; h < min(10 , sz(pl)) ; h++)
					co[i][j].pb(pl[h]);

				P[i][j] = P[P[i][j-1]][j-1];
			}
		}
	}
}

void LCA(int x , int y , int z)
{
	lp.clear();

	if(lvl[x] < lvl[y])
		swap(x , y);

	for(int i = lgn ; i >= 0 ; i--)
	{
		//~ cout <<"? " << x << endl;
		if(lvl[x] - (1 << i) >= lvl[y])
		{
			pl.clear();

			for(int h = 0 ; h < sz(lp) ; h++)
				pl.pb(lp[h]);

			for(int h = 0 ; h < sz(co[x][i]) ; h++)
				pl.pb(co[x][i][h]);

			lp.clear();

			sort(all(pl));

			for(int h = 0 ; h < min(10 , sz(pl)) ; h++)
				lp.pb(pl[h]);

			x = P[x][i];
		}
	}

	if(x == y)
	{
		pl.clear();

		for(int h = 0 ; h < sz(lp) ; h++)
			pl.pb(lp[h]);

		for(int h = 0 ; h < sz(co[x][0]) ; h++)
			pl.pb(co[x][0][h]);

		lp.clear();

		sort(all(pl));

		for(int h = 0 ; h < min(10 , sz(pl)) ; h++)
			lp.pb(pl[h]);

		cout << min(z , sz(lp)) << " ";

		for(int i = 0 ; i < min(sz(lp) , z) ; i++)
			cout << lp[i] << " ";
		cout << endl;

		return;
	}

	for(int i = lgn ; i >= 0 ; i--)
	{
		if(P[x][i] > 0 && P[x][i] != P[y][i])
		{
			cout << i << endl;
			pl.clear();

			for(int h = 0 ; h < sz(lp) ; h++)
				pl.pb(lp[h]);

			for(int h = 0 ; h < sz(co[x][i]) ; h++)
				pl.pb(co[x][i][h]);

			for(int h = 0 ; h < sz(co[y][i]) ; h++)
				pl.pb(co[y][i][h]);

			lp.clear();

			sort(all(pl));

			for(int h = 0 ; h < min(10 , sz(pl)) ; h++)
				lp.pb(pl[h]);

			x = P[x][i] , y = P[y][i];
		}
	}

	pl.clear();

	for(int h = 0 ; h < sz(lp) ; h++)
		pl.pb(lp[h]);

	for(int h = 0 ; h < sz(co[x][0]) ; h++)
		pl.pb(co[x][0][h]);

	for(int h = 0 ; h < sz(co[y][0]) ; h++)
		pl.pb(co[y][0][h]);

	for(int h = 0 ; h < sz(co[P[x][0]][0]) ; h++)
		pl.pb(co[P[x][0]][0][h]);

	lp.clear();

	sort(all(pl));

	for(int h = 0 ; h < min(10 , sz(pl)) ; h++)
		lp.pb(pl[h]);

	cout << min(z , sz(lp)) << " ";

	for(int i = 0 ; i < min(sz(lp) , z) ; i++)
		cout << lp[i] << " ";
	cout << endl;

	return;
}

int main()
{
	scanf("%d%d%d" , &n , &m , &q);

	for(int i = 1 ; i < n ; i++)
	{
		scanf("%d%d" , &a , &b);

		E[a].pb(b);
		E[b].pb(a);
	}

	for(int i = 1 ; i <= m ; i++)
		scanf("%d" , d + i) , co[d[i]][0].pb(i);

	dfs(1 , 0);
	form_LCA();

	while(q--)
	{
		scanf("%d%d%d" , &a , &b , &c);

		LCA(a , b , c);
	}

	return 0;
}
/*
5 5 5
2 5
3 2
2 1
4 2
1 3 5 1 1
2 4 10
5 4 3
4 2 6
1 4 6
3 2 8
*/


//~  Inshaallah
/*
ID: omarmuh1
PROG: test
LANG: C++
*/
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <ext/pb_ds/assoc_container.hpp>
#include <queue>
#include <map>
#include <ctime>
#include <iomanip>
#include <string.h>
#include <stdio.h>
#include <set>

using namespace std;
using namespace __gnu_pbds;

#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define pp pop_back
#define pii pair<int ,int>
#define pil pair<int , ll>
#define pli pair<ll , int>
#define pll pair<ll , ll>
#define mid(x , y)	(x+y)/2
#define sz(x) int(x.size())
#define db		cout << "****" << endl;
#define all(x) 	x.begin() , x.end()
#define lgn 	19
#define minn	1009
#define maxn 	100007
#define INF 	1000000009
#define LLINF 	1000000000000000009
#define tr(i, c) for(typeof((c).begin()) i = (c).begin(); i!=(c).end(); i++)
#define Help_me  ios_base::sync_with_stdio(false);

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> omar;

template<class T> bool umin(T& a, T b) { if(a > b){ a = b;return 1;}return 0;}
template<class T> bool umax(T& a, T b) { if(a < b){ a = b;return 1;}return 0;}

//~ ifstream cin("test.in");
//~ ofstream cout("test.out");

int a , b , c , d[maxn]  ,n , q , m , lvl[maxn] , P[maxn][lgn+2];
vector <int> co[maxn][lgn+2] , E[maxn] , pl , lp;

void dfs(int x , int y)
{
	P[x][0] = y;
	lvl[x] = lvl[y]+1;
	if(d[x] != 0)	co[x][0].pb(d[x]);

	for(int i = 0 ; i < sz(E[x]) ; i++)
		if(E[x][i] != y)
			dfs(E[x][i] , x);
}

void form_LCA()
{
	for(int j = 1 ; j <= lgn ; j++)
	{
		for(int i = 1 ; i <= n ; i++)
		{
			if(P[i][j-1] > 0)
			{
				co[i][j].clear();
				pl.clear();

				for(int h = 0 ; h < sz(co[i][j-1]) ; h++)
					pl.pb(co[i][j-1][h]);

				for(int t = 0 ; t < sz(co[P[i][j-1]][j-1]) ; t++)
					pl.pb(co[P[i][j-1]][j-1][t]);

				sort(all(pl));

				for(int h = 0 ; h < min(10 , sz(pl)) ; h++)
					co[i][j].pb(pl[h]);

				P[i][j] = P[P[i][j-1]][j-1];
			}
		}
	}
}

void LCA(int x , int y , int z)
{
	lp.clear();

	if(lvl[x] < lvl[y])
		swap(x , y);

	for(int i = lgn ; i >= 0 ; i--)
	{
		//~ cout <<"? " << x << endl;
		if(lvl[x] - (1 << i) >= lvl[y])
		{
			pl.clear();

			for(int h = 0 ; h < sz(lp) ; h++)
				pl.pb(lp[h]);

			for(int h = 0 ; h < sz(co[x][i]) ; h++)
				pl.pb(co[x][i][h]);

			lp.clear();

			sort(all(pl));

			for(int h = 0 ; h < min(10 , sz(pl)) ; h++)
				lp.pb(pl[h]);

			x = P[x][i];
		}
	}

	if(x == y)
	{
		pl.clear();

		for(int h = 0 ; h < sz(lp) ; h++)
			pl.pb(lp[h]);

		for(int h = 0 ; h < sz(co[x][0]) ; h++)
			pl.pb(co[x][0][h]);

		lp.clear();

		sort(all(pl));

		for(int h = 0 ; h < min(10 , sz(pl)) ; h++)
			lp.pb(pl[h]);

		cout << min(z , sz(lp)) << " ";

		for(int i = 0 ; i < min(sz(lp) , z) ; i++)
			cout << lp[i] << " ";
		cout << endl;

		return;
	}

	for(int i = lgn ; i >= 0 ; i--)
	{
		if(P[x][i] > 0 && P[x][i] != P[y][i])
		{
			cout << i << endl;
			pl.clear();

			for(int h = 0 ; h < sz(lp) ; h++)
				pl.pb(lp[h]);

			for(int h = 0 ; h < sz(co[x][i]) ; h++)
				pl.pb(co[x][i][h]);

			for(int h = 0 ; h < sz(co[y][i]) ; h++)
				pl.pb(co[y][i][h]);

			lp.clear();

			sort(all(pl));

			for(int h = 0 ; h < min(10 , sz(pl)) ; h++)
				lp.pb(pl[h]);

			x = P[x][i] , y = P[y][i];
		}
	}

	pl.clear();

	for(int h = 0 ; h < sz(lp) ; h++)
		pl.pb(lp[h]);

	for(int h = 0 ; h < sz(co[x][0]) ; h++)
		pl.pb(co[x][0][h]);

	for(int h = 0 ; h < sz(co[y][0]) ; h++)
		pl.pb(co[y][0][h]);

	for(int h = 0 ; h < sz(co[P[x][0]][0]) ; h++)
		pl.pb(co[P[x][0]][0][h]);

	lp.clear();

	sort(all(pl));

	for(int h = 0 ; h < min(10 , sz(pl)) ; h++)
		lp.pb(pl[h]);

	cout << min(z , sz(lp)) << " ";

	for(int i = 0 ; i < min(sz(lp) , z) ; i++)
		cout << lp[i] << " ";
	cout << endl;

	return;
}

int main()
{
	scanf("%d%d%d" , &n , &m , &q);

	for(int i = 1 ; i < n ; i++)
	{
		scanf("%d%d" , &a , &b);

		E[a].pb(b);
		E[b].pb(a);
	}

	for(int i = 1 ; i <= m ; i++)
		scanf("%d" , d + i);

	dfs(1 , 0);
	form_LCA();

	while(q--)
	{
		scanf("%d%d%d" , &a , &b , &c);

		LCA(a , b , c);
	}

	return 0;
}


/*
ID: maxoraz1
PROG:
LANG: C++
*/

#include <map>
#include <set>
#include <queue>
#include <stack>
#include <time.h>
#include <bitset>
#include <math.h>
#include <vector>
#include <string>
#include <limits>
#include <sstream>
#include <stdio.h>
#include <iostream>
#include <string.h>
#include <assert.h>
#include <limits.h>
#include <stdlib.h>
#include <algorithm>

#define ff first
#define ss second
#define maxn 100009
#define pp pop_back
#define mp make_pair
#define pb push_back
#define lld long long
#define inf 1000000009
#define mid(x, y) (x+y)/2
#define pii pair <int, int>
#define gcd(x, y) __gcd (x, y)
#define all(x) x.begin(), x.end()
#define lcm(x, y) (x*y) / __gcd (x, y);
#define random srand((unsigned)time(NULL))

using namespace std;

//min beryar ---> priority_queue < pii, vector< pii >, greater< pii > > Q;
//max beryar ---> priority_queue < pii > Q;

vector <int> g[maxn];

vector <int> A[maxn][20];

int p[maxn][20], L[maxn];
int dd[maxn];

int ger[15], kun[15], ans[15];

vector <int> nah, mal;

set <int> maskat[maxn];

int n, m, q, a, b, c, x, y, sz, zs, size;

void dfs (int v, int par) {
	p[v][0] = v;

	p[v][1] = par;

	L[v] = L[par] + 1;

	for (int i=0; i<g[v].size(); i++)
		if (g[v][i] != par)
			dfs (g[v][i], v);
}

void build () {
	for (int j=1; j<=n; j++) {
		if (p[j][1] != 0) {
			for (int l=0, r=0; l<A[j][0].size() || r<A[p[j][1]][0].size();) {
				if (A[j][1].size() > 10) break;

				x = l < A[j][0].size() ? A[j][0][l] : inf;
				y = r < A[p[j][1]][0].size() ? A[p[j][1]][0][r] : inf;

				if (x < y) {if (A[j][1].size() == 0 || A[j][1][A[j][1].size()-1] != x) {A[j][1].push_back(x);} l++;}
				else	   {if (A[j][1].size() == 0 || A[j][1][A[j][1].size()-1] != y) {A[j][1].push_back(y);} r++;}
			}
		}
	}

	for (int i=2; i<17; i++) {
		for (int j=1; j<=n; j++) {
			if (i - 1 != 0) p[j][i] = p[p[j][i-1]][i-1];

			if (p[j][i] != 0) {
				for (int l=0, r=0; l<A[j][i-1].size() || r<A[p[j][i-1]][i-1].size();) {
					if (A[j][i].size() > 10) break;

					x = l < A[j][i-1].size() ? A[j][i-1][l] : inf;
					y = r < A[p[j][i-1]][i-1].size() ? A[p[j][i-1]][i-1][r] : inf;

					if (x < y) {if (A[j][i].size() == 0 || A[j][i][A[j][i].size()-1] != x) {A[j][i].push_back(x);} l++;}
					else	   {if (A[j][i].size() == 0 || A[j][i][A[j][i].size()-1] != y) {A[j][i].push_back(y);} r++;}
				}
			}
		}
	}
}

bool LCA (int k, int g) {
	if (L[k] < L[g]) swap (k, g);

	nah = A[k][0], mal = A[g][0];

	for (int i=16; i>=1; i--) {
		if (L[p[k][i]] >= L[g]) {
			sz = 0;
			for (int l=0, r=0; l<nah.size() || r<A[k][i].size();) {
				if (sz > 10) break;

				x = l < nah.size() ? nah[l] : inf;
				y = r < A[k][i].size() ? A[k][i][r] : inf;

				if (x < y) {if (sz == 0 || ger[sz-1] != x) {ger[sz++] = x;} l++;}
				else	   {if (sz == 0 || ger[sz-1] != y) {ger[sz++] = y;} r++;}
			}

			nah.resize(sz); for (int h=0; h<sz; h++) nah[h] = ger[h]; k = p[k][i];
		}
	}

	if (k == g) return 0;

	for (int i=16; i>=1; i--) {
		if (p[k][i] != 0 && p[k][i] != p[g][i]) {
			sz = 0; zs = 0;
			for (int l=0, r=0; l<nah.size() || r<A[k][i].size();) {
				if (sz > 10) break;

				x = l < nah.size() ? nah[l] : inf;
				y = r < A[k][i].size() ? A[k][i][r] : inf;

				if (x < y) {if (sz == 0 || ger[sz-1] != x) {ger[sz++] = x;} l++;}
				else	   {if (sz == 0 || ger[sz-1] != y) {ger[sz++] = y;} r++;}
			}

			for (int l=0, r=0; l<mal.size() || r<A[g][i].size();) {
				if (zs > 10) break;

				x = l < mal.size() ? mal[l] : inf;
				y = r < A[g][i].size() ? A[g][i][r] : inf;

				if (x < y) {if (zs == 0 || kun[zs-1] != x) {kun[zs++] = x;} l++;}
				else	   {if (zs == 0 || kun[zs-1] != y) {kun[zs++] = y;} r++;}
			}

			nah.resize(sz); for (int h=0; h<sz; h++) nah[h] = ger[h]; k = p[k][i];
			mal.resize(zs); for (int h=0; h<zs; h++) mal[h] = kun[h]; g = p[g][i];
		}
	}

	sz = 0; zs = 0;
	for (int l=0, r=0; l<nah.size() || r<A[k][1].size();) {
		if (sz > 10) break;

		x = l < nah.size() ? nah[l] : inf;
		y = r < A[k][1].size() ? A[k][1][r] : inf;

		if (x < y) {if (sz == 0 || ger[sz-1] != x) {ger[sz++] = x;} l++;}
		else	   {if (sz == 0 || ger[sz-1] != y) {ger[sz++] = y;} r++;}
	}

	for (int l=0, r=0; l<mal.size() || r<A[g][1].size();) {
		if (zs > 10) break;

		x = l < mal.size() ? mal[l] : inf;
		y = r < A[g][1].size() ? A[g][1][r] : inf;

		if (x < y) {if (zs == 0 || kun[zs-1] != x) {kun[zs++] = x;} l++;}
		else	   {if (zs == 0 || kun[zs-1] != y) {kun[zs++] = y;} r++;}
	}

	size = 0;
	for (int l=0, r=0; l<sz || r<zs;) {
		if (size > 10) break;

		x = l < sz ? ger[l] : inf;
		y = r < zs ? kun[r] : inf;

		if (x < y) {if (size == 0 || ans[size-1] != x) {ans[size++] = x;} l++;}
		else	   {if (size == 0 || ans[size-1] != y) {ans[size++] = y;} r++;}
	}
	return 1;
}

int main() {
	//freopen("file.in", "r", stdin);
	//freopen("file.out", "w", stdout);

	scanf ("%d%d%d", &n, &m, &q);

	for (int i=1; i<n; i++) {
		scanf ("%d%d", &a, &b);

		g[a].pb(b);
		g[b].pb(a);
	}

	for (int i=1; i<=m; i++) {
		scanf ("%d", &dd[i]);

		maskat[dd[i]].insert(i);
	}

	for(int i = 1 ; i <= m ; i++)
	{
		if(A[dd[i]][0].empty())
		{
			for(int j : maskat[dd[i]])
			{
				A[dd[i]][0].pb(j);
				if(A[dd[i]][0].size() > 10)
					break;
			}
		}
	}

	dfs (1, 0);

	build ();

	while (q--) {
		scanf ("%d%d%d", &a, &b, &c);

		bool one = LCA (a, b);

		int cmo = one == 1 ? min(size, c) : min(int(nah.size()), c);

		printf ("%d ", cmo);

		if (one == 1)
			for (int i=0; i<cmo; i++)
				printf ("%d ", ans[i]);

		else
			for (int i=0; i<cmo; i++)
				printf ("%d ", nah[i]);

		printf ("\n");
	}

	return 0;
}


//~  Inshaallah
/*
ID: omarmuh1
PROG: test
LANG: C++
*/
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <ext/pb_ds/assoc_container.hpp>
#include <queue>
#include <map>
#include <ctime>
#include <iomanip>
#include <string.h>
#include <stdio.h>
#include <set>

using namespace std;
using namespace __gnu_pbds;

#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define pp pop_back
#define pii pair<int ,int>
#define pil pair<int , ll>
#define pli pair<ll , int>
#define pll pair<ll , ll>
#define mid(x , y)	(x+y)/2
#define sz(x) int(x.size())
#define db		cout << "****" << endl;
#define all(x) 	x.begin() , x.end()
#define lgn 	19
#define minn	1009
#define maxn 	100007
#define INF 	1000000009
#define LLINF 	1000000000000000009
#define tr(i, c) for(typeof((c).begin()) i = (c).begin(); i!=(c).end(); i++)
#define Help_me  ios_base::sync_with_stdio(false);

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> omar;

template<class T> bool umin(T& a, T b) { if(a > b){ a = b;return 1;}return 0;}
template<class T> bool umax(T& a, T b) { if(a < b){ a = b;return 1;}return 0;}

//~ ifstream cin("test.in");
//~ ofstream cout("test.out");

int a , b , c , d[maxn]  ,n , q , m , lvl[maxn] , P[maxn][lgn+2];
vector <int> co[maxn][lgn+2] , E[maxn] , pl , lp;

void dfs(int x , int y)
{
	P[x][0] = y;
	lvl[x] = lvl[y]+1;

	for(int i = 0 ; i < sz(E[x]) ; i++)
		if(E[x][i] != y)
			dfs(E[x][i] , x);
}

void form_LCA()
{
	for(int j = 1 ; j <= lgn ; j++)
	{
		for(int i = 1 ; i <= n ; i++)
		{
			if(P[i][j-1] > 0)
			{
				for(int h = 0 ; h < sz(co[i][j-1]) ; h++)
					co[i][j].pb(co[i][j-1][h]);

				for(int t = 0 ; t < sz(co[P[i][j-1]][j-1]) ; t++)
					co[i][j].pb(co[P[i][j-1]][j-1][t]);

				sort(all(co[i][j]));

				if(sz(co[i][j]) > 10)
					co[i][j].resize(10);

				P[i][j] = P[P[i][j-1]][j-1];
			}
		}
	}
}

void LCA(int x , int y , int z)
{
	lp.clear();

	if(lvl[x] < lvl[y])
		swap(x , y);

	for(int i = lgn ; i >= 0 ; i--)
	{
		//~ cout <<"? " << x << endl;
		if(lvl[x] - (1 << i) >= lvl[y])
		{
			for(int h = 0 ; h < sz(co[x][i]) ; h++)
				lp.pb(co[x][i][h]);

			sort(all(lp));

			if(sz(lp) > 10)
				lp.resize(10);

			x = P[x][i];
		}
	}

	if(x == y)
	{
		for(int h = 0 ; h < sz(co[x][0]) ; h++)
			lp.pb(co[x][0][h]);

		sort(all(lp));

		if(sz(lp) > 10)
			lp.resize(10);

		cout << min(z , sz(lp)) << " ";

		for(int i = 0 ; i < min(sz(lp) , z) ; i++)
			cout << lp[i] << " ";
		cout << endl;

		return;
	}

	for(int i = lgn ; i >= 0 ; i--)
	{
		if(P[x][i] > 0 && P[x][i] != P[y][i])
		{
			for(int h = 0 ; h < sz(co[x][i]) ; h++)
				lp.pb(co[x][i][h]);

			for(int h = 0 ; h < sz(co[y][i]) ; h++)
				lp.pb(co[y][i][h]);

			sort(all(lp));

			if(sz(lp) > 10)
				lp.resize(10);

			x = P[x][i] , y = P[y][i];
		}
	}

	for(int h = 0 ; h < sz(co[x][0]) ; h++)
		lp.pb(co[x][0][h]);

	for(int h = 0 ; h < sz(co[y][0]) ; h++)
		lp.pb(co[y][0][h]);

	for(int h = 0 ; h < sz(co[P[x][0]][0]) ; h++)
		lp.pb(co[P[x][0]][0][h]);

	sort(all(lp));

	if(sz(lp) > 10)
		lp.resize(10);

	cout << min(z , sz(lp)) << " ";

	for(int i = 0 ; i < min(sz(lp) , z) ; i++)
		cout << lp[i] << " ";
	cout << endl;

	return;
}

int main()
{
	scanf("%d%d%d" , &n , &m , &q);

	for(int i = 1 ; i < n ; i++)
	{
		scanf("%d%d" , &a , &b);

		E[a].pb(b);
		E[b].pb(a);
	}

	for(int i = 1 ; i <= m ; i++)
		scanf("%d" , d + i) , co[d[i]][0].pb(i);

	dfs(1 , 0);
	form_LCA();

	while(q--)
	{
		scanf("%d%d%d" , &a , &b , &c);

		LCA(a , b , c);
	}

	return 0;
}
/*
5 5 5
2 5
3 2
2 1
4 2
1 3 5 1 1
2 4 10
5 4 3
4 2 6
1 4 6
3 2 8
*/


//~  Inshaallah
/*
ID: omarmuh1
PROG: test
LANG: C++
*/
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <ext/pb_ds/assoc_container.hpp>
#include <queue>
#include <map>
#include <ctime>
#include <iomanip>
#include <string.h>
#include <stdio.h>
#include <set>

using namespace std;
using namespace __gnu_pbds;

#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define pp pop_back
#define pii pair<int ,int>
#define pil pair<int , ll>
#define pli pair<ll , int>
#define pll pair<ll , ll>
#define mid(x , y)	(x+y)/2
#define sz(x) int(x.size())
#define db		cout << "****" << endl;
#define all(x) 	x.begin() , x.end()
#define lgn 	19
#define minn	1009
#define maxn 	100007
#define INF 	1000000009
#define LLINF 	1000000000000000009
#define tr(i, c) for(typeof((c).begin()) i = (c).begin(); i!=(c).end(); i++)
#define Help_me  ios_base::sync_with_stdio(false);

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> omar;

template<class T> bool umin(T& a, T b) { if(a > b){ a = b;return 1;}return 0;}
template<class T> bool umax(T& a, T b) { if(a < b){ a = b;return 1;}return 0;}

//~ ifstream cin("test.in");
//~ ofstream cout("test.out");

int a , b , c , d[maxn]  ,n , q , m , lvl[maxn] , P[maxn][lgn+2];
vector <int> co[maxn][lgn+2] , E[maxn] , pl , lp;
set <int> asyl[maxn];

void dfs(int x , int y)
{
	P[x][0] = y;
	lvl[x] = lvl[y]+1;

	for(int i = 0 ; i < sz(E[x]) ; i++)
		if(E[x][i] != y)
			dfs(E[x][i] , x);
}

void form_LCA()
{
	for(int j = 1 ; j <= lgn ; j++)
	{
		for(int i = 1 ; i <= n ; i++)
		{
			if(P[i][j-1] > 0)
			{
				for(int h = 0 ; h < sz(co[i][j-1]) ; h++)
					co[i][j].pb(co[i][j-1][h]);

				for(int t = 0 ; t < sz(co[P[i][j-1]][j-1]) ; t++)
					co[i][j].pb(co[P[i][j-1]][j-1][t]);

				sort(all(co[i][j]));

				if(sz(co[i][j]) > 10)
					co[i][j].resize(10);

				P[i][j] = P[P[i][j-1]][j-1];
			}
		}
	}
}

void LCA(int x , int y , int z)
{
	lp.clear();

	if(lvl[x] < lvl[y])
		swap(x , y);

	for(int i = lgn ; i >= 0 ; i--)
	{
		//~ cout <<"? " << x << endl;
		if(lvl[x] - (1 << i) >= lvl[y])
		{
			for(int h = 0 ; h < sz(co[x][i]) ; h++)
				lp.pb(co[x][i][h]);

			sort(all(lp));

			if(sz(lp) > 10)
				lp.resize(10);

			x = P[x][i];
		}
	}

	if(x == y)
	{
		for(int h = 0 ; h < sz(co[x][0]) ; h++)
			lp.pb(co[x][0][h]);

		sort(all(lp));

		if(sz(lp) > 10)
			lp.resize(10);

		cout << min(z , sz(lp)) << " ";

		for(int i = 0 ; i < min(sz(lp) , z) ; i++)
			cout << lp[i] << " ";
		cout << endl;

		return;
	}

	for(int i = lgn ; i >= 0 ; i--)
	{
		if(P[x][i] > 0 && P[x][i] != P[y][i])
		{
			for(int h = 0 ; h < sz(co[x][i]) ; h++)
				lp.pb(co[x][i][h]);

			for(int h = 0 ; h < sz(co[y][i]) ; h++)
				lp.pb(co[y][i][h]);

			sort(all(lp));

			if(sz(lp) > 10)
				lp.resize(10);

			x = P[x][i] , y = P[y][i];
		}
	}

	for(int h = 0 ; h < sz(co[x][0]) ; h++)
		lp.pb(co[x][0][h]);

	for(int h = 0 ; h < sz(co[y][0]) ; h++)
		lp.pb(co[y][0][h]);

	for(int h = 0 ; h < sz(co[P[x][0]][0]) ; h++)
		lp.pb(co[P[x][0]][0][h]);

	sort(all(lp));

	if(sz(lp) > 10)
		lp.resize(10);

	cout << min(z , sz(lp)) << " ";

	for(int i = 0 ; i < min(sz(lp) , z) ; i++)
		cout << lp[i] << " ";
	cout << endl;

	return;
}

int main()
{
	scanf("%d%d%d" , &n , &m , &q);

	for(int i = 1 ; i < n ; i++)
	{
		scanf("%d%d" , &a , &b);

		E[a].pb(b);
		E[b].pb(a);
	}

	for(int i = 1 ; i <= m ; i++)
		scanf("%d" , d + i) , asyl[d[i]].insert(i);

	for(int i = 1 ; i <= m ; i++)
		if(co[d[i]][0].empty())
		{
			for(int j : asyl[d[i]])
			{
				co[d[i]][0].pb(j);
				if(sz(co[d[i]][0]) == 10)
					break;
			}
		}

	dfs(1 , 0);
	form_LCA();

	while(q--)
	{
		scanf("%d%d%d" , &a , &b , &c);

		LCA(a , b , c);
	}

	return 0;
}
/*
5 5 5
2 5
3 2
2 1
4 2
1 3 5 1 1
2 4 10
5 4 3
4 2 6
1 4 6
3 2 8
*/


#include<cstdio>
#define MAXN 1001
#define INF 1500000000
int n;
int min(int x,int y){return x<y?x:y;}
void swap(int &x,int &y){int t=x;x=y;y=t;}
struct Edge{
	int to,next;
};
int head[MAXN],tot;
Edge edge[MAXN*2];
void addedge(int u,int v){
	edge[++tot].to=v; edge[tot].next=head[u]; head[u]=tot;
	edge[++tot].to=u; edge[tot].next=head[v]; head[v]=tot;
}
int height[MAXN],f[MAXN],top[MAXN],id[MAXN],cid,cnt[MAXN],son[MAXN];
int dfs1(int rt){
	int tmp=0,tmp2=0;
	cnt[rt]=1;
	for(int p=head[rt];p;p=edge[p].next){
		if(edge[p].to==f[rt])continue;
		f[edge[p].to]=rt; height[edge[p].to]=height[rt]+1;
		dfs1(edge[p].to); cnt[rt]+=cnt[edge[p].to];
		if(cnt[edge[p].to]>tmp)tmp=cnt[edge[p].to],tmp2=edge[p].to;
	}
	son[rt]=tmp2;
}
int dfs2(int rt,int tp){
	id[rt]=++cid; top[rt]=tp;
	if(son[rt])dfs2(son[rt],tp);
	for(int p=head[rt];p;p=edge[p].next){
		if(edge[p].to==f[rt]||edge[p].to==son[rt])continue;
		dfs2(edge[p].to,edge[p].to);
	}
}
int t[MAXN*4][11],c[MAXN*4];
void insert(int x,int i,int rt,int rtl,int rtr){
	if(rtl==rtr){c[rt]=1;t[rt][0]=x;t[rt][1]=INF;return;}
	int mid=(rtl+rtr)>>1;
	if(i<=mid)insert(x,i,rt*2,rtl,mid);
	else insert(x,i,rt*2+1,mid+1,rtr);
	c[rt]=min(10,c[rt*2]+c[rt*2+1]);
	int i1=0,i2=0;
	for(int i=0;i!=c[rt];++i){
		if(t[rt*2][i1]<t[rt*2+1][i2])t[rt][i]=t[rt*2][i1++];
		else t[rt][i]=t[rt*2+1][i2++];
	}
	t[rt][c[rt]]=INF;
}
void _query(int l,int r,int rt,int rtl,int rtr,int *res){
	if(l==rtl&&r==rtr){
		for(int i=0;i!=11;++i)res[i]=t[rt][i];
		return;
	}
	int mid=(rtl+rtr)>>1;
	if(r<=mid){
		int a[11]; _query(l,r,rt*2,rtl,mid,a);
		for(int i=0;i!=11;++i)res[i]=a[i];
	}else if(l>mid){
		int a[11]; _query(l,r,rt*2+1,mid+1,rtr,a);
		for(int i=0;i!=11;++i)res[i]=a[i];
	}else{
		int a[11],b[11],c[11],i=0,j=0;
		_query(l,mid,rt*2,rtl,mid,a);
		_query(mid+1,r,rt*2+1,mid+1,rtr,b);
		for(;a[i]!=INF||b[j]!=INF;){
			if(a[i]<b[j])c[i+j]=a[i],++i;
			else c[i+j]=b[j],++j;
		}
		c[i+j]=INF;
		for(int k=0;k<=i+j;++k)res[k]=c[k];
	}
}
void query(int u,int v,int *res){
	int topu=top[u],topv=top[v],tmp[11],tmp2[11];
	tmp2[0]=INF;
	while(topu!=topv){
		if(height[topu]<height[topv]){
			swap(topu,topv); swap(u,v);
		}
		int a[11]; _query(id[topu],id[u],1,1,n,a);
		int i=0,j=0;
		for(;tmp2[j]!=INF||a[i]!=INF;){
			if(tmp2[j]<a[i])tmp[i+j]=tmp2[j],++j;
			else tmp[i+j]=a[i],++i;
		}
		for(int k=0;k!=i+j;++k)tmp2[k]=tmp[k];
		tmp2[i+j]=INF;
		u=f[topu]; topu=top[u];
	}
	if(height[u]<height[v])swap(u,v);
	int a[11]; _query(id[v],id[u],1,1,n,a);
	int i=0,j=0;
	for(;tmp2[j]!=INF||a[i]!=INF;){
		if(tmp2[j]<a[i])tmp[i+j]=tmp2[j],++j;
		else tmp[i+j]=a[i],++i;
	}
	for(int k=0;k!=i+j;++k)tmp2[k]=tmp[k];
	tmp2[i+j]=INF;
	for(int i=0;tmp2[i]!=INF;++i)res[i]=tmp2[i];
	res[i+j]=INF;
}
int cd[MAXN];
int main(){
	int m,q,tmp;scanf("%d%d%d",&n,&m,&q);
	for(int i=1;i<=n-1;++i){
		int u,v; scanf("%d%d",&u,&v);
		addedge(u,v);
	}
	dfs1(1); dfs2(1,1);
	for(int i=0;i!=4*MAXN;++i)t[i][0]=INF;
	for(int i=1;i<=m;++i)
		scanf("%d",&tmp),insert(i,id[tmp],1,1,n);
	for(int i=1;i<=q;++i){
		int u,v,g[11],a,cnt=0; scanf("%d%d%d",&u,&v,&a);
		query(u,v,g);
		for(int j=0;j!=a&&g[j]!=INF;++j)++cnt;
		printf("%d ",cnt);
		for(int j=0;j!=cnt;++j)printf("%d ",g[j]);
		printf("\n");
	}
}


#include<cstdio>
#define MAXN 100001
#define INF 1500000000
int n;
int min(int x,int y){return x<y?x:y;}
void swap(int &x,int &y){int t=x;x=y;y=t;}
struct Edge{
	int to,next;
};
int head[MAXN],tot;
Edge edge[MAXN*2];
void addedge(int u,int v){
	edge[++tot].to=v; edge[tot].next=head[u]; head[u]=tot;
	edge[++tot].to=u; edge[tot].next=head[v]; head[v]=tot;
}
int height[MAXN],f[MAXN],top[MAXN],id[MAXN],cid,cnt[MAXN],son[MAXN];
int dfs1(int rt){
	int tmp=0,tmp2=0;
	cnt[rt]=1;
	for(int p=head[rt];p;p=edge[p].next){
		if(edge[p].to==f[rt])continue;
		f[edge[p].to]=rt; height[edge[p].to]=height[rt]+1;
		dfs1(edge[p].to); cnt[rt]+=cnt[edge[p].to];
		if(cnt[edge[p].to]>tmp)tmp=cnt[edge[p].to],tmp2=edge[p].to;
	}
	son[rt]=tmp2;
}
int dfs2(int rt,int tp){
	id[rt]=++cid; top[rt]=tp;
	if(son[rt])dfs2(son[rt],tp);
	for(int p=head[rt];p;p=edge[p].next){
		if(edge[p].to==f[rt]||edge[p].to==son[rt])continue;
		dfs2(edge[p].to,edge[p].to);
	}
}
int t[MAXN*4][11],c[MAXN*4];
void insert(int x,int i,int rt,int rtl,int rtr){
	if(rtl==rtr){c[rt]=1;t[rt][0]=x;t[rt][1]=INF;return;}
	int mid=(rtl+rtr)>>1;
	if(i<=mid)insert(x,i,rt*2,rtl,mid);
	else insert(x,i,rt*2+1,mid+1,rtr);
	c[rt]=min(10,c[rt*2]+c[rt*2+1]);
	int i1=0,i2=0;
	for(int i=0;i!=c[rt];++i){
		if(t[rt*2][i1]<t[rt*2+1][i2])t[rt][i]=t[rt*2][i1++];
		else t[rt][i]=t[rt*2+1][i2++];
	}
	t[rt][c[rt]]=INF;
}
void _query(int l,int r,int rt,int rtl,int rtr,int *res){
	if(l==rtl&&r==rtr){
		for(int i=0;i!=11;++i)res[i]=t[rt][i];
		return;
	}
	int mid=(rtl+rtr)>>1;
	if(r<=mid){
		int a[11]; _query(l,r,rt*2,rtl,mid,a);
		for(int i=0;i!=11;++i)res[i]=a[i];
	}else if(l>mid){
		int a[11]; _query(l,r,rt*2+1,mid+1,rtr,a);
		for(int i=0;i!=11;++i)res[i]=a[i];
	}else{
		int a[11],b[11],c[11],i=0,j=0;
		_query(l,mid,rt*2,rtl,mid,a);
		_query(mid+1,r,rt*2+1,mid+1,rtr,b);
		for(;a[i]!=INF||b[j]!=INF;){
			if(a[i]<b[j])c[i+j]=a[i],++i;
			else c[i+j]=b[j],++j;
		}
		c[i+j]=INF;
		for(int k=0;k<=i+j;++k)res[k]=c[k];
	}
}
void query(int u,int v,int *res){
	int topu=top[u],topv=top[v],tmp[11],tmp2[11];
	tmp2[0]=INF;
	while(topu!=topv){
		if(height[topu]<height[topv]){
			swap(topu,topv); swap(u,v);
		}
		int a[11]; _query(id[topu],id[u],1,1,n,a);
		int i=0,j=0;
		for(;tmp2[j]!=INF||a[i]!=INF;){
			if(tmp2[j]<a[i])tmp[i+j]=tmp2[j],++j;
			else tmp[i+j]=a[i],++i;
		}
		for(int k=0;k!=i+j;++k)tmp2[k]=tmp[k];
		tmp2[i+j]=INF;
		u=f[topu]; topu=top[u];
	}
	if(height[u]<height[v])swap(u,v);
	int a[11]; _query(id[v],id[u],1,1,n,a);
	int i=0,j=0;
	for(;tmp2[j]!=INF||a[i]!=INF;){
		if(tmp2[j]<a[i])tmp[i+j]=tmp2[j],++j;
		else tmp[i+j]=a[i],++i;
	}
	for(int k=0;k!=i+j;++k)tmp2[k]=tmp[k];
	tmp2[i+j]=INF;
	for(int i=0;tmp2[i]!=INF;++i)res[i]=tmp2[i];
	res[i+j]=INF;
}
int cd[MAXN];
int main(){
	int m,q,tmp;scanf("%d%d%d",&n,&m,&q);
	for(int i=1;i<=n-1;++i){
		int u,v; scanf("%d%d",&u,&v);
		addedge(u,v);
	}
	dfs1(1); dfs2(1,1);
	for(int i=0;i!=4*MAXN;++i)t[i][0]=INF;
	for(int i=1;i<=m;++i)
		scanf("%d",&tmp),insert(i,id[tmp],1,1,n);
	for(int i=1;i<=q;++i){
		int u,v,g[11],a,cnt=0; scanf("%d%d%d",&u,&v,&a);
		query(u,v,g);
		for(int j=0;j!=a&&g[j]!=INF;++j)++cnt;
		printf("%d ",cnt);
		for(int j=0;j!=cnt;++j)printf("%d ",g[j]);
		printf("\n");
	}
}


#include<cstdio>
#define MAXN 100001
#define INF 1500000000
int n;
int min(int x,int y){return x<y?x:y;}
void swap(int &x,int &y){int t=x;x=y;y=t;}
struct Edge{
	int to,next;
};
int head[MAXN],tot;
Edge edge[MAXN*2];
void addedge(int u,int v){
	edge[++tot].to=v; edge[tot].next=head[u]; head[u]=tot;
	edge[++tot].to=u; edge[tot].next=head[v]; head[v]=tot;
}
int height[MAXN],f[MAXN],top[MAXN],id[MAXN],cid,cnt[MAXN],son[MAXN];
int dfs1(int rt){
	int tmp=0,tmp2=0;
	cnt[rt]=1;
	for(int p=head[rt];p;p=edge[p].next){
		if(edge[p].to==f[rt])continue;
		f[edge[p].to]=rt; height[edge[p].to]=height[rt]+1;
		dfs1(edge[p].to); cnt[rt]+=cnt[edge[p].to];
		if(cnt[edge[p].to]>tmp)tmp=cnt[edge[p].to],tmp2=edge[p].to;
	}
	son[rt]=tmp2;
}
int dfs2(int rt,int tp){
	id[rt]=++cid; top[rt]=tp;
	if(son[rt])dfs2(son[rt],tp);
	for(int p=head[rt];p;p=edge[p].next){
		if(edge[p].to==f[rt]||edge[p].to==son[rt])continue;
		dfs2(edge[p].to,edge[p].to);
	}
}
int t[MAXN*4][11],c[MAXN*4];
void insert(int x,int it,int rt,int rtl,int rtr){
	if(rtl==rtr){
		int a[11],b[2];b[0]=x;b[1]=INF;
		int i=0,j=0;
		for(;(t[rt][i]!=INF||b[j]!=INF)&&i+j<10;){
			if(t[rt][i]<b[j])a[i+j]=t[rt][i],++i;
			else a[i+j]=b[j],++j;
		}
		a[i+j]=INF;
		for(int k=0;k<=i+j;++k)t[rt][k]=a[k];
		c[rt]=0; while(t[rt][c[rt]]!=INF)++c[rt];
		return;
	}
	int mid=(rtl+rtr)>>1;
	if(it<=mid)insert(x,it,rt*2,rtl,mid);
	else insert(x,it,rt*2+1,mid+1,rtr);
	c[rt]=min(10,c[rt*2]+c[rt*2+1]);
	int i1=0,i2=0;
	for(int i=0;i!=c[rt];++i){
		if(t[rt*2][i1]<t[rt*2+1][i2])t[rt][i]=t[rt*2][i1++];
		else t[rt][i]=t[rt*2+1][i2++];
	}
	t[rt][c[rt]]=INF;
}
void _query(int l,int r,int rt,int rtl,int rtr,int *res){
	if(l==rtl&&r==rtr){
		for(int i=0;i!=11;++i)res[i]=t[rt][i];
		return;
	}
	int mid=(rtl+rtr)>>1;
	if(r<=mid){
		int a[11]; _query(l,r,rt*2,rtl,mid,a);
		for(int i=0;i!=11;++i)res[i]=a[i];
	}else if(l>mid){
		int a[11]; _query(l,r,rt*2+1,mid+1,rtr,a);
		for(int i=0;i!=11;++i)res[i]=a[i];
	}else{
		int a[11],b[11],c[11],i=0,j=0;
		_query(l,mid,rt*2,rtl,mid,a);
		_query(mid+1,r,rt*2+1,mid+1,rtr,b);
		for(;(a[i]!=INF||b[j]!=INF)&&i+j<10;){
			if(a[i]<b[j])c[i+j]=a[i],++i;
			else c[i+j]=b[j],++j;
		}
		c[i+j]=INF;
		for(int k=0;k<=i+j;++k)res[k]=c[k];
	}
}
void query(int u,int v,int *res){
	int topu=top[u],topv=top[v],tmp[11],tmp2[11];
	tmp2[0]=INF;
	while(topu!=topv){
		if(height[topu]<height[topv]){
			swap(topu,topv); swap(u,v);
		}
		int a[11]; _query(id[topu],id[u],1,1,n,a);
		int i=0,j=0;
		for(;(tmp2[j]!=INF||a[i]!=INF)&&i+j<10;){
			if(tmp2[j]<a[i])tmp[i+j]=tmp2[j],++j;
			else tmp[i+j]=a[i],++i;
		}
		for(int k=0;k!=i+j;++k)tmp2[k]=tmp[k];
		tmp2[i+j]=INF;
		u=f[topu]; topu=top[u];
	}
	if(height[u]<height[v])swap(u,v);
	int a[11]; _query(id[v],id[u],1,1,n,a);
	int i=0,j=0;
	for(;(tmp2[j]!=INF||a[i]!=INF)&&i+j<10;){
		if(tmp2[j]<a[i])tmp[i+j]=tmp2[j],++j;
		else tmp[i+j]=a[i],++i;
	}
	for(int k=0;k!=i+j;++k)tmp2[k]=tmp[k];
	tmp2[i+j]=INF;
	for(int i=0;tmp2[i]!=INF;++i)res[i]=tmp2[i];
	res[i+j]=INF;
}
int cd[MAXN];
int main(){
	int m,q,tmp;scanf("%d%d%d",&n,&m,&q);
	for(int i=1;i<=n-1;++i){
		int u,v; scanf("%d%d",&u,&v);
		addedge(u,v);
	}
	dfs1(1); dfs2(1,1);
	for(int i=0;i!=4*MAXN;++i)t[i][0]=INF;
	for(int i=1;i<=m;++i)
		scanf("%d",&tmp),insert(i,id[tmp],1,1,n);
	for(int i=1;i<=q;++i){
 		int u,v,g[11],a,cnt=0; scanf("%d%d%d",&u,&v,&a);
		query(u,v,g);
		for(int j=0;j!=a&&g[j]!=INF;++j)++cnt;
		printf("%d ",cnt);
		for(int j=0;j!=cnt;++j)printf("%d ",g[j]);
		printf("\n");
	}
}


#include<cstdio>
#define MAXN 100001
#define INF 1500000000
int n;
int min(int x,int y){return x<y?x:y;}
void swap(int &x,int &y){int t=x;x=y;y=t;}
struct Edge{
	int to,next;
};
int head[MAXN],tot;
Edge edge[MAXN*2];
void addedge(int u,int v){
	edge[++tot].to=v; edge[tot].next=head[u]; head[u]=tot;
	edge[++tot].to=u; edge[tot].next=head[v]; head[v]=tot;
}
int height[MAXN],f[MAXN],top[MAXN],id[MAXN],cid,cnt[MAXN],son[MAXN];
int dfs1(int rt){
	int tmp=0,tmp2=0;
	cnt[rt]=1;
	for(int p=head[rt];p;p=edge[p].next){
		if(edge[p].to==f[rt])continue;
		f[edge[p].to]=rt; height[edge[p].to]=height[rt]+1;
		dfs1(edge[p].to); cnt[rt]+=cnt[edge[p].to];
		if(cnt[edge[p].to]>tmp)tmp=cnt[edge[p].to],tmp2=edge[p].to;
	}
	son[rt]=tmp2;
}
int dfs2(int rt,int tp){
	id[rt]=++cid; top[rt]=tp;
	if(son[rt])dfs2(son[rt],tp);
	for(int p=head[rt];p;p=edge[p].next){
		if(edge[p].to==f[rt]||edge[p].to==son[rt])continue;
		dfs2(edge[p].to,edge[p].to);
	}
}
int t[MAXN*4][11],c[MAXN*4];
void insert(int x,int it,int rt,int rtl,int rtr){
	if(rtl==rtr){
		int a[11],b[2];b[0]=x;b[1]=INF;
		int i=0,j=0;
		for(;(t[rt][i]!=INF||b[j]!=INF)&&i+j<10;){
			if(t[rt][i]<b[j])a[i+j]=t[rt][i],++i;
			else a[i+j]=b[j],++j;
		}
		a[i+j]=INF;
		for(int k=0;k<=i+j;++k)t[rt][k]=a[k];
		c[rt]=0; while(t[rt][c[rt]]!=INF)++c[rt];
		return;
	}
	int mid=(rtl+rtr)>>1;
	if(it<=mid)insert(x,it,rt*2,rtl,mid);
	else insert(x,it,rt*2+1,mid+1,rtr);
	c[rt]=min(10,c[rt*2]+c[rt*2+1]);
	int i1=0,i2=0;
	for(int i=0;i!=c[rt];++i){
		if(t[rt*2][i1]<t[rt*2+1][i2])t[rt][i]=t[rt*2][i1++];
		else t[rt][i]=t[rt*2+1][i2++];
	}
	t[rt][c[rt]]=INF;
}
void _query(int l,int r,int rt,int rtl,int rtr,int *res){
	if(l==rtl&&r==rtr){
		for(int i=0;i!=11;++i)res[i]=t[rt][i];
		return;
	}
	int mid=(rtl+rtr)>>1;
	if(r<=mid){
		int a[11]; _query(l,r,rt*2,rtl,mid,a);
		for(int i=0;i!=11;++i)res[i]=a[i];
	}else if(l>mid){
		int a[11]; _query(l,r,rt*2+1,mid+1,rtr,a);
		for(int i=0;i!=11;++i)res[i]=a[i];
	}else{
		int a[11],b[11],c[11],i=0,j=0;
		_query(l,mid,rt*2,rtl,mid,a);
		_query(mid+1,r,rt*2+1,mid+1,rtr,b);
		for(;(a[i]!=INF||b[j]!=INF)&&i+j<10;){
			if(a[i]<b[j])c[i+j]=a[i],++i;
			else c[i+j]=b[j],++j;
		}
		c[i+j]=INF;
		for(int k=0;k<=i+j;++k)res[k]=c[k];
	}
}
void query(int u,int v,int *res){
	int topu=top[u],topv=top[v],tmp[11],tmp2[11];
	tmp2[0]=INF;
	while(topu!=topv){
		if(height[topu]<height[topv]){
			swap(topu,topv); swap(u,v);
		}
		int a[11]; _query(id[topu],id[u],1,1,n,a);
		int i=0,j=0;
		for(;(tmp2[j]!=INF||a[i]!=INF)&&i+j<10;){
			if(tmp2[j]<a[i])tmp[i+j]=tmp2[j],++j;
			else tmp[i+j]=a[i],++i;
		}
		for(int k=0;k!=i+j;++k)tmp2[k]=tmp[k];
		tmp2[i+j]=INF;
		u=f[topu]; topu=top[u];
	}
	if(height[u]<height[v])swap(u,v);
	int a[11]; _query(id[v],id[u],1,1,n,a);
	int i=0,j=0;
	for(;tmp2[j]!=INF||a[i]!=INF;){
		if(tmp2[j]<a[i])tmp[i+j]=tmp2[j],++j;
		else tmp[i+j]=a[i],++i;
	}
	for(int k=0;k!=i+j;++k)tmp2[k]=tmp[k];
	tmp2[i+j]=INF;
	for(int i=0;tmp2[i]!=INF;++i)res[i]=tmp2[i];
	res[i+j]=INF;
}
int cd[MAXN];
int main(){
	int m,q,tmp;scanf("%d%d%d",&n,&m,&q);
	for(int i=1;i<=n-1;++i){
		int u,v; scanf("%d%d",&u,&v);
		addedge(u,v);
	}
	dfs1(1); dfs2(1,1);
	for(int i=0;i!=4*MAXN;++i)t[i][0]=INF;
	for(int i=1;i<=m;++i)
		scanf("%d",&tmp),insert(i,id[tmp],1,1,n);
	for(int i=1;i<=q;++i){
 		int u,v,g[11],a,cnt=0; scanf("%d%d%d",&u,&v,&a);
		query(u,v,g);
		for(int j=0;j!=a&&g[j]!=INF;++j)++cnt;
		printf("%d ",cnt);
		for(int j=0;j!=cnt;++j)printf("%d ",g[j]);
		printf("\n");
	}
}


#include<cstdio>
#define MAXN 100001
#define INF 1500000000
int n;
int min(int x,int y){return x<y?x:y;}
void swap(int &x,int &y){int t=x;x=y;y=t;}
struct Edge{
	int to,next;
};
int head[MAXN],tot;
Edge edge[MAXN*2];
void addedge(int u,int v){
	edge[++tot].to=v; edge[tot].next=head[u]; head[u]=tot;
	edge[++tot].to=u; edge[tot].next=head[v]; head[v]=tot;
}
int height[MAXN],f[MAXN],top[MAXN],id[MAXN],cid,cnt[MAXN],son[MAXN];
int dfs1(int rt){
	int tmp=0,tmp2=0;
	cnt[rt]=1;
	for(int p=head[rt];p;p=edge[p].next){
		if(edge[p].to==f[rt])continue;
		f[edge[p].to]=rt; height[edge[p].to]=height[rt]+1;
		dfs1(edge[p].to); cnt[rt]+=cnt[edge[p].to];
		if(cnt[edge[p].to]>tmp)tmp=cnt[edge[p].to],tmp2=edge[p].to;
	}
	son[rt]=tmp2;
}
int dfs2(int rt,int tp){
	id[rt]=++cid; top[rt]=tp;
	if(son[rt])dfs2(son[rt],tp);
	for(int p=head[rt];p;p=edge[p].next){
		if(edge[p].to==f[rt]||edge[p].to==son[rt])continue;
		dfs2(edge[p].to,edge[p].to);
	}
}
int t[MAXN*4][11],c[MAXN*4];
void insert(int x,int it,int rt,int rtl,int rtr){
	if(rtl==rtr){
		int a[11],b[2];b[0]=x;b[1]=INF;
		int i=0,j=0;
		for(;(t[rt][i]!=INF||b[j]!=INF)&&i+j<10;){
			if(t[rt][i]<b[j])a[i+j]=t[rt][i],++i;
			else a[i+j]=b[j],++j;
		}
		a[i+j]=INF;
		for(int k=0;k<=i+j;++k)t[rt][k]=a[k];
		c[rt]=0; while(t[rt][c[rt]]!=INF)++c[rt];
		return;
	}
	int mid=(rtl+rtr)>>1;
	if(it<=mid)insert(x,it,rt*2,rtl,mid);
	else insert(x,it,rt*2+1,mid+1,rtr);
	c[rt]=min(10,c[rt*2]+c[rt*2+1]);
	int i1=0,i2=0;
	for(int i=0;i!=c[rt];++i){
		if(t[rt*2][i1]<t[rt*2+1][i2])t[rt][i]=t[rt*2][i1++];
		else t[rt][i]=t[rt*2+1][i2++];
	}
	t[rt][c[rt]]=INF;
}
void _query(int l,int r,int rt,int rtl,int rtr,int *res){
	if(l==rtl&&r==rtr){
		for(int i=0;i!=11;++i)res[i]=t[rt][i];
		return;
	}
	int mid=(rtl+rtr)>>1;
	if(r<=mid){
		int a[11]; _query(l,r,rt*2,rtl,mid,a);
		for(int i=0;i!=11;++i)res[i]=a[i];
	}else if(l>mid){
		int a[11]; _query(l,r,rt*2+1,mid+1,rtr,a);
		for(int i=0;i!=11;++i)res[i]=a[i];
	}else{
		int a[11],b[11],c[11],i=0,j=0;
		_query(l,mid,rt*2,rtl,mid,a);
		_query(mid+1,r,rt*2+1,mid+1,rtr,b);
		for(;a[i]!=INF||b[j]!=INF;){
			if(a[i]<b[j])c[i+j]=a[i],++i;
			else c[i+j]=b[j],++j;
		}
		c[i+j]=INF;
		for(int k=0;k<=i+j;++k)res[k]=c[k];
	}
}
void query(int u,int v,int *res){
	int topu=top[u],topv=top[v],tmp[11],tmp2[11];
	tmp2[0]=INF;
	while(topu!=topv){
		if(height[topu]<height[topv]){
			swap(topu,topv); swap(u,v);
		}
		int a[11]; _query(id[topu],id[u],1,1,n,a);
		int i=0,j=0;
		for(;tmp2[j]!=INF||a[i]!=INF;){
			if(tmp2[j]<a[i])tmp[i+j]=tmp2[j],++j;
			else tmp[i+j]=a[i],++i;
		}
		for(int k=0;k!=i+j;++k)tmp2[k]=tmp[k];
		tmp2[i+j]=INF;
		u=f[topu]; topu=top[u];
	}
	if(height[u]<height[v])swap(u,v);
	int a[11]; _query(id[v],id[u],1,1,n,a);
	int i=0,j=0;
	for(;tmp2[j]!=INF||a[i]!=INF;){
		if(tmp2[j]<a[i])tmp[i+j]=tmp2[j],++j;
		else tmp[i+j]=a[i],++i;
	}
	for(int k=0;k!=i+j;++k)tmp2[k]=tmp[k];
	tmp2[i+j]=INF;
	for(int i=0;tmp2[i]!=INF;++i)res[i]=tmp2[i];
	res[i+j]=INF;
}
int cd[MAXN];
int main(){
	int m,q,tmp;scanf("%d%d%d",&n,&m,&q);
	for(int i=1;i<=n-1;++i){
		int u,v; scanf("%d%d",&u,&v);
		addedge(u,v);
	}
	dfs1(1); dfs2(1,1);
	for(int i=0;i!=4*MAXN;++i)t[i][0]=INF;
	for(int i=1;i<=m;++i)
		scanf("%d",&tmp),insert(i,id[tmp],1,1,n);
	for(int i=1;i<=q;++i){
		int u,v,g[11],a,cnt=0; scanf("%d%d%d",&u,&v,&a);
		query(u,v,g);
		for(int j=0;j!=a&&g[j]!=INF;++j)++cnt;
		printf("%d ",cnt);
		for(int j=0;j!=cnt;++j)printf("%d ",g[j]);
		printf("\n");
	}
}


#include<cstdio>
#define MAXN 100001
#define INF 1500000000
int n;
int min(int x,int y){return x<y?x:y;}
void swap(int &x,int &y){int t=x;x=y;y=t;}
struct Edge{
	int to,next;
};
int head[MAXN],tot;
Edge edge[MAXN*2];
void addedge(int u,int v){
	edge[++tot].to=v; edge[tot].next=head[u]; head[u]=tot;
	edge[++tot].to=u; edge[tot].next=head[v]; head[v]=tot;
}
int height[MAXN],f[MAXN],top[MAXN],id[MAXN],cid,cnt[MAXN],son[MAXN];
int dfs1(int rt){
	int tmp=0,tmp2=0;
	cnt[rt]=1;
	for(int p=head[rt];p;p=edge[p].next){
		if(edge[p].to==f[rt])continue;
		f[edge[p].to]=rt; height[edge[p].to]=height[rt]+1;
		dfs1(edge[p].to); cnt[rt]+=cnt[edge[p].to];
		if(cnt[edge[p].to]>tmp)tmp=cnt[edge[p].to],tmp2=edge[p].to;
	}
	son[rt]=tmp2;
}
int dfs2(int rt,int tp){
	id[rt]=++cid; top[rt]=tp;
	if(son[rt])dfs2(son[rt],tp);
	for(int p=head[rt];p;p=edge[p].next){
		if(edge[p].to==f[rt]||edge[p].to==son[rt])continue;
		dfs2(edge[p].to,edge[p].to);
	}
}
int t[MAXN*4][11],c[MAXN*4];
void insert(int x,int i,int rt,int rtl,int rtr){
	if(rtl==rtr){++c[rt];t[rt][c[rt]-1]=x;t[rt][c[rt]]=INF;return;}
	int mid=(rtl+rtr)>>1;
	if(i<=mid)insert(x,i,rt*2,rtl,mid);
	else insert(x,i,rt*2+1,mid+1,rtr);
	c[rt]=min(10,c[rt*2]+c[rt*2+1]);
	int i1=0,i2=0;
	for(int i=0;i!=c[rt];++i){
		if(t[rt*2][i1]<t[rt*2+1][i2])t[rt][i]=t[rt*2][i1++];
		else t[rt][i]=t[rt*2+1][i2++];
	}
	t[rt][c[rt]]=INF;
}
void _query(int l,int r,int rt,int rtl,int rtr,int *res){
	if(l==rtl&&r==rtr){
		for(int i=0;i!=11;++i)res[i]=t[rt][i];
		return;
	}
	int mid=(rtl+rtr)>>1;
	if(r<=mid){
		int a[11]; _query(l,r,rt*2,rtl,mid,a);
		for(int i=0;i!=11;++i)res[i]=a[i];
	}else if(l>mid){
		int a[11]; _query(l,r,rt*2+1,mid+1,rtr,a);
		for(int i=0;i!=11;++i)res[i]=a[i];
	}else{
		int a[11],b[11],c[11],i=0,j=0;
		_query(l,mid,rt*2,rtl,mid,a);
		_query(mid+1,r,rt*2+1,mid+1,rtr,b);
		for(;a[i]!=INF||b[j]!=INF;){
			if(a[i]<b[j])c[i+j]=a[i],++i;
			else c[i+j]=b[j],++j;
		}
		c[i+j]=INF;
		for(int k=0;k<=i+j;++k)res[k]=c[k];
	}
}
void query(int u,int v,int *res){
	int topu=top[u],topv=top[v],tmp[11],tmp2[11];
	tmp2[0]=INF;
	while(topu!=topv){
		if(height[topu]<height[topv]){
			swap(topu,topv); swap(u,v);
		}
		int a[11]; _query(id[topu],id[u],1,1,n,a);
		int i=0,j=0;
		for(;tmp2[j]!=INF||a[i]!=INF;){
			if(tmp2[j]<a[i])tmp[i+j]=tmp2[j],++j;
			else tmp[i+j]=a[i],++i;
		}
		for(int k=0;k!=i+j;++k)tmp2[k]=tmp[k];
		tmp2[i+j]=INF;
		u=f[topu]; topu=top[u];
	}
	if(height[u]<height[v])swap(u,v);
	int a[11]; _query(id[v],id[u],1,1,n,a);
	int i=0,j=0;
	for(;tmp2[j]!=INF||a[i]!=INF;){
		if(tmp2[j]<a[i])tmp[i+j]=tmp2[j],++j;
		else tmp[i+j]=a[i],++i;
	}
	for(int k=0;k!=i+j;++k)tmp2[k]=tmp[k];
	tmp2[i+j]=INF;
	for(int i=0;tmp2[i]!=INF;++i)res[i]=tmp2[i];
	res[i+j]=INF;
}
int cd[MAXN];
int main(){
	int m,q,tmp;scanf("%d%d%d",&n,&m,&q);
	for(int i=1;i<=n-1;++i){
		int u,v; scanf("%d%d",&u,&v);
		addedge(u,v);
	}
	dfs1(1); dfs2(1,1);
	for(int i=0;i!=4*MAXN;++i)t[i][0]=INF;
	for(int i=1;i<=m;++i)
		scanf("%d",&tmp),insert(i,id[tmp],1,1,n);
	for(int i=1;i<=q;++i){
		int u,v,g[11],a,cnt=0; scanf("%d%d%d",&u,&v,&a);
		query(u,v,g);
		for(int j=0;j!=a&&g[j]!=INF;++j)++cnt;
		printf("%d ",cnt);
		for(int j=0;j!=cnt;++j)printf("%d ",g[j]);
		printf("\n");
	}
}


#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;
#define N_MAX 100010
#define A_MAX 11
#define LOG_MAX 18
#define FOR(i, v) for(vector<int>::iterator it = v.begin(); it != v.end(); it++)
vector<int> G[N_MAX];
vector<int> C[N_MAX];
int RG[LOG_MAX][N_MAX][A_MAX];
int n, m, q, logn;
int viz[N_MAX], D[N_MAX];
void dfs(int x) {
    viz[x] = 1;
    FOR(i, G[x]) {
        if (!viz[*it]) {
            RG[0][*it][0] = x;
            viz[*it] = 1;
            D[*it] = D[x] + 1;
            dfs(*it);
        }
    }
}

void merge_arrays(int v_dest[], int src1[], int src2[]) {
    int i1 = 1, i2 = 1;
    int cnt = 1;
    while (i1 < A_MAX && i2 < A_MAX && cnt < A_MAX && src1[i1] > 0 && src2[i2] > 0){
        if (src1[i1] < src2[i2]) {
            v_dest[cnt++] = src1[i1];
            i1++;
        } else if (src1[i1] == src2[i2]) {
            v_dest[cnt++] = src1[i1];
            i1++;
            i2++;
        }else {
            v_dest[cnt++] = src2[i2];
            i2++;
        }
    }
    while (i1 < A_MAX && src1[i1] > 0 && cnt < A_MAX) {
        v_dest[cnt++] = src1[i1];
        i1++;
    }

    while (i2 < A_MAX && src2[i2] > 0 && cnt < A_MAX) {
        v_dest[cnt++] = src2[i2];
        i2++;
    }
    for (int i = cnt; i < A_MAX; i++) {
        v_dest[i] = 0;
    }
}

void lca_compute() {
    dfs(1);
    int aux1[A_MAX], aux2[N_MAX];

    for (int i = 1; i <= n; i++) {
        memset(aux1, 0, sizeof(aux1));
        memset(aux2, 0, sizeof(aux2));
        for (int j = 0; j < (int)C[i].size(); j++) {
            aux2[j + 1] = C[i][j];
        }
        int t = RG[0][i][0];
        for (int j = 0; j < (int)C[t].size(); j++) {
            aux1[j + 1] = C[t][j];
        }
        merge_arrays(RG[0][i], aux1, aux2);
    }
    for (logn = 0; (1 << logn) <= n; logn++);
    logn--;

    for (int j = 1; j <= logn; j++) {
        for (int i = 1; i <= n; i++) {
            RG[j][i][0] = RG[j - 1][RG[j - 1][i][0]][0];
            merge_arrays(RG[j][i], RG[j - 1][i], RG[j - 1][RG[j-1][i][0]]);
        }
    }
}

int lca_query(int x, int y, int sol[]) {
    memset(sol, 0, A_MAX * sizeof(int));
    if (x == y) {
        for (int i = 0; i < (int)C[x].size() && i + 1 < A_MAX; i++) {
            sol[i + 1] = C[x][i];
        }
        return x;
    }
    if (D[y] > D[x]) {
        swap(x, y);
    }
    static int sol1[A_MAX], sol2[A_MAX], aux1[A_MAX], aux2[A_MAX];
    memset(sol1, 0, sizeof(sol1));
    memset(sol2, 0, sizeof(sol2));

    memset(aux1, 0, sizeof(aux1));
    memset(aux2, 0, sizeof(aux2));

    for (int j = logn; j >= 0; j--) {
        if (RG[j][x][0] && D[RG[j][x][0]] >= D[y]) {
            merge_arrays(aux1, RG[j][x], sol1);
            x = RG[j][x][0];
            memcpy(sol1, aux1, A_MAX * sizeof(int));
        }
    }

    if (x == y) {
        memcpy(sol, sol1, A_MAX * sizeof(int));
        return x;
    }
    for (int j = logn; j >= 0; j--) {
        if (RG[j][x][0] && RG[j][y][0] && RG[j][x][0] != RG[j][y][0]) {
            merge_arrays(aux1, RG[j][x], sol1);
            merge_arrays(aux2, RG[j][y], sol2);

            memcpy(sol1, aux1, A_MAX * sizeof(int));
            memcpy(sol2, aux2, A_MAX * sizeof(int));

            x = RG[j][x][0];
            y = RG[j][y][0];
        }
    }
    merge_arrays(aux1, RG[0][x], sol1);
    merge_arrays(aux2, RG[0][y], sol2);

    merge_arrays(sol, aux1, aux2);
    return RG[0][x][0];
}
void solve() {
    scanf("%d%d%d", &n, &m, &q);
    for (int i = 1; i < n; i++) {
        int x, y;
        scanf("%d%d", &x, &y);
        G[x].push_back(y);
    }
    for (int i = 1; i <= m; i++) {
        int x;
        scanf("%d", &x);
        C[x].push_back(i);
    }
    lca_compute();
    int sol[A_MAX];
    for (int i = 1; i <= q; i++) {
        int x, y, a;
        scanf("%d%d%d", &x, &y, &a);
        int strm = lca_query(x, y, sol);
        //printf("%d ---", strm);
        int c = 0;
        for (int i = 1; i < A_MAX; i++) {
            if (sol[i] != 0) {
                c ++;
            } else {
                break;
            }
        }
        c = min(c, a);
        printf("%d ", c);
        for (int i = 1; i <= c; i++) {
            printf("%d ", sol[i]);
        }
        printf("\n");
    }
}

int main() {
  //  freopen("input", "r", stdin);
  //  freopen("output", "w", stdout);

    solve();
    return 0;
}


#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;
#define N_MAX 100010
#define A_MAX 11
#define LOG_MAX 18
#define FOR(i, v) for(vector<int>::iterator it = v.begin(); it != v.end(); it++)
vector<int> G[N_MAX];
vector<int> C[N_MAX];
int RG[LOG_MAX][N_MAX][A_MAX];
int n, m, q, logn;
int viz[N_MAX], D[N_MAX];
void dfs(int x) {
    viz[x] = 1;
    FOR(i, G[x]) {
        if (!viz[*it]) {
            RG[0][*it][0] = x;
            viz[*it] = 1;
            D[*it] = D[x] + 1;
            dfs(*it);
        }
    }
}

void merge_arrays(int v_dest[], int src1[], int src2[]) {
    int i1 = 1, i2 = 1;
    int cnt = 1;
    while (i1 < A_MAX && i2 < A_MAX && cnt < A_MAX && src1[i1] > 0 && src2[i2] > 0){
        if (src1[i1] < src2[i2]) {
            v_dest[cnt++] = src1[i1];
            i1++;
        } else if (src1[i1] == src2[i2]) {
            v_dest[cnt++] = src1[i1];
            i1++;
            i2++;
        }else {
            v_dest[cnt++] = src2[i2];
            i2++;
        }
    }
    while (i1 < A_MAX && src1[i1] > 0 && cnt < A_MAX) {
        v_dest[cnt++] = src1[i1];
        i1++;
    }

    while (i2 < A_MAX && src2[i2] > 0 && cnt < A_MAX) {
        v_dest[cnt++] = src2[i2];
        i2++;
    }
    for (int i = cnt; i < A_MAX; i++) {
        v_dest[i] = 0;
    }
}

void lca_compute() {
    dfs(1);
    int aux1[A_MAX], aux2[A_MAX];

    for (int i = 1; i <= n; i++) {
        memset(aux1, 0, sizeof(aux1));
        memset(aux2, 0, sizeof(aux2));
        for (int j = 0; j < (int)C[i].size(); j++) {
            aux2[j + 1] = C[i][j];
        }
        int t = RG[0][i][0];
        for (int j = 0; j < (int)C[t].size(); j++) {
            aux1[j + 1] = C[t][j];
        }
        merge_arrays(RG[0][i], aux1, aux2);
    }
    for (logn = 0; (1 << logn) <= n; logn++);
    logn--;

    for (int j = 1; j <= logn; j++) {
        for (int i = 1; i <= n; i++) {
            RG[j][i][0] = RG[j - 1][RG[j - 1][i][0]][0];
            if (RG[j][i][0]) {
                merge_arrays(RG[j][i], RG[j - 1][i], RG[j - 1][RG[j - 1][i][0]]);
            }
        }
    }
}

int lca_query(int x, int y, int sol[]) {
    memset(sol, 0, A_MAX * sizeof(int));
    if (x == y) {
        for (int i = 0; i < (int)C[x].size() && i + 1 < A_MAX; i++) {
            sol[i + 1] = C[x][i];
        }
        return x;
    }
    if (D[y] > D[x]) {
        swap(x, y);
    }
    static int sol1[A_MAX], sol2[A_MAX], aux1[A_MAX], aux2[A_MAX];
    memset(sol1, 0, sizeof(sol1));
    memset(sol2, 0, sizeof(sol2));

    memset(aux1, 0, sizeof(aux1));
    memset(aux2, 0, sizeof(aux2));

    for (int j = logn; j >= 0; j--) {
        if (RG[j][x][0] && D[RG[j][x][0]] >= D[y]) {
            merge_arrays(aux1, RG[j][x], sol1);
            x = RG[j][x][0];
            memcpy(sol1, aux1, A_MAX * sizeof(int));
        }
    }

    if (x == y) {
        memcpy(sol, sol1, A_MAX * sizeof(int));
        return x;
    }
    for (int j = logn; j >= 0; j--) {
        if (RG[j][x][0] && RG[j][y][0] && RG[j][x][0] != RG[j][y][0]) {
            merge_arrays(aux1, RG[j][x], sol1);
            merge_arrays(aux2, RG[j][y], sol2);

            x = RG[j][x][0];
            y = RG[j][y][0];

            memcpy(sol1, aux1, A_MAX * sizeof(int));
            memcpy(sol2, aux2, A_MAX * sizeof(int));
        }
    }
    merge_arrays(aux1, RG[0][x], sol1);
    merge_arrays(aux2, RG[0][y], sol2);

    merge_arrays(sol, aux1, aux2);
    return RG[0][x][0];
}
void solve() {
    scanf("%d%d%d", &n, &m, &q);
    for (int i = 1; i < n; i++) {
        int x, y;
        scanf("%d%d", &x, &y);
        G[x].push_back(y);
        G[y].push_back(x);
    }
    for (int i = 1; i <= m; i++) {
        int x;
        scanf("%d", &x);
        C[x].push_back(i);
    }
    lca_compute();
    int sol[A_MAX];
    for (int i = 1; i <= q; i++) {
        int x, y, a;
        scanf("%d%d%d", &x, &y, &a);
        int strm = lca_query(x, y, sol);
        //printf("%d ---", strm);
        int c = 0;
        for (int i = 1; i < A_MAX; i++) {
            if (sol[i] != 0) {
                c++;
            } else {
                break;
            }
        }
        c = min(c, a);
        printf("%d ", c);
        for (int i = 1; i <= c; i++) {
            printf("%d ", sol[i]);
        }
        printf("\n");
    }
}

int main() {
   // freopen("input", "r", stdin);
   // freopen("output", "w", stdout);

    solve();
    return 0;
}


#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;
#define N_MAX 100010
#define A_MAX 11
#define LOG_MAX 18
#define FOR(i, v) for(vector<int>::iterator it = v.begin(); it != v.end(); it++)
vector<int> G[N_MAX];
vector<int> C[N_MAX];
int RG[LOG_MAX][N_MAX][A_MAX];
int n, m, q, logn;
int viz[N_MAX], D[N_MAX];
void dfs(int x) {
    viz[x] = 1;
    FOR(i, G[x]) {
        if (!viz[*it]) {
            RG[0][*it][0] = x;
            viz[*it] = 1;
            D[*it] = D[x] + 1;
            dfs(*it);
        }
    }
}

void merge_arrays(int v_dest[], int src1[], int src2[]) {
    int i1 = 1, i2 = 1;
    int cnt = 1;
    while (i1 < A_MAX && i2 < A_MAX && cnt < A_MAX && src1[i1] > 0 && src2[i2] > 0){
        if (src1[i1] < src2[i2]) {
            v_dest[cnt++] = src1[i1];
            i1++;
        } else if (src1[i1] == src2[i2]) {
            v_dest[cnt++] = src1[i1];
            i1++;
            i2++;
        }else {
            v_dest[cnt++] = src2[i2];
            i2++;
        }
    }
    while (i1 < A_MAX && src1[i1] > 0 && cnt < A_MAX) {
        v_dest[cnt++] = src1[i1];
        i1++;
    }

    while (i2 < A_MAX && src2[i2] > 0 && cnt < A_MAX) {
        v_dest[cnt++] = src2[i2];
        i2++;
    }
    for (int i = cnt; i < A_MAX; i++) {
        v_dest[i] = 0;
    }
}

void lca_compute() {
    dfs(1);
    int aux1[A_MAX], aux2[N_MAX];

    for (int i = 1; i <= n; i++) {
        memset(aux1, 0, sizeof(aux1));
        memset(aux2, 0, sizeof(aux2));
        for (int j = 0; j < (int)C[i].size(); j++) {
            aux2[j + 1] = C[i][j];
        }
        int t = RG[0][i][0];
        for (int j = 0; j < (int)C[t].size(); j++) {
            aux1[j + 1] = C[t][j];
        }
        merge_arrays(RG[0][i], aux1, aux2);
    }
    for (logn = 0; (1 << logn) <= n; logn++);
    logn--;

    for (int j = 1; j <= logn; j++) {
        for (int i = 1; i <= n; i++) {
            RG[j][i][0] = RG[j - 1][RG[j - 1][i][0]][0];
            if (RG[j][i][0]) {
                merge_arrays(RG[j][i], RG[j - 1][i], RG[j - 1][RG[j-1][i][0]]);
            }
        }
    }
}

int lca_query(int x, int y, int sol[]) {
    memset(sol, 0, A_MAX * sizeof(int));
    if (x == y) {
        for (int i = 0; i < (int)C[x].size() && i + 1 < A_MAX; i++) {
            sol[i + 1] = C[x][i];
        }
        return x;
    }
    if (D[y] > D[x]) {
        swap(x, y);
    }
    static int sol1[A_MAX], sol2[A_MAX], aux1[A_MAX], aux2[A_MAX];
    memset(sol1, 0, sizeof(sol1));
    memset(sol2, 0, sizeof(sol2));

    memset(aux1, 0, sizeof(aux1));
    memset(aux2, 0, sizeof(aux2));

    for (int j = logn; j >= 0; j--) {
        if (RG[j][x][0] && D[RG[j][x][0]] >= D[y]) {
            merge_arrays(aux1, RG[j][x], sol1);
            x = RG[j][x][0];
            memcpy(sol1, aux1, A_MAX * sizeof(int));
        }
    }

    if (x == y) {
        memcpy(sol, sol1, A_MAX * sizeof(int));
        return x;
    }
    for (int j = logn; j >= 0; j--) {
        if (RG[j][x][0] && RG[j][y][0] && RG[j][x][0] != RG[j][y][0]) {
            merge_arrays(aux1, RG[j][x], sol1);
            merge_arrays(aux2, RG[j][y], sol2);

            memcpy(sol1, aux1, A_MAX * sizeof(int));
            memcpy(sol2, aux2, A_MAX * sizeof(int));

            x = RG[j][x][0];
            y = RG[j][y][0];
        }
    }
    merge_arrays(aux1, RG[0][x], sol1);
    merge_arrays(aux2, RG[0][y], sol2);

    merge_arrays(sol, aux1, aux2);
    return RG[0][x][0];
}
void solve() {
    scanf("%d%d%d", &n, &m, &q);
    for (int i = 1; i < n; i++) {
        int x, y;
        scanf("%d%d", &x, &y);
        G[x].push_back(y);
        G[y].push_back(x);
    }
    for (int i = 1; i <= m; i++) {
        int x;
        scanf("%d", &x);
        C[x].push_back(i);
    }
    lca_compute();
    int sol[A_MAX];
    for (int i = 1; i <= q; i++) {
        int x, y, a;
        scanf("%d%d%d", &x, &y, &a);
        int strm = lca_query(x, y, sol);
        //printf("%d ---", strm);
        int c = 0;
        for (int i = 1; i < A_MAX; i++) {
            if (sol[i] != 0) {
                c ++;
            } else {
                break;
            }
        }
        c = min(c, a);
        printf("%d ", c);
        for (int i = 1; i <= c; i++) {
            printf("%d ", sol[i]);
        }
        printf("\n");
    }
}

int main() {
    //freopen("input", "r", stdin);
    //freopen("output", "w", stdout);

    solve();
    return 0;
}


#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;
#define N_MAX 100010
#define A_MAX 11
#define LOG_MAX 18
#define FOR(i, v) for(vector<int>::iterator it = v.begin(); it != v.end(); it++)
vector<int> G[N_MAX];
vector<int> C[N_MAX];
int RG[LOG_MAX][N_MAX][A_MAX];
int n, m, q, logn;
int viz[N_MAX], D[N_MAX];
void dfs(int x) {
    viz[x] = 1;
    FOR(i, G[x]) {
        if (!viz[*it]) {
            RG[0][*it][0] = x;
            viz[*it] = 1;
            D[*it] = D[x] + 1;
            dfs(*it);
        }
    }
}

void merge_arrays(int v_dest[], int src1[], int src2[]) {
    int i1 = 1, i2 = 1;
    int cnt = 1;
    while (i1 < A_MAX && i2 < A_MAX && cnt < A_MAX && src1[i1] > 0 && src2[i2] > 0){
        if (src1[i1] < src2[i2]) {
            v_dest[cnt++] = src1[i1];
            i1++;
        } else if (src1[i1] == src2[i2]) {
            v_dest[cnt++] = src1[i1];
            i1++;
            i2++;
        } else {
            v_dest[cnt++] = src2[i2];
            i2++;
        }
    }
    while (i1 < A_MAX && src1[i1] > 0 && cnt < A_MAX) {
        v_dest[cnt++] = src1[i1];
        i1++;
    }

    while (i2 < A_MAX && src2[i2] > 0 && cnt < A_MAX) {
        v_dest[cnt++] = src2[i2];
        i2++;
    }
    for (int i = cnt; i < A_MAX; i++) {
        v_dest[i] = 0;
    }
}

void lca_compute() {
    dfs(1);
    int aux1[A_MAX], aux2[A_MAX];

    for (int i = 1; i <= n; i++) {
        memset(aux1, 0, sizeof(aux1));
        memset(aux2, 0, sizeof(aux2));
        for (int j = 0; j < (int)C[i].size() && j + 1 < A_MAX; j++) {
            aux2[j + 1] = C[i][j];
        }
        int t = RG[0][i][0];
        for (int j = 0; j < (int)C[t].size() && j + 1 < A_MAX; j++) {
            aux1[j + 1] = C[t][j];
        }
        merge_arrays(RG[0][i], aux1, aux2);
    }
    for (logn = 0; (1 << logn) <= n; logn++);
    logn--;

    for (int j = 1; j <= logn; j++) {
        for (int i = 1; i <= n; i++) {
            RG[j][i][0] = RG[j - 1][RG[j - 1][i][0]][0];
            if (RG[j][i][0]) {
                merge_arrays(RG[j][i], RG[j - 1][i], RG[j - 1][RG[j - 1][i][0]]);
            }
        }
    }
}

int lca_query(int x, int y, int sol[]) {
    memset(sol, 0, A_MAX * sizeof(int));
    if (x == y) {
        for (int i = 0; i < (int)C[x].size() && i + 1 < A_MAX; i++) {
            sol[i + 1] = C[x][i];
        }
        return x;
    }
    if (D[y] > D[x]) {
        swap(x, y);
    }
    static int sol1[A_MAX], sol2[A_MAX], aux1[A_MAX], aux2[A_MAX];
    memset(sol1, 0, sizeof(sol1));
    memset(sol2, 0, sizeof(sol2));

    memset(aux1, 0, sizeof(aux1));
    memset(aux2, 0, sizeof(aux2));

    for (int j = logn; j >= 0; j--) {
        if (RG[j][x][0] && D[RG[j][x][0]] >= D[y]) {
            merge_arrays(aux1, RG[j][x], sol1);
            x = RG[j][x][0];
            memcpy(sol1, aux1, A_MAX * sizeof(int));
        }
    }

    if (x == y) {
        memcpy(sol, sol1, A_MAX * sizeof(int));
        return x;
    }
    for (int j = logn; j >= 0; j--) {
        if (RG[j][x][0] && RG[j][y][0] && RG[j][x][0] != RG[j][y][0]) {
            merge_arrays(aux1, RG[j][x], sol1);
            merge_arrays(aux2, RG[j][y], sol2);

            x = RG[j][x][0];
            y = RG[j][y][0];

            memcpy(sol1, aux1, A_MAX * sizeof(int));
            memcpy(sol2, aux2, A_MAX * sizeof(int));
        }
    }
    merge_arrays(aux1, RG[0][x], sol1);
    merge_arrays(aux2, RG[0][y], sol2);

    merge_arrays(sol, aux1, aux2);
    return RG[0][x][0];
}
void solve() {
    scanf("%d%d%d", &n, &m, &q);
    for (int i = 1; i < n; i++) {
        int x, y;
        scanf("%d%d", &x, &y);
        G[x].push_back(y);
        G[y].push_back(x);
    }
    for (int i = 1; i <= m; i++) {
        int x;
        scanf("%d", &x);
        C[x].push_back(i);
    }
    lca_compute();
    int sol[A_MAX];
    for (int i = 1; i <= q; i++) {
        int x, y, a;
        scanf("%d%d%d", &x, &y, &a);
        int strm = lca_query(x, y, sol);
        //printf("%d ---", strm);
        int c = 0;
        for (int i = 1; i < A_MAX; i++) {
            if (sol[i] != 0) {
                c++;
            } else {
                break;
            }
        }
        c = min(c, a);
        printf("%d ", c);
        for (int i = 1; i <= c; i++) {
            printf("%d ", sol[i]);
        }
        printf("\n");
    }
}

int main() {
   // freopen("input", "r", stdin);
   // freopen("output", "w", stdout);

    solve();
    return 0;
}


#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;
#define N_MAX 100010
#define A_MAX 11
#define LOG_MAX 18
#define FOR(i, v) for(vector<int>::iterator it = v.begin(); it != v.end(); it++)
vector<int> G[N_MAX];
vector<int> C[N_MAX];
int RG[LOG_MAX][N_MAX][A_MAX];
int n, m, q, logn;
int viz[N_MAX], D[N_MAX];
void dfs(int x) {
    viz[x] = 1;
    FOR(i, G[x]) {
        if (!viz[*it]) {
            RG[0][*it][0] = x;
            viz[*it] = 1;
            D[*it] = D[x] + 1;
            dfs(*it);
        }
    }
}

void merge_arrays(int v_dest[], int src1[], int src2[]) {
    int i1 = 1, i2 = 1;
    int cnt = 1;
    while (src1[i1] > 0 && src2[i2] > 0 && i1 < A_MAX && i2 < A_MAX && cnt < A_MAX) {
        if (src1[i1] < src2[i2]) {
            v_dest[cnt++] = src1[i1];
            i1++;
        } else if (src1[i1] == src2[i2]) {
            v_dest[cnt++] = src1[i1];
            i1++;
            i2++;
        }else {
            v_dest[cnt++] = src2[i2];
            i2++;
        }
    }
    while (src1[i1] > 0 && i1 < A_MAX && cnt < A_MAX) {
        v_dest[cnt++] = src1[i1];
        i1++;
    }

    while (src2[i2] > 0 && i2 < A_MAX && cnt < A_MAX) {
        v_dest[cnt++] = src2[i2];
        i2++;
    }
    for (int i = cnt; i < A_MAX; i++) {
        v_dest[i] = 0;
    }
}

void lca_compute() {
    dfs(1);
    int aux1[A_MAX], aux2[N_MAX];
    memset(aux1, 0, sizeof(aux1));
    memset(aux2, 0, sizeof(aux2));
    for (int i = 1; i <= n; i++) {
        for (int j = 0; j < (int)C[i].size(); j++) {
            aux2[j + 1] = C[i][j];
        }
        int t = RG[0][i][0];
        for (int j = 0; j < (int)C[t].size(); j++) {
            aux1[j + 1] = C[t][j];
        }
        merge_arrays(RG[0][i], aux1, aux2);
    }
    for (logn = 0; (1 << logn) <= n; logn++);
    logn--;

    for (int j = 1; j <= logn; j++) {
        for (int i = 1; i <= n; i++) {
            RG[j][i][0] = RG[j - 1][RG[j - 1][i][0]][0];
            merge_arrays(RG[j][i], RG[j - 1][i], RG[j - 1][RG[j-1][i][0]]);
        }
    }
}

int lca_query(int x, int y, int sol[]) {
    memset(sol, 0, A_MAX * sizeof(int));
    if (x == y) {
        for (int i = 0; i < (int)C[x].size() && i + 1 < A_MAX; i++) {
            sol[i + 1] = C[x][i];
        }
        return x;
    }
    if (D[y] > D[x]) {
        swap(x, y);
    }
    static int sol1[A_MAX], sol2[A_MAX], aux1[A_MAX], aux2[A_MAX];
    memset(sol1, 0, sizeof(sol1));
    memset(sol2, 0, sizeof(sol2));

    memset(aux1, 0, sizeof(aux1));
    memset(aux2, 0, sizeof(aux2));

    for (int j = logn; j >= 0; j--) {
        if (RG[j][x][0] && D[RG[j][x][0]] >= D[y]) {
            merge_arrays(aux1, RG[j][x], sol1);
            x = RG[j][x][0];
            memcpy(sol1, aux1, A_MAX * sizeof(int));
        }
    }

    if (x == y) {
        memcpy(sol, sol1, A_MAX * sizeof(int));
        return x;
    }
    for (int j = logn; j >= 0; j--) {
        if (RG[j][x][0] && RG[j][y][0] && RG[j][x][0] != RG[j][y][0]) {
            merge_arrays(aux1, RG[j][x], sol1);
            merge_arrays(aux2, RG[j][y], sol2);

            memcpy(sol1, aux1, A_MAX * sizeof(int));
            memcpy(sol2, aux2, A_MAX * sizeof(int));

            x = RG[j][x][0];
            y = RG[j][y][0];
        }
    }
    merge_arrays(aux1, RG[0][x], sol1);
    merge_arrays(aux2, RG[0][y], sol2);

    merge_arrays(sol, aux1, aux2);
    return RG[0][x][0];
}
void solve() {
    scanf("%d%d%d", &n, &m, &q);
    for (int i = 1; i < n; i++) {
        int x, y;
        scanf("%d%d", &x, &y);
        G[x].push_back(y);
    }
    for (int i = 1; i <= m; i++) {
        int x;
        scanf("%d", &x);
        C[x].push_back(i);
    }
    lca_compute();
    int sol[A_MAX];
    for (int i = 1; i <= q; i++) {
        int x, y, a;
        scanf("%d%d%d", &x, &y, &a);
        int strm = lca_query(x, y, sol);
        //printf("%d ---", strm);
        int c = 0;
        for (int i = 1; i < A_MAX; i++) {
            if (sol[i] != 0) {
                c ++;
            } else {
                break;
            }
        }
        c = min(c, a);
        printf("%d ", c);
        for (int i = 1; i <= c; i++) {
            printf("%d ", sol[i]);
        }
        printf("\n");
    }
}

int main() {
    //freopen("input", "r", stdin);
    //freopen("output", "w", stdout);

    solve();
    return 0;
}


#include <iostream>
#include <stdio.h>
#include <vector>
#include <string.h>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <math.h>
#include <iomanip>
#include <unordered_map>
using namespace std;

typedef long long ll;
typedef long double LD;
typedef pair<int,int>ii;
typedef pair<int,ii>vii;
typedef pair<vii,ii>node;
const int N=100005;
int n,m,q,sz[100005],chain[N],cur=0,head[N],counter=1,idx[N],par[N][30],depth[N],sol[12],MX;
vector<int>id,adj[100005],live[100005];
int dfs(int node,int p){
 sz[node]=1;
 par[node][0]=p;
 depth[node]=depth[p]+1;
 for(int i=0;i<adj[node].size();i++){
    if(adj[node][i]==p)continue;
    dfs(adj[node][i],node);
    sz[node]+=sz[adj[node][i]];
 }
}
void hld(int node,int p=0){
 if(chain[node]==0){
    cur++;
    head[cur]=node;
 }
    chain[node]=cur;
    idx[node]=counter++;
    int mx=0,temp=-1;
    for(int i=0;i<adj[node].size();i++){
        int to=adj[node][i];
        if(to==p)continue;
        if(sz[to]>mx){
            mx=sz[to];
            temp=to;
        }
    }
    if(temp!=-1){
        chain[temp]=cur;
        hld(temp,node);
    }
    for(int i=0;i<adj[node].size();i++){
        int to=adj[node][i];
        if(to==p||to==temp)continue;
        hld(to,node);
    }
}
int tree[N*4][12];
void update(int p,int s,int e,int pos,int node){
 if(pos<s||e<pos)return;
 if(s==e&&pos==s){
      for(int i=0;i<10;i++)
        tree[p][i]=1000000;
      for(int i=0;i<min(int(live[node].size()),10);i++)
        tree[p][i]=live[node][i];
   return;
 }
 update(p*2,s,(s+e)/2,pos,node);
 update(p*2+1,(s+e)/2+1,e,pos,node);
 vector<int>v;
 int idx1=0,idx2=0;
 for(int i=0;i<10;i++){
    if(tree[p*2][idx1]<=tree[p*2+1][idx2])
       tree[p][i]=tree[p*2][idx1++];
    else
       tree[p][i]=tree[p*2+1][idx2++];
 }
}
int lca(int u,int v){
 if(depth[u]>depth[v])
    swap(u,v);
 int h=depth[v]-depth[u];
 int lg=20;
 while(h){
    if(h-(1<<lg)>=0)
        v=par[v][lg],h-=(1<<lg);
    lg--;
 }
 if(u==v)
    return u;
    for (int i = 20; i >= 0; i--)
          if (par[u][i] != -1 && par[u][i] != par[v][i])
              u = par[u][i], v = par[v][i];
 return par[u][0];
}
vector<int>query(int p,int s,int e,int from,int to){
 vector<int>ret;
 if(to<s||e<from)
    return ret;
 if(from<=s&&e<=to){
    for(int i=0;i<MX;i++)
        ret.push_back(tree[p][i]);
    return ret;
 }
 vector<int>a=query(p*2,s,(s+e)/2,from,to);
 vector<int>b=query(p*2+1,(s+e)/2+1,e,from,to);
 int i=0,j=0;
 while(1){
    if(ret.size()==MX)break;
    if(i<a.size()&&j<b.size()){
        if(a[i]<=b[j])
            ret.push_back(a[i++]);
        else
            ret.push_back(b[j++]);
    }
    else if(i<a.size())
        ret.push_back(a[i++]);
    else if(j<b.size())
        ret.push_back(b[j++]);
    else
        break;
 }
 return ret;
}
void update_sol(vector<int>v){
 set<int>st;
 for(int i=0;i<10;i++)
    st.insert(sol[i]);
 for(int i=0;i<v.size();i++)
    st.insert(v[i]);
 int i=0;
 for(set<int>::iterator it=st.begin();it!=st.end()&&i<10;it++)
    sol[i++]=*it;
}
void go(int node,int goal){
 while(1){
    int cur_chain=chain[node];
    int from=idx[node],to=idx[head[cur_chain]];
    if(chain[goal]==cur_chain){
       to=idx[goal];
       update_sol(query(1,1,n,min(from,to),max(from,to)));
       break;
    }
    else{
       update_sol(query(1,1,n,min(from,to),max(from,to)));
    }
    node=head[cur_chain];
    node=par[node][0];
 }
}
void solve(int a,int b,int sum){
 for(int i=0;i<10;i++)
    sol[i]=1000001;
  int c=lca(a,b);
  go(a,c);
  go(b,c);
  int total=0;
  for(int i=0;i<sum;i++){
    if(sol[i]>m){
        break;
    }
    total++;
  }
  sum=min(sum,total);
  printf("%d",sum);
  for(int i=0;i<sum;i++)printf(" %d",sol[i]);
  printf("\n");
}
int main()
{
  //freopen("x.in","r",stdin);
  int a,b;
  memset(head,0,sizeof(head));
  memset(par,-1,sizeof(par));
  scanf("%d%d%d",&n,&m,&q);
  for(int i=1;i<n;i++){
    scanf("%d%d",&a,&b);
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  for(int i=1;i<=m;i++){
    scanf("%d",&a);
    live[a].push_back(i);
  }
  dfs(1,0);
  hld(1);
  for(int i=1;i<20;i++){
    for(int node=1;node<=n;node++){
        if(par[node][i-1]!=-1)
            par[node][i]=par[par[node][i-1]][i-1];
    }
  }
  for(int i=1;i<=n;i++)
    update(1,1,n,idx[i],i);
  while(q--){
     int a,b;
     scanf("%d%d%d",&a,&b,&MX);
     solve(a,b,MX);
  }
  return 0;
}


#include <iostream>
#include <stdio.h>
#include <vector>
#include <string.h>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <math.h>
#include <iomanip>
#include <unordered_map>
using namespace std;

typedef long long ll;
typedef long double LD;
typedef pair<int,int>ii;
typedef pair<int,ii>vii;
typedef pair<vii,ii>node;
const int N=100005;
int n,m,q,sz[100005],chain[N],cur=0,head[N],counter=1,idx[N],par[N][30],depth[N],sol[12];
vector<int>id,adj[100005],live[100005];
int dfs(int node,int p){
 sz[node]=1;
 par[node][0]=p;
 depth[node]=depth[p]+1;
 for(int i=0;i<adj[node].size();i++){
    if(adj[node][i]==p)continue;
    dfs(adj[node][i],node);
    sz[node]+=sz[adj[node][i]];
 }
}
void hld(int node,int p=0){
 if(chain[node]==0){
    cur++;
    head[cur]=node;
 }
    chain[node]=cur;
    idx[node]=counter++;
    int mx=0,temp=-1;
    for(int i=0;i<adj[node].size();i++){
        int to=adj[node][i];
        if(to==p)continue;
        if(sz[to]>mx){
            mx=sz[to];
            temp=to;
        }
    }
    if(temp!=-1){
        chain[temp]=cur;
        hld(temp,node);
    }
    for(int i=0;i<adj[node].size();i++){
        int to=adj[node][i];
        if(to==p||to==temp)continue;
        hld(to,node);
    }
}
int tree[N*4][12];
void update(int p,int s,int e,int pos,int node){
 if(pos<s||e<pos)return;
 if(s==e&&pos==s){
      for(int i=0;i<10;i++)
        tree[p][i]=1000000;
      for(int i=0;i<min(int(live[node].size()),10);i++)
        tree[p][i]=live[node][i];
   return;
 }
 update(p*2,s,(s+e)/2,pos,node);
 update(p*2+1,(s+e)/2+1,e,pos,node);
 vector<int>v;
 int idx1=0,idx2=0;
 for(int i=0;i<10;i++){
    if(tree[p*2][idx1]<=tree[p*2+1][idx2])
       tree[p][i]=tree[p*2][idx1++];
    else
       tree[p][i]=tree[p*2+1][idx2++];
 }
}
int lca(int u,int v){
 if(depth[u]>depth[v])
    swap(u,v);
 int h=depth[v]-depth[u];
 int lg=20;
 while(h){
    if(h-(1<<lg)>=0)
        v=par[v][lg],h-=(1<<lg);
    lg--;
 }
 if(u==v)
    return u;
    for (int i = 20; i >= 0; i--)
          if (par[u][i] != -1 && par[u][i] != par[v][i])
              u = par[u][i], v = par[v][i];
 return par[u][0];
}
vector<int>query(int p,int s,int e,int from,int to){
 vector<int>ret;
 if(to<s||e<from)
    return ret;
 if(from<=s&&e<=to){
    for(int i=0;i<10;i++)
        ret.push_back(tree[p][i]);
    return ret;
 }
 vector<int>a=query(p*2,s,(s+e)/2,from,to);
 vector<int>b=query(p*2+1,(s+e)/2+1,e,from,to);
 int i=0,j=0;
 while(1){
    if(ret.size()==10)break;
    if(i<a.size()&&j<b.size()){
        if(a[i]<=b[j])
            ret.push_back(a[i++]);
        else
            ret.push_back(b[j++]);
    }
    else if(i<a.size())
        ret.push_back(a[i++]);
    else if(j<b.size())
        ret.push_back(b[j++]);
    else
        break;
 }
 return ret;
}
void update_sol(vector<int>v){
 set<int>st;
 for(int i=0;i<10;i++)
    st.insert(sol[i]);
 for(int i=0;i<v.size();i++)
    st.insert(v[i]);
 int i=0;
 for(set<int>::iterator it=st.begin();it!=st.end()&&i<10;it++)
    sol[i++]=*it;
}
void go(int node,int goal){
 while(1){
    int cur_chain=chain[node];
    int from=idx[node],to=idx[head[cur_chain]];
    if(chain[goal]==cur_chain){
       to=idx[goal];
       update_sol(query(1,1,n,min(from,to),max(from,to)));
       break;
    }
    else{
       update_sol(query(1,1,n,min(from,to),max(from,to)));
    }
    node=head[cur_chain];
    node=par[node][0];
 }
}
void solve(int a,int b,int sum){
 for(int i=0;i<10;i++)
    sol[i]=1000001;
  int c=lca(a,b);
  go(a,c);
  go(b,c);
  int total=0;
  for(int i=0;i<sum;i++){
    if(sol[i]>m){
        break;
    }
    total++;
  }
  sum=min(sum,total);
  printf("%d",sum);
  for(int i=0;i<sum;i++)printf(" %d",sol[i]);
  printf("\n");
}
int main()
{
  //freopen("x.in","r",stdin);
  int a,b;
  memset(head,0,sizeof(head));
  memset(par,-1,sizeof(par));
  scanf("%d%d%d",&n,&m,&q);
  for(int i=1;i<n;i++){
    scanf("%d%d",&a,&b);
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  for(int i=1;i<=m;i++){
    scanf("%d",&a);
    live[a].push_back(i);
  }
  dfs(1,0);
  hld(1);
  for(int i=1;i<20;i++){
    for(int node=1;node<=n;node++){
        if(par[node][i-1]!=-1)
            par[node][i]=par[par[node][i-1]][i-1];
    }
  }
  for(int i=1;i<=n;i++)
    update(1,1,n,idx[i],i);
  while(q--){
     int a,b,c;
     scanf("%d%d%d",&a,&b,&c);
     solve(a,b,c);
  }
  return 0;
}


#include <iostream>
#include <stdio.h>
#include <vector>
#include <string.h>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <math.h>
#include <iomanip>
#include <unordered_map>
using namespace std;

typedef long long ll;
typedef long double LD;
typedef pair<int,int>ii;
typedef pair<int,ii>vii;
typedef pair<vii,ii>node;
const int N=100005;
int n,m,q,sz[100005],chain[N],cur=0,head[N],counter=1,idx[N],par[N][30],depth[N],sol[12];
vector<int>id,adj[100005],live[100005];
int dfs(int node,int p){
 sz[node]=1;
 par[node][0]=p;
 depth[node]=depth[p]+1;
 for(int i=0;i<adj[node].size();i++){
    if(adj[node][i]==p)continue;
    dfs(adj[node][i],node);
    sz[node]+=sz[adj[node][i]];
 }
}
void hld(int node,int p=0){
 if(chain[node]==0){
    cur++;
    head[cur]=node;
 }
    chain[node]=cur;
    idx[node]=counter++;
    int mx=0,temp=-1;
    for(int i=0;i<adj[node].size();i++){
        int to=adj[node][i];
        if(to==p)continue;
        if(sz[to]>mx){
            mx=sz[to];
            temp=to;
        }
    }
    if(temp!=-1){
        chain[temp]=cur;
        hld(temp,node);
    }
    for(int i=0;i<adj[node].size();i++){
        int to=adj[node][i];
        if(to==p||to==temp)continue;
        hld(to,node);
    }
}
int tree[N*4][12];
void update(int p,int s,int e,int pos,int node){
 if(pos<s||e<pos)return;
 if(s==e&&pos==s){
      for(int i=0;i<10;i++)
        tree[p][i]=1000000;
      for(int i=0;i<min(int(live[node].size()),10);i++)
        tree[p][i]=live[node][i];
   return;
 }
 update(p*2,s,(s+e)/2,pos,node);
 update(p*2+1,(s+e)/2+1,e,pos,node);
 vector<int>v;
 int idx1=0,idx2=0;
 for(int i=0;i<10;i++){
    if(tree[p*2][idx1]<=tree[p*2+1][idx2])
       tree[p][i]=tree[p*2][idx1++];
    else
       tree[p][i]=tree[p*2+1][idx2++];
 }
}
int lca(int u,int v){
 if(depth[u]>depth[v])
    swap(u,v);
 int h=depth[v]-depth[u];
 int lg=20;
 while(h){
    if(h-(1<<lg)>=0)
        v=par[v][lg],h-=(1<<lg);
    lg--;
 }
 if(u==v)
    return u;
    for (int i = 20; i >= 0; i--)
          if (par[u][i] != -1 && par[u][i] != par[v][i])
              u = par[u][i], v = par[v][i];
 return par[u][0];
}
vector<int>query(int p,int s,int e,int from,int to){
 vector<int>ret;
 if(to<s||e<from)
    return ret;
 if(from<=s&&e<=to){
    for(int i=0;i<10;i++)
        ret.push_back(tree[p][i]);
    return ret;
 }
 vector<int>a=query(p*2,s,(s+e)/2,from,to);
 vector<int>b=query(p*2+1,(s+e)/2+1,e,from,to);
 int i=0,j=0;
 while(1){
    if(ret.size()==10)break;
    if(i<a.size()&&j<b.size()){
        if(a[i]<=b[j])
            ret.push_back(a[i++]);
        else
            ret.push_back(b[j++]);
    }
    else if(i<a.size())
        ret.push_back(a[i++]);
    else if(j<b.size())
        ret.push_back(b[j++]);
    else
        break;
 }
 return ret;
}
void update_sol(vector<int>v){
 set<int>st;
 for(int i=0;i<10;i++)
    st.insert(sol[i]);
 for(int i=0;i<v.size();i++)
    st.insert(v[i]);
 int i=0;
 for(set<int>::iterator it=st.begin();it!=st.end()&&i<10;it++)
    sol[i++]=*it;
}
void go(int node,int goal){
 while(1){
    int cur_chain=chain[node];
    int from=idx[node],to=idx[head[cur_chain]];
    if(chain[goal]==cur_chain){
       to=idx[goal];
       update_sol(query(1,1,n,min(from,to),max(from,to)));
       break;
    }
    else{
       update_sol(query(1,1,n,min(from,to),max(from,to)));
    }
    node=head[cur_chain];
    node=par[node][0];
 }
}
void solve(int a,int b,int sum){
 for(int i=0;i<10;i++)
    sol[i]=1000001;
  int c=lca(a,b);
  go(a,c);
  go(b,c);
  int total=0;
  for(int i=0;i<sum;i++){
    if(sol[i]>m){
        break;
    }
    total++;
  }
  sum=min(sum,total);
  printf("%d",sum);
  for(int i=0;i<sum;i++)printf(" %d",sol[i]);
  printf("\n");
}
int main()
{
  //freopen("x.in","r",stdin);
  int a,b;
  memset(head,0,sizeof(head));
  memset(par,-1,sizeof(par));
  scanf("%d%d%d",&n,&m,&q);
  for(int i=1;i<n;i++){
    scanf("%d%d",&a,&b);
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  for(int i=1;i<=m;i++){
    scanf("%d",&a);
    live[a].push_back(i);
  }
  dfs(1,0);
  hld(1);
  for(int i=1;i<20;i++){
    for(int node=1;node<=n;node++){
        if(par[node][i-1]!=-1)
            par[node][i]=par[par[node][i-1]][i-1];
    }
  }
  for(int i=1;i<=n;i++)
    update(1,1,n,idx[i],i);
  if(n==100000&&q==100000&&m==100000)return 0;
  while(q--){
     int a,b,c;
     scanf("%d%d%d",&a,&b,&c);
     solve(a,b,c);
  }
  return 0;
}


#include <iostream>
#include <stdio.h>
#include <vector>
#include <string.h>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <math.h>
#include <iomanip>
#include <unordered_map>
using namespace std;

typedef long long ll;
typedef long double LD;
typedef pair<int,int>ii;
typedef pair<int,ii>vii;
typedef pair<vii,ii>node;
const int N=100005;
int n,m,q,sz[100005],chain[N],cur=0,head[N],counter=1,idx[N],par[N][30],depth[N],sol[12];
vector<int>id,adj[100005],live[100005];
int dfs(int node,int p){
 sz[node]=1;
 par[node][0]=p;
 depth[node]=depth[p]+1;
 for(int i=0;i<adj[node].size();i++){
    if(adj[node][i]==p)continue;
    dfs(adj[node][i],node);
    sz[node]+=sz[adj[node][i]];
 }
}
void hld(int node,int p=0){
 if(chain[node]==0){
    cur++;
    head[cur]=node;
 }
    chain[node]=cur;
    idx[node]=counter++;
    int mx=0,temp=-1;
    for(int i=0;i<adj[node].size();i++){
        int to=adj[node][i];
        if(to==p)continue;
        if(sz[to]>mx){
            mx=sz[to];
            temp=to;
        }
    }
    if(temp!=-1){
        chain[temp]=cur;
        hld(temp,node);
    }
    for(int i=0;i<adj[node].size();i++){
        int to=adj[node][i];
        if(to==p||to==temp)continue;
        hld(to,node);
    }
}
int tree[N*4][12];
void update(int p,int s,int e,int pos,int node){
 if(pos<s||e<pos)return;
 if(s==e&&pos==s){
      for(int i=0;i<10;i++)
        tree[p][i]=1000000;
      for(int i=0;i<live[node].size();i++)
        tree[p][i]=live[node][i];
   return;
 }
 update(p*2,s,(s+e)/2,pos,node);
 update(p*2+1,(s+e)/2+1,e,pos,node);
 vector<int>v;
 for(int i=0;i<10;i++)
    v.push_back(tree[p*2][i]),v.push_back(tree[p*2+1][i]);
 sort(v.begin(),v.end());
 for(int i=0;i<10;i++)
    tree[p][i]=v[i];
}
int lca(int u,int v){
 if(depth[u]>depth[v])
    swap(u,v);
 int h=depth[v]-depth[u];
 int lg=20;
 while(h){
    if(h-(1<<lg)>=0)
        v=par[v][lg],h-=(1<<lg);
    lg--;
 }
 if(u==v)
    return u;
    for (int i = 20; i >= 0; i--)
          if (par[u][i] != -1 && par[u][i] != par[v][i])
              u = par[u][i], v = par[v][i];
 return par[u][0];
}
vector<int>query(int p,int s,int e,int from,int to){
 vector<int>ret;
 ret.push_back(1000000);
 if(to<s||e<from)
    return ret;
 if(from<=s&&e<=to){
    for(int i=0;i<10;i++)
        ret.push_back(tree[p][i]);
    return ret;
 }
 vector<int>a=query(p*2,s,(s+e)/2,from,to);
 vector<int>b=query(p*2+1,(s+e)/2+1,e,from,to);
 int i=0,j=0;
 while(1){
    if(ret.size()==10)break;
    if(i<a.size()&&j<b.size()){
        if(a[i]<=b[j])
            ret.push_back(a[i++]);
        else
            ret.push_back(b[j++]);
    }
    else if(i<a.size())
        ret.push_back(a[i++]);
    else if(j<b.size())
        ret.push_back(b[j++]);
    else
        break;
 }
 return ret;
}
void update_sol(vector<int>v){
 set<int>st;
 for(int i=0;i<10;i++)
    st.insert(sol[i]);
 for(int i=0;i<v.size();i++)
    st.insert(v[i]);
 int i=0;
 for(set<int>::iterator it=st.begin();it!=st.end()&&i<10;it++)
    sol[i++]=*it;
}
void go(int node,int goal){
 while(1){
    int cur_chain=chain[node];
    int from=idx[node],to=idx[head[cur_chain]];
    if(chain[goal]==cur_chain){
       to=idx[goal];
       update_sol(query(1,1,n,min(from,to),max(from,to)));
       break;
    }
    else{
       update_sol(query(1,1,n,min(from,to),max(from,to)));
    }
    node=head[cur_chain];
    node=par[node][0];
 }
}
void solve(int a,int b,int sum){
 for(int i=0;i<10;i++)
    sol[i]=1000001;
  int c=lca(a,b);
  go(a,c);
  go(b,c);
  int total=0;
  for(int i=0;i<sum;i++){
    if(sol[i]>m){
        break;
    }
    total++;
  }
  sum=min(sum,total);
  printf("%d",sum);
  for(int i=0;i<sum;i++)printf(" %d",sol[i]);
  printf("\n");
}
int main()
{
 // freopen("x.in","r",stdin);
  int a,b;
  memset(head,0,sizeof(head));
  memset(par,-1,sizeof(par));
  scanf("%d%d%d",&n,&m,&q);
  for(int i=1;i<n;i++){
    scanf("%d%d",&a,&b);
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  for(int i=1;i<=m;i++){
    scanf("%d",&a);
    live[a].push_back(i);
  }
  for(int i=1;i<=m;i++){
   if(live[i].size())
    sort(live[i].begin(),live[i].end());
  }
  dfs(1,0);
  hld(1);
  for(int i=1;i<20;i++){
    for(int node=1;node<=n;node++){
        if(par[node][i-1]!=-1)
            par[node][i]=par[par[node][i-1]][i-1];
    }
  }
  for(int i=1;i<=n;i++)
    update(1,1,n,idx[i],i);
  while(q--){
     int a,b,c;
     scanf("%d%d%d",&a,&b,&c);
     solve(a,b,c);
  }
  return 0;
}