#include <bits/stdc++.h>

#define in(x) scanf("%d", &x)
#define out(x) printf("%d ", x)
#define outln(x) printf("%d\n", x)

using namespace std;

const int maxn = 1e5 + 10, maxl = 20;
int par[maxn][maxl], n, m, q;
int tin[maxn], tout[maxn], timer;
set<int> sp[maxn][maxl], live[maxn];
vector<int> adj[maxn];

vector<int> get(vector<int> v)
{
    vector<int> res;
    for (int i = 0; i < min(10, (int)v.size()); i++)
        res.push_back(v[i]);
    return res;
}

set<int> get(set<int> s)
{
    set<int> res;
    for (int i = 0; i < min(10, (int)s.size()); i++)
        res.insert(*s.begin()), s.erase(s.begin());
    return res;
}

set<int> add(set<int> s, set<int> t)
{
    for (int u : t)
        s.insert(u);
    while (s.size() > 10)
        s.erase(--s.end());
    return s;
}

void dfs(int u = 1, int p = 1)
{
    par[u][0] = p;
    sp[u][0] = get(live[u]);
    sp[u][0] = add(sp[u][0], live[p]);
    for (int i = 1; i < maxl; i++)
    {
        par[u][i] = par[par[u][i - 1]][i - 1];
        sp[u][i] = sp[u][i - 1];
        sp[u][i] = add(sp[u][i], get(sp[par[u][i - 1]][i - 1]));
    }

    tin[u] = timer++;

    for (int v : adj[u])
        if (v != p)
            dfs(v, u);

    tout[u] = timer++;
}

bool is_anc(int u, int v)
{
    return tin[u] <= tin[v] && tout[u] >= tout[v];
}

set<int> get(int u, int v)
{
    set<int> res;
    res = add(res, live[u]), res = add(res, live[v]);
    for (int i = maxl - 1; ~i; i--)
        if (!is_anc(par[u][i], v))
        {
            res = add(res, sp[u][i]);
            u = par[u][i];
        }
    for (int i = maxl - 1; ~i; i--)
        if (!is_anc(par[v][i], u))
        {
            res = add(res, sp[v][i]);
            v = par[v][i];
        }

    if ((!is_anc(u, v)) && (!is_anc(v, u)))
        res = add(res, live[par[u][0]]);
    return res;
}

int main()
{
    in(n), in(m), in(q);

    for (int i = 0, u, v; i < n - 1; i++)
        in(u), in(v), adj[u].push_back(v), adj[v].push_back(u);
    for (int i = 0, x; i < m; i++)
        in(x), live[x].insert(i + 1);
    dfs();

    while (q--)
    {
        int u, v, a;
        in(u), in(v), in(a);

        set<int> now = get(u, v);
        int x = min(a, (int)now.size());
        out(x);
        for (int i = 0; i < x; i++)
            out(*now.begin()), now.erase(now.begin());
        printf("\n");
    }

    return 0;
}


#include <bits/stdc++.h>

#define in(x) scanf("%d", &x)
#define out(x) printf("%d ", x)
#define outln(x) printf("%d\n", x)

using namespace std;

const int maxn = 1e5 + 10, maxl = 20;
int par[maxn][maxl], n, m, q;
int tin[maxn], tout[maxn], timer;
set<int> sp[maxn][maxl], live[maxn];
vector<int> adj[maxn];

vector<int> get(vector<int> v)
{
    vector<int> res;
    for (int i = 0; i < min(10, (int)v.size()); i++)
        res.push_back(v[i]);
    return res;
}

set<int> get(set<int> s)
{
    set<int> res;
    for (int i = 0; i < min(10, (int)s.size()); i++)
        res.insert(*s.begin()), s.erase(s.begin());
    return res;
}

void add(set<int> &s, set<int> t)
{
    for (int u : t)
        s.insert(u);
}

void dfs(int u = 1, int p = 1)
{
    par[u][0] = p;
    sp[u][0] = get(live[u]);
    add(sp[u][0], live[p]);
    for (int i = 1; i < maxl; i++)
    {
        par[u][i] = par[par[u][i - 1]][i - 1];
        sp[u][i] = sp[u][i - 1];
        add(sp[u][i], get(sp[par[u][i - 1]][i - 1]));
    }

    tin[u] = timer++;

    for (int v : adj[u])
        if (v != p)
            dfs(v, u);

    tout[u] = timer++;
}

bool is_anc(int u, int v)
{
    return tin[u] <= tin[v] && tout[u] >= tout[v];
}

set<int> get(int u, int v)
{
    set<int> res;
    add(res, live[u]), add(res, live[v]);
    for (int i = maxl - 1; ~i; i--)
        if (!is_anc(par[u][i], v))
        {
            add(res, sp[u][i]);
            u = par[u][i];
        }
    for (int i = maxl - 1; ~i; i--)
        if (!is_anc(par[v][i], u))
        {
            add(res, sp[v][i]);
            v = par[v][i];
        }

    if ((!is_anc(u, v)) && (!is_anc(v, u)))
        add(res, live[par[u][0]]);
    return res;
}

int main()
{
    in(n), in(m), in(q);

    for (int i = 0, u, v; i < n - 1; i++)
        in(u), in(v), adj[u].push_back(v), adj[v].push_back(u);
    for (int i = 0, x; i < m; i++)
        in(x), live[x].insert(i + 1);
    dfs();

    while (q--)
    {
        int u, v, a;
        in(u), in(v), in(a);

        set<int> now = get(u, v);
        int x = min(a, (int)now.size());
        out(x);
        for (int i = 0; i < x; i++)
            out(*now.begin()), now.erase(now.begin());
        outln('\n');
    }

    return 0;
}


#include <bits/stdc++.h>

#define in(x) scanf("%d", &x)
#define out(x) printf("%d ", x)
#define outln(x) printf("%d\n", x)

using namespace std;

const int maxn = 1e5 + 10, maxl = 20;
int par[maxn][maxl], n, m, q;
int tin[maxn], tout[maxn], timer;
set<int> sp[maxn][maxl], live[maxn];
vector<int> adj[maxn];

vector<int> get(vector<int> v)
{
    vector<int> res;
    for (int i = 0; i < min(10, (int)v.size()); i++)
        res.push_back(v[i]);
    return res;
}

set<int> get(set<int> s)
{
    set<int> res;
    for (int i = 0; i < min(10, (int)s.size()); i++)
        res.insert(*s.begin()), s.erase(s.begin());
    return res;
}

void add(set<int> &s, set<int> t)
{
    for (int u : t)
        s.insert(u);
}

void dfs(int u = 1, int p = 1)
{
    par[u][0] = p;
    sp[u][0] = get(live[u]);
    add(sp[u][0], live[p]);
    for (int i = 1; i < maxl; i++)
    {
        par[u][i] = par[par[u][i - 1]][i - 1];
        sp[u][i] = sp[u][i - 1];
        add(sp[u][i], get(sp[par[u][i - 1]][i - 1]));
    }

    tin[u] = timer++;

    for (int v : adj[u])
        if (v != p)
            dfs(v, u);

    tout[u] = timer++;
}

bool is_anc(int u, int v)
{
    return tin[u] <= tin[v] && tout[u] >= tout[v];
}

set<int> get(int u, int v)
{
    set<int> res;
    add(res, live[u]), add(res, live[v]);
    for (int i = maxl - 1; ~i; i--)
        if (!is_anc(par[u][i], v))
        {
            add(res, sp[u][i]);
            u = par[u][i];
        }
    for (int i = maxl - 1; ~i; i--)
        if (!is_anc(par[v][i], u))
        {
            add(res, sp[v][i]);
            v = par[v][i];
        }

    if ((!is_anc(u, v)) && (!is_anc(v, u)))
        add(res, live[par[u][0]]);
    return res;
}

int main()
{
    in(n), in(m), in(q);

    for (int i = 0, u, v; i < n - 1; i++)
        in(u), in(v), adj[u].push_back(v), adj[v].push_back(u);
    for (int i = 0, x; i < m; i++)
        in(x), live[x].insert(i + 1);
    dfs();

    while (q--)
    {
        int u, v, a;
        in(u), in(v), in(a);

        set<int> now = get(u, v);
        int x = min(a, (int)now.size());
        out(x);
        for (int i = 0; i < x; i++)
            out(*now.begin()), now.erase(now.begin());
        out('\n');
    }

    return 0;
}


#include <bits/stdc++.h>

#define in(x) scanf("%d", &x)
#define out(x) printf("%d ", x)
#define outln(x) printf("%d\n", x)

using namespace std;

const int maxn = 1e5 + 10, maxl = 20;
int par[maxn][maxl], n, m, q;
int tin[maxn], tout[maxn], timer;
set<int> sp[maxn][maxl], live[maxn];
vector<int> adj[maxn];

vector<int> get(vector<int> v)
{
    vector<int> res;
    for (int i = 0; i < min(10, (int)v.size()); i++)
        res.push_back(v[i]);
    return res;
}

set<int> get(set<int> s)
{
    set<int> res;
    for (int i = 0; i < min(10, (int)s.size()); i++)
        res.insert(*s.begin()), s.erase(s.begin());
    return res;
}

set<int> add(set<int> s, set<int> t)
{
    for (int u : t)
        s.insert(u);
    while (s.size() > 10)
        s.erase(s.rbegin().base());
}

void dfs(int u = 1, int p = 1)
{
    par[u][0] = p;
    sp[u][0] = get(live[u]);
    sp[u][0] = add(sp[u][0], live[p]);
    for (int i = 1; i < maxl; i++)
    {
        par[u][i] = par[par[u][i - 1]][i - 1];
        sp[u][i] = sp[u][i - 1];
        sp[u][i] = add(sp[u][i], get(sp[par[u][i - 1]][i - 1]));
    }

    tin[u] = timer++;

    for (int v : adj[u])
        if (v != p)
            dfs(v, u);

    tout[u] = timer++;
}

bool is_anc(int u, int v)
{
    return tin[u] <= tin[v] && tout[u] >= tout[v];
}

set<int> get(int u, int v)
{
    set<int> res;
    res = add(res, live[u]), res = add(res, live[v]);
    for (int i = maxl - 1; ~i; i--)
        if (!is_anc(par[u][i], v))
        {
            res = add(res, sp[u][i]);
            u = par[u][i];
        }
    for (int i = maxl - 1; ~i; i--)
        if (!is_anc(par[v][i], u))
        {
            res = add(res, sp[v][i]);
            v = par[v][i];
        }

    if ((!is_anc(u, v)) && (!is_anc(v, u)))
        res = add(res, live[par[u][0]]);
    return res;
}

int main()
{
    in(n), in(m), in(q);

    for (int i = 0, u, v; i < n - 1; i++)
        in(u), in(v), adj[u].push_back(v), adj[v].push_back(u);
    for (int i = 0, x; i < m; i++)
        in(x), live[x].insert(i + 1);
    dfs();

    while (q--)
    {
        int u, v, a;
        in(u), in(v), in(a);

        set<int> now = get(u, v);
        int x = min(a, (int)now.size());
        out(x);
        for (int i = 0; i < x; i++)
            out(*now.begin()), now.erase(now.begin());
        printf("\n");
    }

    return 0;
}


#include <bits/stdc++.h>
#define filenamej "587C"
#define FOR(i, a, b) for(int i = a; i <= b; i++)
#define FOD(i, a, b) for(int i = a; i >= b; i--)
#define N 100001
#define pb push_back
using namespace std;

int n, m, q, u, v, a;
int t[N];
int h[N];
int p[N][30];
int two[30];
vector <int> adj[N];
vector <int> child[N];

struct v10
{
    int ele[11] = { };
    int sz = 0;
    int& operator [] (int a) { return ele[a - 1]; }
    void push_back(int a) { if (sz < 10) ele[sz++] = a; }
    int size() { return sz; }
    void incsort() { sort(ele, ele + sz); }
    int* begin() { return ele; }
    int* end() { return ele + sz; }
    void resize(int s) { if (sz < 10) sz = s; else sz = 10; }
    void operator = (v10 other) { sz = other.sz; FOR(i, 0, sz - 1) ele[i] = other.ele[i]; }
} cit[N][30];

int Merge(int* first1, int* last1, int* first2, int* last2, int* firstd, int* lastd)
{
    int* ori = firstd;
    while (firstd != lastd)
    {
        if (first1 == last1)
        {
            while (firstd != lastd && first2 != last2) *firstd++ = *first2++;
            return lastd - ori;
        }
        if (first2 == last2)
        {
            while (firstd != lastd && first1 != last1) *firstd++ = *first1++;
            return lastd - ori;
        }
        if (*first1 == *first2)
        {
            *firstd++ = *first1++;
            first2++;
            lastd--;
        }
        else *firstd++ = *first1 < *first2 ? *first1++ : *first2++;
    }
    return lastd - ori;
}

void DFS(int i, int par, int hei)
{
    child[par].pb(i);
    p[i][0] = t[i] = par;
    h[i] = hei;
    for (auto con: adj[i]) if (con != par) DFS(con, i, hei + 1);
}

void LCA(int u, int v)
{
    v10 ans;
    v10 temp;
    if (h[u] < h[v]) swap(u, v);
//    cout << "query: " << u << " " << v << endl;
    FOD(i, 29, 0) if (h[p[u][i]] >= h[v])
    {
        temp.resize(ans.size() + cit[u][i].size());
        temp.resize(Merge(ans.begin(), ans.end(), cit[u][i].begin(), cit[u][i].end(), temp.begin(), temp.end()));
        ans = temp;
//        cout << "ans: ";
//        for (int* it = ans.begin(); it != ans.end(); it++) cout << *it << " ";
//        cout << endl;
        u = p[u][i];
        // cout << u << " jump" << endl;
    }
    if (u == v) goto hfin;
    FOD(i, 29, 0) if (p[u][i] != p[v][i])
    {
        temp.resize(ans.size() + cit[u][i].size());
        temp.resize(Merge(ans.begin(), ans.end(), cit[u][i].begin(), cit[u][i].end(), temp.begin(), temp.end()));
        ans = temp;
//        cout << "ans: ";
//        for (int* it = ans.begin(); it != ans.end(); it++) cout << *it << " ";
//        cout << endl;
        u = p[u][i];
        temp.resize(ans.size() + cit[v][i].size());
        temp.resize(Merge(ans.begin(), ans.end(), cit[v][i].begin(), cit[v][i].end(), temp.begin(), temp.end()));
        ans = temp;
//        cout << "ans: ";
//        for (int* it = ans.begin(); it != ans.end(); it++) cout << *it << " ";
//        cout << endl;
        v = p[v][i];
    }
    temp.resize(ans.size() + cit[u][1].size());
    temp.resize(Merge(ans.begin(), ans.end(), cit[u][1].begin(), cit[u][1].end(), temp.begin(), temp.end()));
    ans = temp;
//    cout << "ans: ";
//    for (int* it = ans.begin(); it != ans.end(); it++) cout << *it << " ";
//    cout << endl;
    temp.resize(ans.size() + cit[v][1].size());
    temp.resize(Merge(ans.begin(), ans.end(), cit[v][1].begin(), cit[v][1].end(), temp.begin(), temp.end()));
    ans = temp;
//    cout << "ans: ";
//    for (int* it = ans.begin(); it != ans.end(); it++) cout << *it << " ";
//    cout << endl;
    goto fin;
    hfin:
    temp.resize(ans.size() + cit[u][0].size());
    temp.resize(Merge(ans.begin(), ans.end(), cit[u][0].begin(), cit[u][0].end(), temp.begin(), temp.end()));
    ans = temp;
//    cout << "ans: ";
//    for (int* it = ans.begin(); it != ans.end(); it++) cout << *it << " ";
//    cout << endl;
    fin:
    int k = min(ans.size(), a);
    cout << k << " ";
    FOR(i, 1, k) cout << ans[i] << " ";
    cout << endl;
    return;
}

int main()
{
	#ifdef filename
		freopen(filename".inp", "r", stdin);
		freopen(filename".out", "w", stdout);
	#endif // filename

    FOR(i, 0, 29) two[i] = (1 << i);
    cin >> n >> m >> q;
    FOR(i, 1, n - 1)
    {
        cin >> u >> v;
        adj[u].pb(v);
        adj[v].pb(u);
    }
    DFS(1, 0, 1);
    FOR(i, 1, m)
    {
        cin >> u;
        cit[u][0].pb(i);
    }
    FOR(i, 1, n) cit[i][0].incsort();
    FOR(j, 1, 29) FOR(i, 1, n)
    {
        int tt = p[i][j - 1];
        p[i][j] = p[tt][j - 1];
        cit[i][j].resize(cit[i][j - 1].size() + cit[tt][j - 1].size());
        Merge(cit[i][j - 1].begin(), cit[i][j - 1].end(), cit[tt][j - 1].begin(), cit[tt][j - 1].end(), cit[i][j].begin(), cit[i][j].end());
    }
    while (q--)
    {
        cin >> u >> v >> a;
        LCA(u, v);
    }

	return 0;
}


#include <bits/stdc++.h>
#define filenamejj "587C"
#define FOR(i, a, b) for(int i = a; i <= b; i++)
#define FOD(i, a, b) for(int i = a; i >= b; i--)
#define N 100001
#define pb push_back
using namespace std;

int n, m, q, u, v, a;
int t[N];
int h[N];
int p[N][30];
int two[30];
vector <int> adj[N];
vector <int> child[N];

struct v10
{
    int ele[11] = { };
    int sz = 0;
    int& operator [] (int a) { return ele[a - 1]; }
    void push_back(int a) { if (sz < 10) ele[sz++] = a; }
    int size() { return sz; }
    void incsort() { sort(ele, ele + sz); }
    int* begin() { return ele; }
    int* end() { return ele + sz; }
    void resize(int s) { if (sz < 10) sz = s; else sz = 10; }
    void operator = (v10 other) { sz = other.sz; FOR(i, 0, sz - 1) ele[i] = other.ele[i]; }
} cit[N][30];

int Merge(int* first1, int* last1, int* first2, int* last2, int* firstd, int* lastd)
{
    int* ori = firstd;
    while (firstd != lastd)
    {
        if (first1 == last1)
        {
            while (firstd != lastd && first2 != last2) *firstd++ = *first2++;
            return lastd - ori;
        }
        if (first2 == last2)
        {
            while (firstd != lastd && first1 != last1) *firstd++ = *first1++;
            return lastd - ori;
        }
        if (*first1 == *first2)
        {
            *firstd++ = *first1++;
            first2++;
            lastd--;
        }
        else *firstd++ = *first1 < *first2 ? *first1++ : *first2++;
    }
    return lastd - ori;
}

void DFS(int i, int par, int hei)
{
    child[par].pb(i);
    p[i][0] = t[i] = par;
    h[i] = hei;
    for (auto con: adj[i]) if (con != par) DFS(con, i, hei + 1);
}

void LCA(int u, int v)
{
    v10 ans;
    v10 temp;
    if (h[u] < h[v]) swap(u, v);
//    cout << "query: " << u << " " << v << endl;
    FOD(i, 29, 0) if (h[p[u][i]] >= h[v])
    {
        temp.resize(ans.size() + cit[u][i].size());
        temp.resize(Merge(ans.begin(), ans.end(), cit[u][i].begin(), cit[u][i].end(), temp.begin(), temp.end()));
        ans = temp;
//        cout << "ans: ";
//        for (int* it = ans.begin(); it != ans.end(); it++) cout << *it << " ";
//        cout << endl;
        u = p[u][i];
        // cout << u << " jump" << endl;
    }
    if (u == v) goto hfin;
    FOD(i, 29, 0) if (p[u][i] != p[v][i])
    {
        temp.resize(ans.size() + cit[u][i].size());
        temp.resize(Merge(ans.begin(), ans.end(), cit[u][i].begin(), cit[u][i].end(), temp.begin(), temp.end()));
        ans = temp;
//        cout << "ans: ";
//        for (int* it = ans.begin(); it != ans.end(); it++) cout << *it << " ";
//        cout << endl;
        u = p[u][i];
        temp.resize(ans.size() + cit[v][i].size());
        temp.resize(Merge(ans.begin(), ans.end(), cit[v][i].begin(), cit[v][i].end(), temp.begin(), temp.end()));
        ans = temp;
//        cout << "ans: ";
//        for (int* it = ans.begin(); it != ans.end(); it++) cout << *it << " ";
//        cout << endl;
        v = p[v][i];
    }
    temp.resize(ans.size() + cit[u][1].size());
    temp.resize(Merge(ans.begin(), ans.end(), cit[u][1].begin(), cit[u][1].end(), temp.begin(), temp.end()));
    ans = temp;
//    cout << "ans: ";
//    for (int* it = ans.begin(); it != ans.end(); it++) cout << *it << " ";
//    cout << endl;
    temp.resize(ans.size() + cit[v][1].size());
    temp.resize(Merge(ans.begin(), ans.end(), cit[v][1].begin(), cit[v][1].end(), temp.begin(), temp.end()));
    ans = temp;
//    cout << "ans: ";
//    for (int* it = ans.begin(); it != ans.end(); it++) cout << *it << " ";
//    cout << endl;
    goto fin;
    hfin:
    temp.resize(ans.size() + cit[u][0].size());
    temp.resize(Merge(ans.begin(), ans.end(), cit[u][0].begin(), cit[u][0].end(), temp.begin(), temp.end()));
    ans = temp;
//    cout << "ans: ";
//    for (int* it = ans.begin(); it != ans.end(); it++) cout << *it << " ";
//    cout << endl;
    fin:
    int k = min(ans.size(), a);
    cout << k << " ";
    FOR(i, 1, k) cout << ans[i] << " ";
    cout << endl;
    return;
}

int main()
{
	#ifdef filename
		freopen(filename".inp", "r", stdin);
		freopen(filename".out", "w", stdout);
	#endif // filename

    FOR(i, 0, 29) two[i] = (1 << i);
    cin >> n >> m >> q;
    FOR(i, 1, n - 1)
    {
        cin >> u >> v;
        adj[u].pb(v);
        adj[v].pb(u);
    }
    DFS(1, 0, 1);
    FOR(i, 1, m)
    {
        cin >> u;
        cit[u][0].pb(i);
    }
    FOR(i, 1, n) cit[i][0].incsort();
    FOR(j, 1, 29) FOR(i, 1, n)
    {
        int tt = p[i][j - 1];
        p[i][j] = p[tt][j - 1];
        cit[i][j].resize(cit[i][j - 1].size() + cit[tt][j - 1].size());
        Merge(cit[i][j - 1].begin(), cit[i][j - 1].end(), cit[tt][j - 1].begin(), cit[tt][j - 1].end(), cit[i][j].begin(), cit[i][j].end());
    }
    while (q--)
    {
        cin >> u >> v >> a;
        LCA(u, v);
    }

	return 0;
}


#include <bits/stdc++.h>
#define filenamej "587C"
#define FOR(i, a, b) for(int i = a; i <= b; i++)
#define FOD(i, a, b) for(int i = a; i >= b; i--)
#define N 100001
#define pb push_back
using namespace std;

int n, m, q, u, v, a;
int t[N];
int h[N];
int p[N][30];
int two[30];
vector <int> adj[N];
vector <int> child[N];

struct v10
{
    int ele[11] = { };
    int sz = 0;
    int& operator [] (int a) { return ele[a - 1]; }
    void push_back(int a) { if (sz < 10) ele[sz++] = a; }
    int size() { return sz; }
    void incsort() { sort(ele, ele + sz); }
    int* begin() { return ele; }
    int* end() { return ele + sz; }
    void resize(int s) { if (s < 10) sz = s; else sz = 10; }
    void operator = (v10 other) { sz = other.sz; FOR(i, 0, sz - 1) ele[i] = other.ele[i]; }
    void merge(v10 other)
    {
        v10 tmp;
        int* first1 = this->begin();
        int* last1 = this->end();
        int* first2 = other.begin();
        int* last2 = other.end();
        while (true)
        {
            if (first1 == last1)
            {
                while (first2 != last2) tmp.pb(*first2++);
                break;
            }
            if (first2 == last2)
            {
                while (first1 != last1) tmp.pb(*first1++);
                break;
            }
            if (*first1 == *first2)
            {
                tmp.pb(*first1++);
                first2++;
            }
            else tmp.pb(*first1 < *first2 ? *first1++ : *first2++);
        }
        *this = tmp;
        return;
    }
} cit[N][30];

void DFS(int i, int par, int hei)
{
    child[par].pb(i);
    p[i][0] = t[i] = par;
    h[i] = hei;
    for (auto con: adj[i]) if (con != par) DFS(con, i, hei + 1);
}

void LCA()
{
    v10 ans;
    if (h[u] < h[v]) swap(u, v);
    FOD(i, 29, 0) if (h[p[u][i]] >= h[v])
    {
        ans.merge(cit[u][i]);
        u = p[u][i];
    }
    if (u == v)
    {
        ans.merge(cit[u][0]);
        goto fin;
    }
    FOD(i, 29, 0) if (p[u][i] != p[v][i])
    {
        ans.merge(cit[u][i]);
        ans.merge(cit[v][i]);
        u = p[u][i];
        v = p[v][i];
    }
    ans.merge(cit[u][1]);
    ans.merge(cit[v][1]);
    fin:
    int k = min(ans.size(), a);
    cout << k << " ";
    FOR(i, 1, k) cout << ans[i] << " ";
    cout << endl;
    return;
}

int main()
{
	#ifdef filename
		freopen(filename".inp", "r", stdin);
		freopen(filename".out", "w", stdout);
	#endif // filename

    FOR(i, 0, 29) two[i] = (1 << i);
    cin >> n >> m >> q;
    FOR(i, 1, n - 1)
    {
        cin >> u >> v;
        adj[u].pb(v);
        adj[v].pb(u);
    }
    DFS(1, 0, 1);
    FOR(i, 1, m)
    {
        cin >> u;
        cit[u][0].pb(i);
    }
    FOR(i, 1, n) cit[i][0].incsort();
    FOR(j, 1, 29) FOR(i, 1, n)
    {
        int tt = p[i][j - 1];
        p[i][j] = p[tt][j - 1];
        cit[i][j] = cit[i][j - 1];
        cit[i][j].merge(cit[tt][j - 1]);
        // Merge(cit[i][j - 1].begin(), cit[i][j - 1].end(), cit[tt][j - 1].begin(), cit[tt][j - 1].end(), cit[i][j].begin(), cit[i][j].end());
    }
    while (q--)
    {
        cin >> u >> v >> a;
        LCA();
    }

	return 0;
}


#include <bits/stdc++.h>
#define filenamej "587C"
#define FOR(i, a, b) for(int i = a; i <= b; i++)
#define FOD(i, a, b) for(int i = a; i >= b; i--)
#define N 100001
#define pb push_back
using namespace std;

int n, m, q, u, v, a;
int t[N];
int h[N];
int p[N][30];
vector <int> adj[N];

struct v10
{
    int ele[11] = { };
    int sz = 0;
    int& operator [] (int a) { return ele[a - 1]; }
    void push_back(int a) { if (sz < 10) ele[sz++] = a; }
    int size() { return sz; }
    void incsort() { sort(ele, ele + sz); }
    int* begin() { return ele; }
    int* end() { return ele + sz; }
    void resize(int s) { if (s < 10) sz = s; else sz = 10; }
    void operator = (v10 other) { sz = other.sz; FOR(i, 0, sz - 1) ele[i] = other.ele[i]; }
    void merge(v10 other)
    {
        v10 tmp;
        int* first1 = this->begin();
        int* last1 = this->end();
        int* first2 = other.begin();
        int* last2 = other.end();
        while (true)
        {
            if (first1 == last1)
            {
                while (first2 != last2) tmp.pb(*first2++);
                break;
            }
            if (first2 == last2)
            {
                while (first1 != last1) tmp.pb(*first1++);
                break;
            }
            if (*first1 == *first2)
            {
                tmp.pb(*first1++);
                first2++;
            }
            else tmp.pb(*first1 < *first2 ? *first1++ : *first2++);
        }
        *this = tmp;
        return;
    }
} cit[N][30];

void DFS(int i, int par, int hei)
{
    p[i][0] = t[i] = par;
    h[i] = hei;
    for (auto con: adj[i]) if (con != par) DFS(con, i, hei + 1);
}

void LCA()
{
    v10 ans;
    if (h[u] < h[v]) swap(u, v);
    FOD(i, 29, 0) if (h[p[u][i]] >= h[v])
    {
        ans.merge(cit[u][i]);
        u = p[u][i];
    }
    if (u == v)
    {
        ans.merge(cit[u][0]);
        goto fin;
    }
    FOD(i, 29, 0) if (p[u][i] != p[v][i])
    {
        ans.merge(cit[u][i]);
        ans.merge(cit[v][i]);
        u = p[u][i];
        v = p[v][i];
    }
    ans.merge(cit[u][1]);
    ans.merge(cit[v][1]);
    fin:
    int k = min(ans.size(), a);
    cout << k << " ";
    FOR(i, 1, k) cout << ans[i] << " ";
    cout << endl;
    return;
}

int main()
{
	#ifdef filename
		freopen(filename".inp", "r", stdin);
		freopen(filename".out", "w", stdout);
	#endif // filename

    cin >> n >> m >> q;
    FOR(i, 1, n - 1)
    {
        cin >> u >> v;
        adj[u].pb(v);
        adj[v].pb(u);
    }
    DFS(1, 0, 1);
    FOR(i, 1, m)
    {
        cin >> u;
        cit[u][0].pb(i);
    }
    FOR(i, 1, n) cit[i][0].incsort();
    FOR(j, 1, 29) FOR(i, 1, n)
    {
        int tt = p[i][j - 1];
        p[i][j] = p[tt][j - 1];
        cit[i][j] = cit[i][j - 1];
        cit[i][j].merge(cit[tt][j - 1]);
        // Merge(cit[i][j - 1].begin(), cit[i][j - 1].end(), cit[tt][j - 1].begin(), cit[tt][j - 1].end(), cit[i][j].begin(), cit[i][j].end());
    }
    while (q--)
    {
        cin >> u >> v >> a;
        LCA();
    }

	return 0;
}


#include <bits/stdc++.h>
#define filenamejj "587C"
#define FOR(i, a, b) for(int i = a; i <= b; i++)
#define FOD(i, a, b) for(int i = a; i >= b; i--)
#define N 100001
#define pb push_back
using namespace std;

int n, m, q, u, v, a;
int t[N];
int h[N];
int p[N][30];
int two[30];
vector <int> adj[N];
vector <int> child[N];

struct v10
{
    int ele[11] = { };
    int sz = 0;
    int& operator [] (int a) { return ele[a - 1]; }
    void push_back(int a) { if (sz < 10) ele[sz++] = a; }
    int size() { return sz; }
    void incsort() { sort(ele, ele + sz); }
    int* begin() { return ele; }
    int* end() { return ele + sz; }
    void resize(int s) { if (s < 10) sz = s; else sz = 10; }
    void operator = (v10 other) { sz = other.sz; FOR(i, 0, sz - 1) ele[i] = other.ele[i]; }
} cit[N][30];

int Merge(int* first1, int* last1, int* first2, int* last2, int* firstd, int* lastd)
{
    int* ori = firstd;
    while (firstd != lastd)
    {
        if (first1 == last1)
        {
            while (firstd != lastd && first2 != last2) *firstd++ = *first2++;
            return lastd - ori;
        }
        if (first2 == last2)
        {
            while (firstd != lastd && first1 != last1) *firstd++ = *first1++;
            return lastd - ori;
        }
        if (*first1 == *first2)
        {
            *firstd++ = *first1++;
            first2++;
            lastd--;
        }
        else *firstd++ = *first1 < *first2 ? *first1++ : *first2++;
    }
    return lastd - ori;
}

void DFS(int i, int par, int hei)
{
    child[par].pb(i);
    p[i][0] = t[i] = par;
    h[i] = hei;
    for (auto con: adj[i]) if (con != par) DFS(con, i, hei + 1);
}

void LCA(int u, int v)
{
    v10 ans;
    v10 temp;
    if (h[u] < h[v]) swap(u, v);
//    cout << "query: " << u << " " << v << endl;
    FOD(i, 29, 0) if (h[p[u][i]] >= h[v])
    {
        temp.resize(ans.size() + cit[u][i].size());
        temp.resize(Merge(ans.begin(), ans.end(), cit[u][i].begin(), cit[u][i].end(), temp.begin(), temp.end()));
        ans = temp;
//        cout << "ans: ";
//        for (int* it = ans.begin(); it != ans.end(); it++) cout << *it << " ";
//        cout << endl;
        u = p[u][i];
        // cout << u << " jump" << endl;
    }
    if (u == v) goto hfin;
    FOD(i, 29, 0) if (p[u][i] != p[v][i])
    {
        temp.resize(ans.size() + cit[u][i].size());
        temp.resize(Merge(ans.begin(), ans.end(), cit[u][i].begin(), cit[u][i].end(), temp.begin(), temp.end()));
        ans = temp;
//        cout << "ans: ";
//        for (int* it = ans.begin(); it != ans.end(); it++) cout << *it << " ";
//        cout << endl;
        u = p[u][i];
        temp.resize(ans.size() + cit[v][i].size());
        temp.resize(Merge(ans.begin(), ans.end(), cit[v][i].begin(), cit[v][i].end(), temp.begin(), temp.end()));
        ans = temp;
//        cout << "ans: ";
//        for (int* it = ans.begin(); it != ans.end(); it++) cout << *it << " ";
//        cout << endl;
        v = p[v][i];
    }
    temp.resize(ans.size() + cit[u][1].size());
    temp.resize(Merge(ans.begin(), ans.end(), cit[u][1].begin(), cit[u][1].end(), temp.begin(), temp.end()));
    ans = temp;
//    cout << "ans: ";
//    for (int* it = ans.begin(); it != ans.end(); it++) cout << *it << " ";
//    cout << endl;
    temp.resize(ans.size() + cit[v][1].size());
    temp.resize(Merge(ans.begin(), ans.end(), cit[v][1].begin(), cit[v][1].end(), temp.begin(), temp.end()));
    ans = temp;
//    cout << "ans: ";
//    for (int* it = ans.begin(); it != ans.end(); it++) cout << *it << " ";
//    cout << endl;
    goto fin;
    hfin:
    temp.resize(ans.size() + cit[u][0].size());
    temp.resize(Merge(ans.begin(), ans.end(), cit[u][0].begin(), cit[u][0].end(), temp.begin(), temp.end()));
    ans = temp;
//    cout << "ans: ";
//    for (int* it = ans.begin(); it != ans.end(); it++) cout << *it << " ";
//    cout << endl;
    fin:
    int k = min(ans.size(), a);
    cout << k << " ";
    FOR(i, 1, k) cout << ans[i] << " ";
    cout << endl;
    return;
}

int main()
{
	#ifdef filename
		freopen(filename".inp", "r", stdin);
		freopen(filename".out", "w", stdout);
	#endif // filename

    FOR(i, 0, 29) two[i] = (1 << i);
    cin >> n >> m >> q;
    FOR(i, 1, n - 1)
    {
        cin >> u >> v;
        adj[u].pb(v);
        adj[v].pb(u);
    }
    DFS(1, 0, 1);
    FOR(i, 1, m)
    {
        cin >> u;
        cit[u][0].pb(i);
    }
    FOR(i, 1, n) cit[i][0].incsort();
    FOR(j, 1, 29) FOR(i, 1, n)
    {
        int tt = p[i][j - 1];
        p[i][j] = p[tt][j - 1];
        cit[i][j].resize(cit[i][j - 1].size() + cit[tt][j - 1].size());
        Merge(cit[i][j - 1].begin(), cit[i][j - 1].end(), cit[tt][j - 1].begin(), cit[tt][j - 1].end(), cit[i][j].begin(), cit[i][j].end());
    }
    while (q--)
    {
        cin >> u >> v >> a;
        LCA(u, v);
    }

	return 0;
}


// dile a la jardinera que traigo flores
//#pragma GCC optimize ("Ofast,unroll-loops")
//#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>

#define pb push_back
#define ff  first
#define ss second
#define tm1 first
#define tm2 second.first
#define tm3 second.second
#define sz(x) ll(x.size())
#define fill(x, v) memset(x, v, sizeof(x))
#define all(v) (v).begin(), (v).end()
#define FER(i,a,b) for(ll i=ll(a); i< ll(b); ++i)
#define IFR(i,a,b) for(ll i=ll(a); i>=ll(b); --i )
#define fastio ios_base::sync_with_stdio(0); cin.tie(0)

#define N 200005
#define mod 998244353
#define N1 5
#define sqr(x) (x)*(x)
#define INF 10000000000000

using namespace std;
using namespace __gnu_pbds;

typedef int ll;
typedef pair<ll, ll> ii;
typedef pair<ll, ii > tri;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> set_t;

#define trace(...) f(#__VA_ARGS__, __VA_ARGS__)

template<typename t> void f(const char* x, t&& val1){
  cout<<x<< " : "<<val1<<endl;
}
template<typename t1, typename... t2> void f(const char* x, t1&& val1, t2&&... val2){
  const char* xd=strchr(x+1, ',');
  cout.write(x, xd-x)<<" : "<<val1<<" | ";
  f(xd+1, val2...);
}

struct T{
  vi v;
  T(){}
  T(vi &v) : v(v){}
  inline void clear(){
    v.clear();
  }
};
struct ST{
  ll n;
  T t[2*N];
  inline T Op(T &val1, T &val2){
    vi v;
    T ty;
    ll ta=10, id1=0, id2=0;
    while(ta--){
      if(id1==sz(val1.v) && id2==sz(val2.v)) break;
      if(id1==sz(val1.v)) {ty.v.pb(val2.v[id2++]); continue;}
      if(id2==sz(val2.v)) {ty.v.pb(val1.v[id1++]); continue;}
      if(val1.v[id1]>val2.v[id2]) ty.v.pb(val2.v[id2++]);
      else ty.v.pb(val1.v[id1++]);
    }
    return ty;
  }
  inline void build(){
    IFR(i,n-1, 1) t[i]=Op(t[i<<1], t[i<<1|1]);
  }
  inline T que(ll l, ll r){
    T ansl, ansr;
    ansl.clear(), ansr.clear();
    for(l+=n, r+=n; l<r; l>>=1, r>>=1){
      if(l&1) ansl=Op(ansl, t[l++]);
      if(r&1) ansr=Op(t[--r], ansr);
    }
    return Op(ansl, ansr);
  }
};

struct HLDES{
  ll n, gid;
  ST st;
  vi adj[N], val[N], ar[N];
  ll id[N], p[N];
  ll tsz[N], rt[N], d[N];
  inline ll dfs(ll u, ll pp, ll depth){
    tsz[u]=1, p[u]=pp, d[u]=depth;
    for(auto xd: adj[u]) if(xd!=pp) tsz[u]+=dfs(xd, u, depth+1);
    return tsz[u];
  }
  inline void make(){
    ll pe=dfs(0, -1, 0);
  }
  inline void go(ll u, ll root){
    for(auto xd: val[u]) ar[gid].pb(xd);
    rt[u]=root, id[u]=gid, gid++;
    ll w=-1, bc=0;
    for(auto xd: adj[u]) if(xd!=p[u] && w<tsz[xd]) w=tsz[xd], bc=xd;
    if(bc) go(bc, root);
    for(auto xd: adj[u]) if(xd!=p[u] && xd!=bc) go(xd, xd);
  }
  inline ll lca(ll a, ll b){
    while(rt[a]!=rt[b]){
      if(d[rt[a]]>d[rt[b]]) a=p[rt[a]];
      else b=p[rt[b]];
    }
    return d[a]>d[b]? b:a;
  }
  inline void que(ll a, ll b, ll k){
    T ans, cur;
    ll l, r;
    while(rt[a]!=rt[b]){
      if(d[rt[a]]>d[rt[b]]){
        l=id[rt[a]], r=id[a]+1;
        cur=st.que(l, r);
        ans=st.Op(ans, cur);
        a=p[rt[a]];
      }
      else{
        l=id[rt[b]], r=id[b]+1;
        cur=st.que(l, r);
        ans=st.Op(ans, cur);
        b=p[rt[b]];
      }
    }
    if(d[a]>d[b]){
      l=id[b], r=id[a]+1;
      cur=st.que(l, r);
      ans=st.Op(ans, cur);
    }
    else{
      l=id[a], r=id[b]+1;
      cur=st.que(l, r);
      ans=st.Op(ans, cur);
    }
    ll ta=min(k, sz(ans.v));
    cout<<ta<<" ";
    FER(i,0,ta) cout<<ans.v[i]<<" ";
    cout<<endl;
  }
  inline void build(){
    gid=0;
    make();
    go(0,0);
    st.n=n;
    FER(i,0,n){
      for(auto xd: ar[i]) st.t[i+n].v.pb(xd);
    }
    st.build();
  }
}hld;
int main(){
  fastio;
  ll n, m, q; cin>>n>>m>>q;
  FER(i,0,n-1){
    ll a, b; cin>>a>>b; a--; b--;
    hld.adj[a].pb(b);
    hld.adj[b].pb(a);
  }
  hld.n=n;
  FER(i,0,m){
    ll a; cin>>a; a--;
    hld.val[a].pb(i+1);
  }
  hld.build();
  FER(i,0,q){
    ll a, b, c; cin>>a>>b>>c;
    a--; b--;
    hld.que(a,b,c);
  }
  return 0;
}


// dile a la jardinera que traigo flores
#pragma GCC optimize ("Ofast,unroll-loops")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>

#define pb push_back
#define ff  first
#define ss second
#define tm1 first
#define tm2 second.first
#define tm3 second.second
#define sz(x) ll(x.size())
#define fill(x, v) memset(x, v, sizeof(x))
#define all(v) (v).begin(), (v).end()
#define FER(i,a,b) for(ll i=ll(a); i< ll(b); ++i)
#define IFR(i,a,b) for(ll i=ll(a); i>=ll(b); --i )
#define fastio ios_base::sync_with_stdio(0); cin.tie(0)

#define N 200005
#define mod 998244353
#define N1 5
#define sqr(x) (x)*(x)
#define INF 10000000000000

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef pair<ll, ll> ii;
typedef pair<ll, ii > tri;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> set_t;

#define trace(...) f(#__VA_ARGS__, __VA_ARGS__)

template<typename t> void f(const char* x, t&& val1){
  cout<<x<< " : "<<val1<<endl;
}
template<typename t1, typename... t2> void f(const char* x, t1&& val1, t2&&... val2){
  const char* xd=strchr(x+1, ',');
  cout.write(x, xd-x)<<" : "<<val1<<" | ";
  f(xd+1, val2...);
}

struct T{
  vi v;
  T(){}
  T(vi &v) : v(v){}
  inline void clear(){
    v.clear();
  }
};
struct ST{
  ll n;
  T t[2*N];
  inline T Op(T &val1, T &val2){
    vi v;
    T ty;
    for(auto xd: val1.v) v.pb(xd);
    for(auto xd: val2.v) v.pb(xd);
    sort(all(v));
    ll ta=min(10LL, sz(v));
    FER(i,0,ta) ty.v.pb(v[i]);
    return ty;
  }
  inline void build(){
    IFR(i,n-1, 1) t[i]=Op(t[i<<1], t[i<<1|1]);
  }
  inline T que(ll l, ll r){
    T ansl, ansr;
    ansl.clear(), ansr.clear();
    for(l+=n, r+=n; l<r; l>>=1, r>>=1){
      if(l&1) ansl=Op(ansl, t[l++]);
      if(r&1) ansr=Op(t[--r], ansr);
    }
    return Op(ansl, ansr);
  }
};

struct HLDES{
  ll n, gid;
  ST st;
  vi adj[N], val[N], ar[N];
  ll id[N], p[N];
  ll tsz[N], rt[N], d[N];
  inline ll dfs(ll u, ll pp, ll depth){
    tsz[u]=1, p[u]=pp, d[u]=depth;
    for(auto xd: adj[u]) if(xd!=pp) tsz[u]+=dfs(xd, u, depth+1);
    return tsz[u];
  }
  inline void make(){
    ll pe=dfs(0, -1, 0);
  }
  inline void go(ll u, ll root){
    for(auto xd: val[u]) ar[gid].pb(xd);
    rt[u]=root, id[u]=gid, gid++;
    ll w=-1, bc=0;
    for(auto xd: adj[u]) if(xd!=p[u] && w<tsz[xd]) w=tsz[xd], bc=xd;
    if(bc) go(bc, root);
    for(auto xd: adj[u]) if(xd!=p[u] && xd!=bc) go(xd, xd);
  }
  inline ll lca(ll a, ll b){
    while(rt[a]!=rt[b]){
      if(d[rt[a]]>d[rt[b]]) a=p[rt[a]];
      else b=p[rt[b]];
    }
    return d[a]>d[b]? b:a;
  }
  inline void que(ll a, ll b, ll k){
    T ans, cur;
    ll l, r;
    while(rt[a]!=rt[b]){
      if(d[rt[a]]>d[rt[b]]){
        l=id[rt[a]], r=id[a]+1;
        cur=st.que(l, r);
        ans=st.Op(ans, cur);
        a=p[rt[a]];
      }
      else{
        l=id[rt[b]], r=id[b]+1;
        cur=st.que(l, r);
        ans=st.Op(ans, cur);
        b=p[rt[b]];
      }
    }
    if(d[a]>d[b]){
      l=id[b], r=id[a]+1;
      cur=st.que(l, r);
      ans=st.Op(ans, cur);
    }
    else{
      l=id[a], r=id[b]+1;
      cur=st.que(l, r);
      ans=st.Op(ans, cur);
    }
    ll ta=min(k, sz(ans.v));
    cout<<ta<<" ";
    FER(i,0,ta) cout<<ans.v[i]<<" ";
    cout<<endl;
  }
  inline void build(){
    gid=0;
    make();
    go(0,0);
    st.n=n;
    FER(i,0,n){
      for(auto xd: ar[i]) st.t[i+n].v.pb(xd);
    }
    st.build();
  }
}hld;
int main(){
  fastio;
  ll n, m, q; cin>>n>>m>>q;
  FER(i,0,n-1){
    ll a, b; cin>>a>>b; a--; b--;
    hld.adj[a].pb(b);
    hld.adj[b].pb(a);
  }
  hld.n=n;
  FER(i,0,m){
    ll a; cin>>a; a--;
    hld.val[a].pb(i+1);
  }
  hld.build();
  FER(i,0,q){
    ll a, b, c; cin>>a>>b>>c;
    a--; b--;
    hld.que(a,b,c);
  }
  return 0;
}


// dile a la jardinera que traigo flores
#pragma GCC optimize ("Ofast,unroll-loops")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>

#define pb push_back
#define ff  first
#define ss second
#define tm1 first
#define tm2 second.first
#define tm3 second.second
#define sz(x) ll(x.size())
#define fill(x, v) memset(x, v, sizeof(x))
#define all(v) (v).begin(), (v).end()
#define FER(i,a,b) for(ll i=ll(a); i< ll(b); ++i)
#define IFR(i,a,b) for(ll i=ll(a); i>=ll(b); --i )
#define fastio ios_base::sync_with_stdio(0); cin.tie(0)

#define N 200005
#define mod 998244353
#define N1 5
#define sqr(x) (x)*(x)
#define INF 10000000000000

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef pair<ll, ll> ii;
typedef pair<ll, ii > tri;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> set_t;

#define trace(...) f(#__VA_ARGS__, __VA_ARGS__)

template<typename t> void f(const char* x, t&& val1){
  cout<<x<< " : "<<val1<<endl;
}
template<typename t1, typename... t2> void f(const char* x, t1&& val1, t2&&... val2){
  const char* xd=strchr(x+1, ',');
  cout.write(x, xd-x)<<" : "<<val1<<" | ";
  f(xd+1, val2...);
}

struct T{
  vi v;
  T(){}
  T(vi &v) : v(v){}
  inline void clear(){
    v.clear();
  }
};
struct ST{
  ll n;
  T t[2*N];
  inline T Op(T &val1, T &val2){
    vi v;
    T ty;
    for(auto xd: val1.v) v.pb(xd);
    for(auto xd: val2.v) v.pb(xd);
    sort(all(v));
    ll ta=min(10LL, sz(v));
    FER(i,0,ta) ty.v.pb(v[i]);
    return ty;
  }
  inline void build(){
    IFR(i,n-1, 1) t[i]=Op(t[i<<1], t[i<<1|1]);
  }
  inline T que(ll l, ll r){
    T ansl, ansr;
    ansl.clear(), ansr.clear();
    for(l+=n, r+=n; l<r; l>>=1, r>>=1){
      if(l&1) ansl=Op(ansl, t[l++]);
      if(r&1) ansr=Op(t[--r], ansr);
    }
    return Op(ansl, ansr);
  }
};

struct HLDES{
  ll n, gid;
  ST st;
  vi adj[N], val[N], ar[N];
  ll id[N], p[N];
  ll tsz[N], rt[N], d[N];
  inline ll dfs(ll u, ll pp, ll depth){
    tsz[u]=1, p[u]=pp, d[u]=depth;
    for(auto xd: adj[u]) if(xd!=pp) tsz[u]+=dfs(xd, u, depth+1);
    return tsz[u];
  }
  inline void make(){
    ll pe=dfs(0, -1, 0);
  }
  inline void go(ll u, ll root){
    for(auto xd: val[u]) ar[gid].pb(xd);
    rt[u]=root, id[u]=gid, gid++;
    ll w=-1, bc=0;
    for(auto xd: adj[u]) if(xd!=p[u] && w<tsz[xd]) w=tsz[xd], bc=xd;
    if(bc) go(bc, root);
    for(auto xd: adj[u]) if(xd!=p[u] && xd!=bc) go(xd, xd);
  }
  inline ll lca(ll a, ll b){
    while(rt[a]!=rt[b]){
      if(d[rt[a]]>d[rt[b]]) a=p[rt[a]];
      else b=p[rt[b]];
    }
    return d[a]>d[b]? b:a;
  }
  inline void que(ll a, ll b, ll k){
    T ans, cur;
    ll l, r;
    while(rt[a]!=rt[b]){
      if(d[rt[a]]>d[rt[b]]){
        l=id[rt[a]], r=id[a]+1;
        cur=st.que(l, r);
        ans=st.Op(ans, cur);
        a=p[rt[a]];
      }
      else{
        l=id[rt[b]], r=id[b]+1;
        cur=st.que(l, r);
        ans=st.Op(ans, cur);
        b=p[rt[b]];
      }
    }
    if(d[a]>d[b]){
      l=id[b], r=id[a]+1;
      cur=st.que(l, r);
      ans=st.Op(ans, cur);
    }
    else{
      l=id[a], r=id[b]+1;
      cur=st.que(l, r);
      ans=st.Op(ans, cur);
    }
    ll ta=min(k, sz(ans.v));
    cout<<ta<<" ";
    FER(i,0,ta) cout<<ans.v[i]<<" ";
    cout<<endl;
  }
  inline void build(){
    gid=0;
    make();
    go(0,0);
    st.n=n;
    FER(i,0,n){
      for(auto xd: ar[i]) st.t[i+n].v.pb(xd);
    }
    st.build();
  }
}hld;
int main(){
  fastio;
  ll n, m, q; cin>>n>>m>>q;
  FER(i,0,n-1){
    ll a, b; cin>>a>>b; a--; b--;
    hld.adj[a].pb(b);
    hld.adj[b].pb(a);
  }
  hld.n=n;
  FER(i,0,m){
    ll a; cin>>a;
    hld.val[i].pb(a);
  }
  hld.build();
  FER(i,0,q){
    ll a, b, c; cin>>a>>b>>c;
    a--; b--;
    hld.que(a,b,c);
  }
  return 0;
}


// dile a la jardinera que traigo flores
#pragma GCC optimize ("Ofast,unroll-loops")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>

#define pb push_back
#define ff  first
#define ss second
#define tm1 first
#define tm2 second.first
#define tm3 second.second
#define sz(x) ll(x.size())
#define fill(x, v) memset(x, v, sizeof(x))
#define all(v) (v).begin(), (v).end()
#define FER(i,a,b) for(ll i=ll(a); i< ll(b); ++i)
#define IFR(i,a,b) for(ll i=ll(a); i>=ll(b); --i )
#define fastio ios_base::sync_with_stdio(0); cin.tie(0)

#define N 200005
#define mod 998244353
#define N1 5
#define sqr(x) (x)*(x)
#define INF 10000000000000

using namespace std;
using namespace __gnu_pbds;

typedef int ll;
typedef pair<ll, ll> ii;
typedef pair<ll, ii > tri;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> set_t;

#define trace(...) f(#__VA_ARGS__, __VA_ARGS__)

template<typename t> void f(const char* x, t&& val1){
  cout<<x<< " : "<<val1<<endl;
}
template<typename t1, typename... t2> void f(const char* x, t1&& val1, t2&&... val2){
  const char* xd=strchr(x+1, ',');
  cout.write(x, xd-x)<<" : "<<val1<<" | ";
  f(xd+1, val2...);
}

struct T{
  vi v;
  T(){}
  T(vi &v) : v(v){}
  inline void clear(){
    v.clear();
  }
};
struct ST{
  ll n;
  T t[2*N];
  inline T Op(T &val1, T &val2){
    vi v;
    T ty;
    ll ta=10, id1=0, id2=0;
    while(ta--){
      if(id1==sz(val1.v) && id2==sz(val2.v)) break;
      if(id1==sz(val1.v)) {ty.v.pb(val2.v[id2++]); continue;}
      if(id2==sz(val2.v)) {ty.v.pb(val1.v[id1++]); continue;}
      if(val1.v[id1]>val2.v[id2]) ty.v.pb(val2.v[id2++]);
      else ty.v.pb(val1.v[id1++]);
    }
    return ty;
  }
  inline void build(){
    IFR(i,n-1, 1) t[i]=Op(t[i<<1], t[i<<1|1]);
  }
  inline T que(ll l, ll r){
    T ansl, ansr;
    ansl.clear(), ansr.clear();
    for(l+=n, r+=n; l<r; l>>=1, r>>=1){
      if(l&1) ansl=Op(ansl, t[l++]);
      if(r&1) ansr=Op(t[--r], ansr);
    }
    return Op(ansl, ansr);
  }
};

struct HLDES{
  ll n, gid;
  ST st;
  vi adj[N], val[N], ar[N];
  ll id[N], p[N];
  ll tsz[N], rt[N], d[N];
  inline ll dfs(ll u, ll pp, ll depth){
    tsz[u]=1, p[u]=pp, d[u]=depth;
    for(auto xd: adj[u]) if(xd!=pp) tsz[u]+=dfs(xd, u, depth+1);
    return tsz[u];
  }
  inline void make(){
    ll pe=dfs(0, -1, 0);
  }
  inline void go(ll u, ll root){
    for(auto xd: val[u]) ar[gid].pb(xd);
    rt[u]=root, id[u]=gid, gid++;
    ll w=-1, bc=0;
    for(auto xd: adj[u]) if(xd!=p[u] && w<tsz[xd]) w=tsz[xd], bc=xd;
    if(bc) go(bc, root);
    for(auto xd: adj[u]) if(xd!=p[u] && xd!=bc) go(xd, xd);
  }
  inline ll lca(ll a, ll b){
    while(rt[a]!=rt[b]){
      if(d[rt[a]]>d[rt[b]]) a=p[rt[a]];
      else b=p[rt[b]];
    }
    return d[a]>d[b]? b:a;
  }
  inline void que(ll a, ll b, ll k){
    T ans, cur;
    ll l, r;
    while(rt[a]!=rt[b]){
      if(d[rt[a]]>d[rt[b]]){
        l=id[rt[a]], r=id[a]+1;
        cur=st.que(l, r);
        ans=st.Op(ans, cur);
        a=p[rt[a]];
      }
      else{
        l=id[rt[b]], r=id[b]+1;
        cur=st.que(l, r);
        ans=st.Op(ans, cur);
        b=p[rt[b]];
      }
    }
    if(d[a]>d[b]){
      l=id[b], r=id[a]+1;
      cur=st.que(l, r);
      ans=st.Op(ans, cur);
    }
    else{
      l=id[a], r=id[b]+1;
      cur=st.que(l, r);
      ans=st.Op(ans, cur);
    }
    ll ta=min(k, sz(ans.v));
    cout<<ta<<" ";
    FER(i,0,ta) cout<<ans.v[i]<<" ";
    cout<<endl;
  }
  inline void build(){
    gid=0;
    make();
    go(0,0);
    st.n=n;
    FER(i,0,n){
      for(auto xd: ar[i]) st.t[i+n].v.pb(xd);
    }
    st.build();
  }
}hld;
int main(){
  fastio;
  ll n, m, q; cin>>n>>m>>q;
  FER(i,0,n-1){
    ll a, b; cin>>a>>b; a--; b--;
    hld.adj[a].pb(b);
    hld.adj[b].pb(a);
  }
  hld.n=n;
  FER(i,0,m){
    ll a; cin>>a; a--;
    hld.val[a].pb(i+1);
  }
  hld.build();
  FER(i,0,q){
    ll a, b, c; cin>>a>>b>>c;
    a--; b--;
    hld.que(a,b,c);
  }
  return 0;
}


#include <bits/stdc++.h>
#ifdef LOCAL
#include <pprint.hpp>
#endif
#define endl "\n";
#define pb push_back
#define md 1000000007
#define ll long long int
#define err cerr<<"OK"<<endl
#define all(v) v.begin(),v.end()
ll power(ll a,ll b){ll z=1;while(b){if(b&1){z*=a;z%=md;}a*=a;a%=md;b/=2;}return z%md;}
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll lvl=24;
ll n,m,q,u,v,k,lc,x;
vector<vector<ll>> adj,par,val;
vector<vector<set<ll>>> ms;
vector<ll> dpt;

void init(){
	adj.clear();	val.clear();	dpt.clear();
	par.clear();	ms.clear();
	par.assign(n+1,vector<ll>(25,0));
	ms.assign(n+1,vector<set<ll>>(25));
	adj.resize(n+1);
	val.resize(n+1);
	dpt.resize(n+1,0);
}

set<ll> top_10(set<ll> &s1,set<ll> &s2){
	set<ll>::iterator it1=s1.begin(),it2=s2.begin();
	set<ll> s;
	while(s.size()<10 && (it1!=s1.end() || it2!=s2.end())){
		if(it1!=s1.end() && it2!=s2.end()){
			if(*it1<*it2)
				s.insert(*it1),++it1;
			else
				s.insert(*it2),++it2;
		}
		else{
			if(it1!=s1.end())
				s.insert(*it1),++it1;
			else
				s.insert(*it2),++it2;
		}
	}
	return s;
}

void dfs(ll s,ll p){
	for(auto x:val[s])
		ms[s][0].insert(x);
	par[s][0]=p;
	for(ll i=1;i<lvl;++i){
		ms[s][i]=top_10(ms[s][i-1],ms[par[s][i-1]][i-1]);
		par[s][i]=par[par[s][i-1]][i-1];
	}
	for(auto x:adj[s]){
		if(x==p)	continue;
		dpt[x] = dpt[s] + 1;
		dfs(x,s);
	}
}

ll lca(ll u,ll v){
	if(dpt[u]>dpt[v])	swap(u,v);
	ll diff=abs(dpt[u]-dpt[v]);
	for(ll i=0;i<lvl;++i)
		if((diff>>i)&1LL)
			v=par[v][i];
	if(u==v)
		return u;
	for(ll i=lvl;i>=0;--i){
		if(par[u][i]!=par[v][i])
			u=par[u][i],v=par[v][i];
	}
	return par[u][0];
}

int main(){
	//You need to change array size!
	#ifndef LOCAL
	ios_base::sync_with_stdio(false);	cin.tie(NULL);
	#endif

	cin>>n>>m>>q;
	init();
	for(int i=1;i<n;++i){
		cin>>u>>v;
		adj[u].pb(v);
		adj[v].pb(u);
	}
	for(int i=1;i<=m;++i){
		cin>>x;
		val[x].push_back(i);
	}
	dfs(1,0);
	// cout<<ms<<endl;
	while(q--){
		cin>>u>>v>>k;
		lc = lca(u,v);
		ll diff=abs(dpt[u]-dpt[lc])+1;
		set<ll> s;
		for(ll i=0;i<lvl;++i)
			if((diff>>i)&1LL)
				s = top_10(s,ms[u][i]),u=par[u][i];
		diff=abs(dpt[v]-dpt[lc]);
		for(ll i=0;i<lvl;++i)
			if((diff>>i)&1LL)
				s = top_10(s,ms[v][i]),v=par[v][i];
		k = min(k,(ll)s.size());
		cout<<k<<" ";
		set<ll>::iterator it=s.begin();
		while(k--){
			cout<<*it<<" ";
			++it;
		}
		cout<<endl;
	}

	return 0;
}


#include <bits/stdc++.h>
#ifdef LOCAL
#include <pprint.hpp>
#endif
#define endl "\n";
#define pb push_back
#define md 1000000007
#define ll long long int
#define err cerr<<"OK"<<endl
#define all(v) v.begin(),v.end()
ll power(ll a,ll b){ll z=1;while(b){if(b&1){z*=a;z%=md;}a*=a;a%=md;b/=2;}return z%md;}
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll lvl=19;
ll n,m,q,u,v,k,lc;
vector<vector<ll>> adj,par;
vector<vector<multiset<ll>>> ms;
vector<ll> val,dpt;

void init(){
	adj.clear();	val.clear();	dpt.clear();
	par.clear();	ms.clear();
	par.assign(n+1,vector<ll>(21,0));
	ms.assign(n+1,vector<multiset<ll>>(21));
	adj.resize(n+1);
	val.resize(n+1,0);
	dpt.resize(n+1,0);
}

multiset<ll> top_10(multiset<ll> &s1,multiset<ll> &s2){
	multiset<ll>::iterator it1=s1.begin(),it2=s2.begin();
	multiset<ll> s;
	while(s.size()<10 && (it1!=s1.end() || it2!=s2.end())){
		if(it1!=s1.end() && it2!=s2.end()){
			if(*it1<*it2)
				s.insert(*it1),++it1;
			else
				s.insert(*it2),++it2;
		}
		else{
			if(it1!=s1.end())
				s.insert(*it1),++it1;
			else
				s.insert(*it2),++it2;
		}
	}
	return s;
}

void dfs(ll s,ll p){
	if(s<=m)
		ms[s][0].insert(val[s]);
	par[s][0]=p;
	for(ll i=1;i<lvl;++i){
		ms[s][i]=top_10(ms[s][i-1],ms[par[s][i-1]][i-1]);
		par[s][i]=par[par[s][i-1]][i-1];
	}
	for(auto x:adj[s]){
		if(x==p)	continue;
		dpt[x] = dpt[s] + 1;
		dfs(x,s);
	}
}

ll lca(ll u,ll v){
	if(dpt[u]>dpt[v])	swap(u,v);
	ll diff=abs(dpt[u]-dpt[v]);
	for(ll i=0;i<lvl;++i)
		if((diff>>i)&1LL)
			v=par[v][i];
	if(u==v)
		return u;
	for(ll i=lvl;i>=0;--i){
		if(par[u][i]!=par[v][i])
			u=par[u][i],v=par[v][i];
	}
	return par[u][0];
}

int main(){
	//You need to change array size!
	#ifndef LOCAL
	ios_base::sync_with_stdio(false);	cin.tie(NULL);
	#endif

	cin>>n>>m>>q;
	init();
	for(int i=1;i<n;++i){
		cin>>u>>v;
		adj[u].pb(v);
		adj[v].pb(u);
	}
	for(int i=1;i<=m;++i)
		cin>>val[i];
	dfs(1,0);
	// cout<<ms<<endl;
	while(q--){
		cin>>u>>v>>k;
		lc = lca(u,v);
		ll diff=abs(dpt[u]-dpt[lc])+1;
		multiset<ll> s;
		for(ll i=0;i<lvl;++i)
			if((diff>>i)&1LL)
				s = top_10(s,ms[u][i]),u=par[u][i];
		diff=abs(dpt[v]-dpt[lc]);
		for(ll i=0;i<lvl;++i)
			if((diff>>i)&1LL)
				s = top_10(s,ms[v][i]),v=par[v][i];
		k = min(k,(ll)s.size());
		cout<<k<<" ";
		multiset<ll>::iterator it=s.begin();
		while(k--){
			cout<<*it<<" ";
			++it;
		}
		cout<<endl;
	}

	return 0;
}


#include <bits/stdc++.h>
#ifdef LOCAL
#include <pprint.hpp>
#endif
#define endl "\n";
#define pb push_back
#define md 1000000007
#define ll int
#define err cerr<<"OK"<<endl
#define all(v) v.begin(),v.end()
ll power(ll a,ll b){ll z=1;while(b){if(b&1){z*=a;z%=md;}a*=a;a%=md;b/=2;}return z%md;}
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll lvl=20;
ll n,m,q,u,v,k,lc,x;
vector<vector<ll>> adj,par,val;
vector<vector<set<ll>>> ms;
vector<ll> dpt;

void init(){
	adj.clear();	val.clear();	dpt.clear();
	par.clear();	ms.clear();
	par.assign(n+1,vector<ll>(21,0));
	ms.assign(n+1,vector<set<ll>>(21));
	adj.resize(n+1);
	val.resize(n+1);
	dpt.resize(n+1,0);
}

set<ll> top_10(set<ll> &s1,set<ll> &s2){
	set<ll>::iterator it1=s1.begin(),it2=s2.begin();
	set<ll> s;
	while(s.size()<10 && (it1!=s1.end() || it2!=s2.end())){
		if(it1!=s1.end() && it2!=s2.end()){
			if(*it1<*it2)
				s.insert(*it1),++it1;
			else
				s.insert(*it2),++it2;
		}
		else{
			if(it1!=s1.end())
				s.insert(*it1),++it1;
			else
				s.insert(*it2),++it2;
		}
	}
	return s;
}

void dfs(ll s,ll p){
	for(auto x:val[s])
		ms[s][0].insert(x);
	par[s][0]=p;
	for(ll i=1;i<lvl;++i){
		ms[s][i]=top_10(ms[s][i-1],ms[par[s][i-1]][i-1]);
		par[s][i]=par[par[s][i-1]][i-1];
	}
	for(auto x:adj[s]){
		if(x==p)	continue;
		dpt[x] = dpt[s] + 1;
		dfs(x,s);
	}
}

ll lca(ll u,ll v){
	if(dpt[u]>dpt[v])	swap(u,v);
	ll diff=abs(dpt[u]-dpt[v]);
	for(ll i=0;i<lvl;++i)
		if((diff>>i)&1LL)
			v=par[v][i];
	if(u==v)
		return u;
	for(ll i=lvl;i>=0;--i){
		if(par[u][i]!=par[v][i])
			u=par[u][i],v=par[v][i];
	}
	return par[u][0];
}

int main(){
	//You need to change array size!
	#ifndef LOCAL
	ios_base::sync_with_stdio(false);	cin.tie(NULL);
	#endif

	cin>>n>>m>>q;
	init();
	for(int i=1;i<n;++i){
		cin>>u>>v;
		adj[u].pb(v);
		adj[v].pb(u);
	}
	for(int i=1;i<=m;++i){
		cin>>x;
		val[x].push_back(i);
	}
	dfs(1,0);
	// cout<<ms<<endl;
	while(q--){
		cin>>u>>v>>k;
		lc = lca(u,v);
		ll diff=abs(dpt[u]-dpt[lc])+1;
		set<ll> s;
		for(ll i=0;i<lvl;++i)
			if((diff>>i)&1LL)
				s = top_10(s,ms[u][i]),u=par[u][i];
		diff=abs(dpt[v]-dpt[lc]);
		for(ll i=0;i<lvl;++i)
			if((diff>>i)&1LL)
				s = top_10(s,ms[v][i]),v=par[v][i];
		k = min(k,(ll)s.size());
		cout<<k<<" ";
		set<ll>::iterator it=s.begin();
		while(k--){
			cout<<*it<<" ";
			++it;
		}
		cout<<endl;
	}

	return 0;
}


#include <bits/stdc++.h>
#ifdef LOCAL
#include <pprint.hpp>
#endif
#define endl "\n";
#define pb push_back
#define md 1000000007
#define ll int
#define err cerr<<"OK"<<endl
#define all(v) v.begin(),v.end()
ll power(ll a,ll b){ll z=1;while(b){if(b&1){z*=a;z%=md;}a*=a;a%=md;b/=2;}return z%md;}
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll lvl=17;
ll n,m,q,u,v,k,lc,x;
vector<vector<ll>> adj,par,val;
vector<vector<set<ll>>> ms;
vector<ll> dpt;

void init(){
	adj.clear();	val.clear();	dpt.clear();
	par.clear();	ms.clear();
	par.assign(n+1,vector<ll>(18,0));
	ms.assign(n+1,vector<set<ll>>(18));
	adj.resize(n+1);
	val.resize(n+1);
	dpt.resize(n+1,0);
}

set<ll> top_10(set<ll> &s1,set<ll> &s2){
	set<ll>::iterator it1=s1.begin(),it2=s2.begin();
	set<ll> s;
	while(s.size()<10 && (it1!=s1.end() || it2!=s2.end())){
		if(it1!=s1.end() && it2!=s2.end()){
			if(*it1<*it2)
				s.insert(*it1),++it1;
			else
				s.insert(*it2),++it2;
		}
		else{
			if(it1!=s1.end())
				s.insert(*it1),++it1;
			else
				s.insert(*it2),++it2;
		}
	}
	return s;
}

void dfs(ll s,ll p){
	for(auto x:val[s])
		ms[s][0].insert(x);
	par[s][0]=p;
	for(ll i=1;i<lvl;++i){
		ms[s][i]=top_10(ms[s][i-1],ms[par[s][i-1]][i-1]);
		par[s][i]=par[par[s][i-1]][i-1];
	}
	for(auto x:adj[s]){
		if(x==p)	continue;
		dpt[x] = dpt[s] + 1;
		dfs(x,s);
	}
}

ll lca(ll u,ll v){
	if(dpt[u]>dpt[v])	swap(u,v);
	ll diff=abs(dpt[u]-dpt[v]);
	for(ll i=0;i<lvl;++i)
		if((diff>>i)&1LL)
			v=par[v][i];
	if(u==v)
		return u;
	for(ll i=lvl;i>=0;--i){
		if(par[u][i]!=par[v][i])
			u=par[u][i],v=par[v][i];
	}
	return par[u][0];
}

int main(){
	//You need to change array size!
	#ifndef LOCAL
	ios_base::sync_with_stdio(false);	cin.tie(NULL);
	#endif

	cin>>n>>m>>q;
	init();
	for(int i=1;i<n;++i){
		cin>>u>>v;
		adj[u].pb(v);
		adj[v].pb(u);
	}
	for(int i=1;i<=m;++i){
		cin>>x;
		val[x].push_back(i);
	}
	dfs(1,0);
	// cout<<ms<<endl;
	while(q--){
		cin>>u>>v>>k;
		lc = lca(u,v);
		ll diff=abs(dpt[u]-dpt[lc])+1;
		set<ll> s;
		for(ll i=0;i<lvl;++i)
			if((diff>>i)&1LL)
				s = top_10(s,ms[u][i]),u=par[u][i];
		diff=abs(dpt[v]-dpt[lc]);
		for(ll i=0;i<lvl;++i)
			if((diff>>i)&1LL)
				s = top_10(s,ms[v][i]),v=par[v][i];
		k = min(k,(ll)s.size());
		cout<<k<<" ";
		set<ll>::iterator it=s.begin();
		while(k--){
			cout<<*it<<" ";
			++it;
		}
		cout<<endl;
	}

	return 0;
}


#include <bits/stdc++.h>
#ifdef LOCAL
#include <pprint.hpp>
#endif
#define endl "\n";
#define pb push_back
#define md 1000000007
#define ll long long int
#define err cerr<<"OK"<<endl
#define all(v) v.begin(),v.end()
ll power(ll a,ll b){ll z=1;while(b){if(b&1){z*=a;z%=md;}a*=a;a%=md;b/=2;}return z%md;}
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll lvl=19;
ll n,m,q,u,v,k,lc,x;
vector<vector<ll>> adj,par,val;
vector<vector<multiset<ll>>> ms;
vector<ll> dpt;

void init(){
	adj.clear();	val.clear();	dpt.clear();
	par.clear();	ms.clear();
	par.assign(n+1,vector<ll>(21,0));
	ms.assign(n+1,vector<multiset<ll>>(21));
	adj.resize(n+1);
	val.resize(n+1);
	dpt.resize(n+1,0);
}

multiset<ll> top_10(multiset<ll> &s1,multiset<ll> &s2){
	multiset<ll>::iterator it1=s1.begin(),it2=s2.begin();
	multiset<ll> s;
	while(s.size()<10 && (it1!=s1.end() || it2!=s2.end())){
		if(it1!=s1.end() && it2!=s2.end()){
			if(*it1<*it2)
				s.insert(*it1),++it1;
			else
				s.insert(*it2),++it2;
		}
		else{
			if(it1!=s1.end())
				s.insert(*it1),++it1;
			else
				s.insert(*it2),++it2;
		}
	}
	return s;
}

void dfs(ll s,ll p){
	if(s<=m)
		for(auto x:val[s])
			ms[s][0].insert(x);
	par[s][0]=p;
	for(ll i=1;i<lvl;++i){
		ms[s][i]=top_10(ms[s][i-1],ms[par[s][i-1]][i-1]);
		par[s][i]=par[par[s][i-1]][i-1];
	}
	for(auto x:adj[s]){
		if(x==p)	continue;
		dpt[x] = dpt[s] + 1;
		dfs(x,s);
	}
}

ll lca(ll u,ll v){
	if(dpt[u]>dpt[v])	swap(u,v);
	ll diff=abs(dpt[u]-dpt[v]);
	for(ll i=0;i<lvl;++i)
		if((diff>>i)&1LL)
			v=par[v][i];
	if(u==v)
		return u;
	for(ll i=lvl;i>=0;--i){
		if(par[u][i]!=par[v][i])
			u=par[u][i],v=par[v][i];
	}
	return par[u][0];
}

int main(){
	//You need to change array size!
	#ifndef LOCAL
	ios_base::sync_with_stdio(false);	cin.tie(NULL);
	#endif

	cin>>n>>m>>q;
	init();
	for(int i=1;i<n;++i){
		cin>>u>>v;
		adj[u].pb(v);
		adj[v].pb(u);
	}
	for(int i=1;i<=m;++i){
		cin>>x;
		val[x].push_back(i);
	}
	dfs(1,0);
	// cout<<ms<<endl;
	while(q--){
		cin>>u>>v>>k;
		lc = lca(u,v);
		ll diff=abs(dpt[u]-dpt[lc])+1;
		multiset<ll> s;
		for(ll i=0;i<lvl;++i)
			if((diff>>i)&1LL)
				s = top_10(s,ms[u][i]),u=par[u][i];
		diff=abs(dpt[v]-dpt[lc]);
		for(ll i=0;i<lvl;++i)
			if((diff>>i)&1LL)
				s = top_10(s,ms[v][i]),v=par[v][i];
		k = min(k,(ll)s.size());
		cout<<k<<" ";
		multiset<ll>::iterator it=s.begin();
		while(k--){
			cout<<*it<<" ";
			++it;
		}
		cout<<endl;
	}

	return 0;
}


#include <bits/stdc++.h>
typedef  long long int ll;
typedef long double ld;
#define pb push_back
#define pii pair < int , int >
#define F first
#define S second
#define int long long
#define sync ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#pragma GCC optimize ("Ofast")
using namespace std;
/// khodaya komak kon
/// ya navid navid

const int N=1e5+10,M=23;
ll par[N][M];
//ll sub[N];
ll hi[N];
vector <int> g[N];
vector <int> ans[N][M];
ll dfs(ll v,ll p,ll h){
    //sub[v]=1;
    hi[v]=h;
    for (int i=0;i<g[v].size();i++){
        ll u=g[v][i];
        if (u!=p){
            par[u][1]=v;

            for (int k=0;k<ans[u][0].size();k++){
                ans[u][1].pb(ans[u][0][k]);
            }
            for (int k=0;k<ans[v][0].size();k++){
                ans[u][1].pb(ans[v][0][k]);
            }
            sort(ans[u][1].begin(),ans[u][1].end());
            dfs(u,v,h+1);
           // sub[v]+=sub[u];
        }
    }
   // return sub[v];
}
ll c[N];
ll getpar(ll v,ll h){
    if (h==-1 || h==0){
        return v;
    }
    for(int i=0;i<M;i++){
        if (h & (1 << i)) v = par[v][i+1];
    }
    return v;
}
vector <int> s;
ll get(ll v,ll h){
    if (h==-1){
         return 0;
    }
    if (h==0){
        //s.pb(c[v]);
        for (int i=0;i<min((ll)10,(ll)ans[v][0].size());i++){
            s.pb(ans[v][0][i]);
        }
        return 0;
    }
    for(int i=0;i<M;i++){
        if (h & (1 << i)){

            for (int j=0;j<ans[v][i+1].size();j++){
                s.pb(ans[v][i+1][j]);
            }
            v=par[v][i+1];
        }
    }
}
int lca(int v, int u) {
    if (hi[v]<hi[u]){
        ll y=v;
        v=u;
        u=y;
    }
    v = getpar(v,hi[v]-hi[u]);
    if (v==u){
        return v;
    }
    for(int i=20;i>=0;i--){
        if (par[v][i+1] != par[u][i+1]) {
            v=par[v][i+1];
            u=par[u][i+1];
        }

    }
    return par[v][1];
}

int32_t main(){
    sync;
    ll n,m,q;
    cin >> n >> m >> q;
    for (int i=0;i<n-1;i++){
        ll u,v;
        cin >> u >> v;
        g[u].pb(v);
        g[v].pb(u);
    }
    for (int i=1;i<=m;i++){
        ll x;
        cin >> x;
        c[x]=i;
          ans[x][0].pb(i);
    }

    par[1][0]=1;
    for (int i=1;i<=n;i++){
        par[i][0]=i;
    }
    for (int j=1;j<M;j++){
        for (int i=1;i<=n;i++){
            par[i][j]=max((ll)1,par[j][j]);
        }
    }
    dfs(1,1,1);
    for (int i=2;i<M;i++){
        for (int j=1;j<=n;j++){
            par[j][i]=par[par[j][i-1]][i-1];
        }
    }

    for (int i=2 ;i<M;i++){
        for (int j=1;j<=n;j++){
            vector <int> t;
            ll p1=0,p2=0;
            ll v=par[j][i-1];

            while(p1<ans[j][i-1].size() && p2<ans[v][i-1].size()){
                if (ans[j][i-1][p1]<ans[v][i-1][p2]){
                    t.pb(ans[j][i-1][p1]);
                    p1++;
                }
                else{
                    t.pb(ans[v][i-1][p2]);
                    p2++;
                }
            }
            while(p1<ans[j][i-1].size()){
                t.pb(ans[j][i-1][p1]);
                p1++;
            }

            while(p2<ans[v][i-1].size()){
                t.pb(ans[v][i-1][p2]);
                p2++;
            }
            for (int k=0;k<min((ll)t.size(),(ll)10);k++){
                ans[j][i].pb(t[k]);
            }
        }
    }
    for (int i=0;i<q;i++){
        ll u,v,a;
        cin >> u >> v >> a;
        ll f=lca(u,v);
        if (hi[u]>hi[v]){
            swap(u,v);
        }
        s.clear();
        get(u,hi[u]-hi[f]-1);
       // cout << u << " " << hi[u] << " " << v << " " << hi[v] << " " << f << " " << hi[f] << endl;
        get(v,hi[v]-hi[f]);
      //  cout << v << " fjkvlm " << hi[v]-hi[f] << " " << u << " " << v << " " << f << endl;
        sort(s.begin(),s.end());
        vector <int> w;
        //cout << min((ll)a,(ll)s.size()) << " ";
        for (int j=0;j<min((ll)a,(ll)s.size());j++){
            if (j==0 || w[j-1]!=s[j]){
                w.pb(s[j]);
            }
        }
        cout << min((ll)a,(ll)w.size()) << " ";
         for (int j=0;j<min((ll)a,(ll)w.size());j++){
            cout << w[j] << " ";
        }
        cout << '\n';

    }

}


#include <bits/stdc++.h>
typedef  long long int ll;
typedef long double ld;
#define pb push_back
#define pii pair < int , int >
#define F first
#define S second
#define int long long
#define sync ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#pragma GCC optimize ("Ofast")
using namespace std;
/// khodaya komak kon
/// ya navid navid

const int N=1e5+10,M=23;
ll par[N][M];
//ll sub[N];
ll hi[N];
vector <int> g[N];
vector <int> ans[N][M];
ll dfs(ll v,ll p,ll h){
    //sub[v]=1;
    hi[v]=h;
    for (int i=0;i<g[v].size();i++){
        ll u=g[v][i];
        if (u!=p){
            par[u][0]=v;
			dfs(u,v,h+1);
           // sub[v]+=sub[u];
        }
    }
   // return sub[v];
}
ll c[N];
ll getpar(ll v,ll h){
    for(int i=0;i<M;i++){
        if (h & (1 << i)) v = par[v][i];
    }
    return v;
}

vector <int> s;

ll get(ll v,ll h){
    if (h==0){
        //s.pb(c[v]);
        for (int i=0;i<min((ll)10,(ll)ans[v][0].size());i++){
            s.pb(ans[v][0][i]);
        }
        return 0;
    }
    for(int i=0;i<M;i++){
        if (h & (1 << i)){
            //cout << i << " jkl " << endl;
            for (int j=0;j<min((ll)10,(ll)ans[v][i].size());j++){
                s.pb(ans[v][i][j]);
            }
            v=par[v][i];
        }
    }
}

int lca(int v, int u) {
    if (hi[v]<hi[u])
    	swap(v, u);
    v = getpar(v,hi[v]-hi[u]);
    if (v==u){
        return v;
    }
    for(int i=20;i>=0;i--){
        if (par[v][i] != par[u][i]) {
            v=par[v][i];
            u=par[u][i];
        }

    }
    return par[v][0];
}

int32_t main(){
    sync;
    ll n,m,q;
    cin >> n >> m >> q;
    for (int i=0;i<n-1;i++){
        ll u,v;
        cin >> u >> v;
        g[u].pb(v);
        g[v].pb(u);
    }
    for (int i=1;i<=m;i++){
        ll x;
        cin >> x;
        ans[x][0].pb(i);
    }

    dfs(1,0,0);
    //cout << par[1][0] << endl;
    for (int i=1;i<M;i++){
        for (int j=1;j<=n;j++){
            par[j][i]=par[par[j][i-1]][i-1];
        }
    }

    for (int i=1 ;i<M;i++){
        for (int j=1;j<=n;j++){
            vector <int> t;
            ll p1=0,p2=0;
            ll v=par[j][i-1];

            while(p1<ans[j][i-1].size() && p2<ans[v][i-1].size()){
                if (ans[j][i-1][p1]<ans[v][i-1][p2]){
                    t.pb(ans[j][i-1][p1]);
                    p1++;
                }
                else{
                    t.pb(ans[v][i-1][p2]);
                    p2++;
                }
            }
            while(p1<ans[j][i-1].size()){
                t.pb(ans[j][i-1][p1]);
                p1++;
            }

            while(p2<ans[v][i-1].size()){
                t.pb(ans[v][i-1][p2]);
                p2++;
            }
            for (int k=0;k<min((ll)t.size(),(ll)10);k++){
                ans[j][i].pb(t[k]);
            }
        }
    }

    for (int i=0;i<q;i++){
        ll u,v,a;
        cin >> u >> v >> a;
        if(v == u){
            //cout << min(a,(ll)ans[v][0].size());
            cout << min(a,(ll)ans[v][0].size()) << " ";
            for (int j=0;j<min(a,(ll)ans[v][0].size());j++){
                cout << ans[v][0][j] << " ";
            }
            cout << '\n';
            continue;
        }

        ll f=lca(u,v);
       // cout << f << " jkl" << endl;
        s.clear();
        if(hi[u] < hi[v])
        	swap(v, u);
		get(u,hi[u]-hi[f]);
       // cout << u << " " << hi[u] << " " << v << " " << hi[v] << " " << f << " " << hi[f] << endl;
        get(v, hi[v]-hi[f]+1);

	  //  cout << v << " fjkvlm " << hi[v]-hi[f] << " " << u << " " << v << " " << f << endl;
        sort(s.begin(),s.end());
        cout << min(a,(ll)s.size()) << " ";
        //cout << min((ll)a,(ll)s.size()) << endl;
         for (int j=0;j<min((ll)a,(ll)s.size());j++){
            cout << s[j] << " ";
        }
        cout << '\n';

    }
    /*
    5 5 5
4 1
4 2
3 5
3 2
2 1 5 1 5
5 3 1
4 5 3
1 5 8
3 2 1
1 5 6
*/

}


#include <bits/stdc++.h>
typedef  long long int ll;
typedef long double ld;
#define pb push_back
#define pii pair < int , int >
#define F first
#define S second
#define int long long
#define sync ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#pragma GCC optimize ("Ofast")
using namespace std;
/// khodaya komak kon
/// ya navid navid

const int N=1e5+10,M=23;
ll par[N][M];
//ll sub[N];
ll hi[N];
vector <int> g[N];
vector <int> ans[N][M];
ll dfs(ll v,ll p,ll h){
    //sub[v]=1;
    hi[v]=h;
    for (int i=0;i<g[v].size();i++){
        ll u=g[v][i];
        if (u!=p){
            par[u][1]=v;

            for (int k=0;k<ans[u][0].size();k++){
                ans[u][1].pb(ans[u][0][k]);
            }
            for (int k=0;k<ans[v][0].size();k++){
                ans[u][1].pb(ans[v][0][k]);
            }
            dfs(u,v,h+1);
           // sub[v]+=sub[u];
        }
    }
   // return sub[v];
}
ll c[N];
ll getpar(ll v,ll h){
    if (h==-1 || h==0){
        return v;
    }
    for(int i=0;i<M;i++){
        if (h & (1 << i)) v = par[v][i+1];
    }
    return v;
}
vector <int> s;
ll get(ll v,ll h){
    if (h==-1){
         return 0;
    }
    if (h==0){
        //s.pb(c[v]);
        for (int i=0;i<min((ll)10,(ll)ans[v][0].size());i++){
            s.pb(ans[v][0][i]);
        }
        return 0;
    }
    for(int i=0;i<M;i++){
        if (h & (1 << i)){

            for (int j=0;j<ans[v][i+1].size();j++){
                s.pb(ans[v][i+1][j]);
            }
            v=par[v][i+1];
        }
    }
}
int lca(int v, int u) {
    if (hi[v]<hi[u]){
        ll y=v;
        v=u;
        u=y;
    }
    v = getpar(v,hi[v]-hi[u]);
    if (v==u){
        return v;
    }
    for(int i=20;i>=0;i--){
        if (par[v][i+1] != par[u][i+1]) {
            v=par[v][i+1];
            u=par[u][i+1];
        }

    }
    return par[v][1];
}

int32_t main(){
    sync;
    ll n,m,q;
    cin >> n >> m >> q;
    for (int i=0;i<n-1;i++){
        ll u,v;
        cin >> u >> v;
        g[u].pb(v);
        g[v].pb(u);
    }
    for (int i=1;i<=m;i++){
        ll x;
        cin >> x;
        c[x]=i;
          ans[x][0].pb(i);
    }

    par[1][0]=1;
    for (int i=1;i<=n;i++){
        par[i][0]=i;
    }
    for (int j=1;j<M;j++){
        for (int i=1;i<=n;i++){
            par[i][j]=max((ll)1,par[j][j]);
        }
    }
    dfs(1,1,1);
    for (int i=2;i<M;i++){
        for (int j=1;j<=n;j++){
            par[j][i]=par[par[j][i-1]][i-1];
        }
    }

    for (int i=2 ;i<M;i++){
        for (int j=1;j<=n;j++){
            vector <int> t;
            ll p1=0,p2=0;
            ll v=par[j][i-1];

            while(p1<ans[j][i-1].size() && p2<ans[v][i-1].size()){
                if (ans[j][i-1][p1]<ans[v][i-1][p2]){
                    t.pb(ans[j][i-1][p1]);
                    p1++;
                }
                else{
                    t.pb(ans[v][i-1][p2]);
                    p2++;
                }
            }
            while(p1<ans[j][i-1].size()){
                t.pb(ans[j][i-1][p1]);
                p1++;
            }

            while(p2<ans[v][i-1].size()){
                t.pb(ans[v][i-1][p2]);
                p2++;
            }
            for (int k=0;k<min((ll)t.size(),(ll)10);k++){
                ans[j][i].pb(t[k]);
            }
        }
    }
    for (int i=0;i<q;i++){
        ll u,v,a;
        cin >> u >> v >> a;
        ll f=lca(u,v);
        if (hi[u]>hi[v]){
            swap(u,v);
        }
        s.clear();
        get(u,hi[u]-hi[f]-1);
       // cout << u << " " << hi[u] << " " << v << " " << hi[v] << " " << f << " " << hi[f] << endl;
        get(v,hi[v]-hi[f]);
      //  cout << v << " fjkvlm " << hi[v]-hi[f] << " " << u << " " << v << " " << f << endl;
        sort(s.begin(),s.end());
        cout << min((ll)a,(ll)s.size()) << " ";
        for (int j=0;j<min((ll)a,(ll)s.size());j++){
            cout << s[j] << " ";
        }
        cout << '\n';

    }
   // for (int i=0;i<ans[5][2].size();i++){
      //  cout << ans[5][2][i] << endl;
    //}
    //cout << ans[5][1].size() << " " << par[5][1]  << endl;

}


#include <bits/stdc++.h>
typedef  long long int ll;
typedef long double ld;
#define pb push_back
#define pii pair < int , int >
#define F first
#define S second
#define int long long
#define sync ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#pragma GCC optimize ("Ofast")
using namespace std;
/// khodaya komak kon
/// ya navid navid

const int N=1e5+10,M=23;
ll par[N][M];
//ll sub[N];
ll hi[N];
vector <int> g[N];
vector <int> ans[N][M];
ll dfs(ll v,ll p,ll h){
    //sub[v]=1;
    hi[v]=h;
    for (int i=0;i<g[v].size();i++){
        ll u=g[v][i];
        if (u!=p){
            par[u][1]=v;

            for (int k=0;k<ans[u][0].size();k++){
                ans[u][1].pb(ans[u][0][k]);
            }
            for (int k=0;k<ans[u][0].size();k++){
                ans[u][1].pb(ans[v][0][k]);
            }
            dfs(u,v,h+1);
           // sub[v]+=sub[u];
        }
    }
   // return sub[v];
}
ll c[N];
ll getpar(ll v,ll h){
    if (h==-1 || h==0){
        return v;
    }
    for(int i=0;i<M;i++){
        if (h & (1 << i)) v = par[v][i+1];
    }
    return v;
}
vector <int> s;
ll get(ll v,ll h){
    if (h==0 || h==-1){
        //s.pb(c[v]);
        for (int i=0;i<min((ll)10,(ll)ans[v][0].size());i++){
            s.pb(ans[v][0][i]);
        }
        return 0;
    }
    for(int i=0;i<M;i++){
        if (h & (1 << i)){

            for (int j=0;j<ans[v][i+1].size();j++){
                s.pb(ans[v][i+1][j]);
            }
            v=par[v][i+1];
        }
    }
}
int lca(int v, int u) {
    if (hi[v]<hi[u]){
        ll y=v;
        v=u;
        u=y;
    }
    v = getpar(v,hi[v]-hi[u]);
    if (v==u){
        return v;
    }
    for(int i=20;i>=0;i--){
        if (par[v][i+1] != par[u][i+1]) {
            v=par[v][i+1];
            u=par[u][i+1];
        }

    }
    return par[v][1];
}

int32_t main(){
    sync;
    ll n,m,q;
    cin >> n >> m >> q;
    for (int i=0;i<n-1;i++){
        ll u,v;
        cin >> u >> v;
        g[u].pb(v);
        g[v].pb(u);
    }
    for (int i=1;i<=m;i++){
        ll x;
        cin >> x;
        c[x]=i;
          ans[x][0].pb(i);
    }

    par[1][0]=1;
    for (int i=1;i<=n;i++){
        par[i][0]=i;
    }
    for (int j=1;j<M;j++){
        for (int i=1;i<=n;i++){
            par[i][j]=max((ll)1,par[j][j]);
        }
    }
    dfs(1,1,1);
    for (int i=2;i<M;i++){
        for (int j=1;j<=n;j++){
            par[j][i]=par[par[j][i-1]][i-1];
        }
    }

    for (int i=2 ;i<M;i++){
        for (int j=1;j<=n;j++){
            vector <int> t;
            ll p1=0,p2=0;
            ll v=par[j][i-1];
            while(p1<ans[j][i-1].size() && p2<ans[v][i-1].size()){
                if (ans[j][i-1][p1]<ans[v][i-1][p2]){
                    t.pb(ans[j][i-1][p1]);
                    p1++;
                }
                else{
                    t.pb(ans[v][i-1][p2]);
                    p2++;
                }
            }
            while(p1<ans[j][i-1].size()){
                t.pb(ans[j][i-1][p1]);
                p1++;
            }

            while(p1<ans[j][i-1].size()){
                t.pb(ans[v][i-1][p2]);
                p2++;
            }
            for (int k=0;k<min((ll)t.size(),(ll)10);k++){
                ans[j][i].pb(t[k]);
            }
        }
    }
    for (int i=0;i<q;i++){
        ll u,v,a;
        cin >> u >> v >> a;
        ll f=lca(u,v);
        if (hi[u]<hi[v]){
            swap(u,v);
        }
        s.clear();
        get(u,hi[u]-hi[f]-1);
       // cout << u << " " << hi[u] << " " << v << " " << hi[v] << " " << f << " " << hi[f] << endl;
        get(v,hi[v]-hi[f]);
        sort(s.begin(),s.end());
        cout << min((ll)a,(ll)s.size()) << " ";
        for (int j=0;j<min((ll)a,(ll)s.size());j++){
            cout << s[j] << " ";
        }
        cout << endl;

    }

}


#include <bits/stdc++.h>
typedef  long long int ll;
typedef long double ld;
#define pb push_back
#define pii pair < int , int >
#define F first
#define S second
#define int long long
#define sync ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#pragma GCC optimize ("Ofast")
using namespace std;
/// khodaya komak kon
/// ya navid navid

const int N=1e5+10,M=23;
ll par[N][M];
//ll sub[N];
ll hi[N];
vector <int> g[N];
vector <int> ans[N][M];
ll dfs(ll v,ll p,ll h){
    //sub[v]=1;
    hi[v]=h;
    for (int i=0;i<g[v].size();i++){
        ll u=g[v][i];
        if (u!=p){
            par[u][0]=v;
			dfs(u,v,h+1);
           // sub[v]+=sub[u];
        }
    }
   // return sub[v];
}
ll c[N];
ll getpar(ll v,ll h){
    for(int i=0;i<M;i++){
        if (h & (1 << i)) v = par[v][i];
    }
    return v;
}

vector <int> s;

ll get(ll v,ll h){
    if (h==0){
        //s.pb(c[v]);
        for (int i=0;i<min((ll)10,(ll)ans[v][0].size());i++){
            s.pb(ans[v][0][i]);
        }
        return 0;
    }
    for(int i=0;i<M;i++){
        if (h & (1 << i)){
            //cout << i << " jkl " << endl;
            for (int j=0;j<min((ll)10,(ll)ans[v][i].size());j++){
                s.pb(ans[v][i][j]);
            }
            v=par[v][i];
        }
    }
}

int lca(int v, int u) {
    if (hi[v]<hi[u])
    	swap(v, u);
    v = getpar(v,hi[v]-hi[u]);
    if (v==u){
        return v;
    }
    for(int i=20;i>=0;i--){
        if (par[v][i] != par[u][i]) {
            v=par[v][i];
            u=par[u][i];
        }

    }
    return par[v][0];
}

int32_t main(){
    sync;
    ll n,m,q;
    cin >> n >> m >> q;
    for (int i=0;i<n-1;i++){
        ll u,v;
        cin >> u >> v;
        g[u].pb(v);
        g[v].pb(u);
    }
    for (int i=1;i<=m;i++){
        ll x;
        cin >> x;
        ans[x][0].pb(i);
    }

    dfs(1,0,0);
    //cout << par[1][0] << endl;
    for (int i=1;i<M;i++){
        for (int j=1;j<=n;j++){
            par[j][i]=par[par[j][i-1]][i-1];
        }
    }

    for (int i=1 ;i<M;i++){
        for (int j=1;j<=n;j++){
            vector <int> t;
            ll p1=0,p2=0;
            ll v=par[j][i-1];

            while(p1<ans[j][i-1].size() && p2<ans[v][i-1].size()){
                if (ans[j][i-1][p1]<ans[v][i-1][p2]){
                    t.pb(ans[j][i-1][p1]);
                    p1++;
                }
                else{
                    t.pb(ans[v][i-1][p2]);
                    p2++;
                }
            }
            while(p1<ans[j][i-1].size()){
                t.pb(ans[j][i-1][p1]);
                p1++;
            }

            while(p2<ans[v][i-1].size()){
                t.pb(ans[v][i-1][p2]);
                p2++;
            }
            for (int k=0;k<min((ll)t.size(),(ll)10);k++){
                ans[j][i].pb(t[k]);
            }
        }
    }

    for (int i=0;i<q;i++){
        ll u,v,a;
        cin >> u >> v >> a;
        if(v == u){
            //cout << min(a,(ll)ans[v][0].size());
            cout << min(a,(ll)ans[v][0].size()) << " ";
            for (int j=0;j<min(a,(ll)ans[v][0].size());j++){
                cout << ans[v][0][j] << " ";
            }
            cout << '\n';
            continue;
        }

        ll f=lca(u,v);
       // cout << f << " jkl" << endl;
        s.clear();
        if(hi[u] < hi[v])
        	swap(v, u);
		get(u,hi[u]-hi[f]);
       // cout << u << " " << hi[u] << " " << v << " " << hi[v] << " " << f << " " << hi[f] << endl;
        get(v, hi[v]-hi[f]+1);

	  //  cout << v << " fjkvlm " << hi[v]-hi[f] << " " << u << " " << v << " " << f << endl;
        sort(s.begin(),s.end());
        cout << min(a,(ll)ans[v][0].size()) << " ";
        //cout << min((ll)a,(ll)s.size()) << endl;
         for (int j=0;j<min((ll)a,(ll)s.size());j++){
            cout << s[j] << " ";
        }
        cout << '\n';

    }
    /*
    5 5 5
4 1
4 2
3 5
3 2
2 1 5 1 5
5 3 1
4 5 3
1 5 8
3 2 1
1 5 6
*/

}


// In the Name of Allah
// Ya Ali

#include <bits/stdc++.h>

using namespace std;

#define F first
#define S second
#define pb push_back
#define all( x ) x.begin() , x.end()

const int maxn = 1e5 + 10 ;

int n , m , q , h[ maxn ] , parr[ 21 ][ maxn ] ;
vector< int > g[ maxn ] , parrv[ 21 ][ maxn ] ;

void dfs( int v , int p )
{
   for( auto u : g [ v ] ){
     if( u != p ){
        h[ u ] = h[ v ]+1 ;
        parr[ 0 ][ u ] = v;
        dfs( u , v ) ;
     }
   }
}

void lca( int v , int u , int a )
{
   vector< int > ans ;

   if( h [ v ] < h[ u ] )
     swap( v , u );

   int dis = h[ v ]-h[ u ];

   for(int i = 0 ; i <= 19 ;i ++){
     if( dis & (1<<i) ){

        vector< int > v1 ;
        merge( all( ans ) , all( parrv[ i ][ v ] ) , back_inserter( v1 ) ) ;
        swap( ans , v1 );
        while( ans.size() > a )
            ans.pop_back() ;

        v = parr[ i ][ v ];
     }
   }

   for(int i = 19 ; i >= 0 ; i --){
     if( parr[ i ][ v ] != parr[ i ][ u ] ){

        vector< int > v1 , v2 ;
        merge( all( parrv[ i ][ u ] ) , all( parrv[ i ][ v ] ) , back_inserter( v1 ) ) ;
        merge( all( ans ) , all( v1 ) , back_inserter( v2 ) ) ;
        swap( ans , v2 );

        while( ans.size() > a )
            ans.pop_back() ;

        v = parr[ i ][ v ];
        u = parr[ i ][ u ];
     }
   }

   if( v == u ){
    vector< int > v1 ;
    merge( all( ans ) , all( parrv[ 0 ][ v ] ) , back_inserter( v1 ) );
    swap( ans , v1 ) ;
   }
   else{
    vector< int > v1 , v2 ;
    merge( all( parrv[ 0 ][ u ] ) , all( parrv[ 1 ][ v ] ) , back_inserter( v1 ) );
    merge( all( ans ) , all( v1 ) , back_inserter( v2 ) );
    swap( ans , v2 ) ;
   }

   while( ans.size() > a )
     ans.pop_back() ;

   printf( "%d " , ans.size() ) ;
   for( auto x : ans )
    printf("%d " , x ) ;
   printf("\n" ) ;
}

int main()
{
//ios_base::sync_with_stdio(0) , cin.tie(0) , cout.tie(0) ;

 scanf("%d%d%d" , &n , &m , &q ) ;
 for( int i = 1 ; i < n ; i ++){
    int v , u ;
    scanf("%d%d" , &v , &u);
    g[ v ].pb( u );
    g[ u ].pb( v );
 }

 dfs( 1 , 0 ) ;

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

    parrv[ 0 ][ c ].pb( i ) ;
 }

 for(int i = 1 ; i <= 19 ; i ++){
    for(int j = 1 ; j <= n ; j ++){

        parr[ i ][ j ] = parr[ i-1 ][ parr[ i-1 ][ j ] ] ;
        merge( all( parrv[ i-1 ][ j ] ) , all( parrv[ i-1 ][ parr[ i-1 ][ j ] ] ) , back_inserter( parrv[ i ][ j ] ) ) ;
        while( parrv[ i ][ j ].size() > 10 )
          parrv[ i ][ j ].pop_back() ;
    }
 }

 while( q-- ){
    int v , u , a ;
    scanf("%d%d%d" , &v , &u , &a) ;
    lca( v , u , a );
 }

    return 0;
}


// In the Name of Allah
// Ya Ali

#include <bits/stdc++.h>

using namespace std;

#define F first
#define S second
#define pb push_back
#define all( x ) x.begin() , x.end()

const int maxn = 1e5 + 10 ;

int n , m , q , h[ maxn ] , parr[ 32 ][ maxn ] ;
vector< int > g[ maxn ] , parrv[ 32 ][ maxn ] ;

void dfs( int v , int p )
{
   for( auto u : g [ v ] ){
     if( u != p ){
        h[ u ] = h[ v ]+1 ;
        parr[ 0 ][ u ] = v;
        dfs( u , v ) ;
     }
   }
}

void lca( int v , int u , int a )
{
   vector< int > ans ;

   if( h [ v ] < h[ u ] )
     swap( v , u );

   int dis = h[ v ]-h[ u ];

   for(int i = 0 ; i <= 30 ;i ++){
     if( dis & (1<<i) ){

        vector< int > v1 ;
        merge( all( ans ) , all( parrv[ i ][ v ] ) , back_inserter( v1 ) ) ;
        swap( ans , v1 );
        if( ans.size() > a )
        ans.resize( a ) ;

        v = parr[ i ][ v ];
     }
   }

   for(int i = 30 ; i >= 0 ; i --){
     if( parr[ i ][ v ] != parr[ i ][ u ] ){

        vector< int > v1 , v2 ;
        merge( all( parrv[ i ][ u ] ) , all( parrv[ i ][ v ] ) , back_inserter( v1 ) ) ;
        merge( all( ans ) , all( v1 ) , back_inserter( v2 ) ) ;
        swap( ans , v2 );
        if( ans.size() > a )
        ans.resize( a ) ;

        v = parr[ i ][ v ];
        u = parr[ i ][ u ];
     }
   }

   if( v == u ){
    vector< int > v1 ;
    merge( all( ans ) , all( parrv[ 0 ][ v ] ) , back_inserter( v1 ) );
    swap( ans , v1 ) ;
   }
   else{
    vector< int > v1 , v2 ;
    merge( all( parrv[ 0 ][ u ] ) , all( parrv[ 1 ][ v ] ) , back_inserter( v1 ) );
    merge( all( ans ) , all( v1 ) , back_inserter( v2 ) );
    swap( ans , v2 ) ;
   }

   if( ans.size() > a )
    ans.resize( a ) ;

   cout << ans.size() << " " ;
   for( auto x : ans )
    cout << x << " " ;
   cout << "\n" ;
}

int main()
{
ios_base::sync_with_stdio(0) , cin.tie(0) , cout.tie(0) ;

 cin >> n >> m >> q ;

 for( int i = 1 ; i < n ; i ++){
    int v , u ;
    cin >> v >> u ;
    g[ v ].pb( u );
    g[ u ].pb( v );
 }

 dfs( 1 , 0 ) ;

 for(int i = 1 ; i <= m ; i ++){
    int c ;
    cin >> c ;

    parrv[ 0 ][ c ].pb( i ) ;
 }

 for(int i = 1 ; i <= 30 ; i ++){
    for(int j = 1 ; j <= n ; j ++){

        parr[ i ][ j ] = parr[ i-1 ][ parr[ i-1 ][ j ] ] ;
        merge( all( parrv[ i-1 ][ j ] ) , all( parrv[ i-1 ][ parr[ i-1 ][ j ] ] ) , back_inserter( parrv[ i ][ j ] ) ) ;
        if( parrv[ i ][ j ].size() > 10 )
         parrv[ i ][ j ].resize( 10 ) ;
    }
 }

 while( q-- ){
    int v , u , a ;
    cin >> v >> u >> a;
    lca( v , u , a );
 }

    return 0;
}


// In the Name of Allah
// Ya Ali

#include <bits/stdc++.h>

using namespace std;

#define F first
#define S second
#define pb push_back
#define all( x ) x.begin() , x.end()

const int maxn = 1e5 + 10 ;

int n , m , q , h[ maxn ] , parr[ 32 ][ maxn ] ;
vector< int > g[ maxn ] ;
set< int > parrv[ 32 ][ maxn ] ;

void dfs( int v , int p )
{
   for( auto u : g [ v ] ){
     if( u != p ){
        h[ u ] = h[ v ]+1 ;
        parr[ 0 ][ u ] = v;
        dfs( u , v ) ;
     }
   }
}

void lca( int v , int u , int a )
{

   set < int > ans;

   if( h [ v ] < h[ u ] )
     swap( v , u );

   int dis = h[ v ]-h[ u ];

   for(int i = 0 ; i <= 30 ;i ++){
     if( dis & (1<<i) ){

        for( auto x : parrv[ i ][ v ] ){

           ans.insert( x );

           if( ans.size() > a ){
            auto it = ans.end() ;
            it -- ;
            ans.erase( it );
           }

        }

        v = parr[ i ][ v ];
     }
   }

   for(int i = 30 ; i >= 0 ; i --){
     if( parr[ i ][ v ] != parr[ i ][ u ] ){

        for( auto x : parrv[ i ][ v ] ){

           ans.insert( x );

           if( ans.size() > a ){
            auto it = ans.end() ;
            it -- ;
            ans.erase( it );
           }

        }
        for( auto x : parrv[ i ][ u ] ){

           ans.insert( x );

           if( ans.size() > a ){
            auto it = ans.end() ;
            it -- ;
            ans.erase( it );
           }

        }

        v = parr[ i ][ v ];
        u = parr[ i ][ u ];
     }
   }

   if( v == u ){
     for( auto x : parrv[ 0 ][ v ] ){

           ans.insert( x );

           if( ans.size() > a ){
            auto it = ans.end() ;
            it -- ;
            ans.erase( it );
           }
     }
   }
   else{
      for( auto x : parrv[ 0 ][ v ] ){

           ans.insert( x );

           if( ans.size() > a ){
            auto it = ans.end() ;
            it -- ;
            ans.erase( it );
           }

      }
      for( auto x : parrv[ 1 ][ u ] ){

           ans.insert( x );

           if( ans.size() > a ){
            auto it = ans.end() ;
            it -- ;
            ans.erase( it );
           }

      }
   }

   printf( "%d " , ans.size() ) ;

   for( auto x : ans )
    printf("%d " , x ) ;

   printf("\n" ) ;
}

int main()
{
ios_base::sync_with_stdio(0) , cin.tie(0) , cout.tie(0) ;

 scanf("%d%d%d" , &n , &m , &q ) ;
 for( int i = 1 ; i < n ; i ++){
    int v , u ;
    scanf("%d%d" , &v , &u);
    g[ v ].pb( u );
    g[ u ].pb( v );
 }

 dfs( 1 , 0 ) ;

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

    parrv[ 0 ][ c ].insert( i ) ;
 }

 for(int i = 1 ; i <= 30 ; i ++){
    for(int j = 1 ; j <= n ; j ++){

        parr[ i ][ j ] = parr[ i-1 ][ parr[ i-1 ][ j ] ] ;
        for( auto x : parrv[ i-1 ][ j ] ){
           parrv[ i ][ j ].insert( x );

           if( parrv[ i ][ j ].size() > 10 ){
             auto it = parrv[ i ][ j ].end() ;
             it -- ;
             parrv[ i ][ j ].erase( it );
           }
        }
        for( auto x : parrv[ i-1 ][ parr[ i-1 ][ j ] ] ){
           parrv[ i ][ j ].insert( x );

           if( parrv[ i ][ j ].size() > 10 ){
             auto it = parrv[ i ][ j ].end() ;
             it -- ;
             parrv[ i ][ j ].erase( it );
           }
        }
    }
 }

 while( q-- ){
    int v , u , a ;
    scanf("%d%d%d" , &v , &u , &a) ;
    lca( v , u , a );
 }

    return 0;
}


// In the Name of Allah
// Ya Ali

#include <bits/stdc++.h>

using namespace std;

#define F first
#define S second
#define pb push_back
#define all( x ) x.begin() , x.end()

const int maxn = 1e5 + 10 ;

int n , m , q , h[ maxn ] , parr[ 32 ][ maxn ] ;
vector< int > g[ maxn ] , parrv[ 32 ][ maxn ] ;

void dfs( int v , int p )
{
   for( auto u : g [ v ] ){
     if( u != p ){
        h[ u ] = h[ v ]+1 ;
        parr[ 0 ][ u ] = v;
        dfs( u , v ) ;
     }
   }
}

void lca( int v , int u , int a )
{
   vector< int > ans ;

   if( h [ v ] < h[ u ] )
     swap( v , u );

   int dis = h[ v ]-h[ u ];

   for(int i = 0 ; i <= 30 ;i ++){
     if( dis & (1<<i) ){

        vector< int > v1 ;
        merge( all( ans ) , all( parrv[ i ][ v ] ) , back_inserter( v1 ) ) ;
        swap( ans , v1 );
        if( ans.size() > a )
        ans.resize( a ) ;

        v = parr[ i ][ v ];
     }
   }

   for(int i = 30 ; i >= 0 ; i --){
     if( parr[ i ][ v ] != parr[ i ][ u ] ){

        vector< int > v1 , v2 ;
        merge( all( parrv[ i ][ u ] ) , all( parrv[ i ][ v ] ) , back_inserter( v1 ) ) ;
        merge( all( ans ) , all( v1 ) , back_inserter( v2 ) ) ;
        swap( ans , v2 );
        if( ans.size() > a )
        ans.resize( a ) ;

        v = parr[ i ][ v ];
        u = parr[ i ][ u ];
     }
   }

   if( v == u ){
    vector< int > v1 ;
    merge( all( ans ) , all( parrv[ 0 ][ v ] ) , back_inserter( v1 ) );
    swap( ans , v1 ) ;
   }
   else{
    vector< int > v1 , v2 ;
    merge( all( parrv[ 0 ][ u ] ) , all( parrv[ 1 ][ v ] ) , back_inserter( v1 ) );
    merge( all( ans ) , all( v1 ) , back_inserter( v2 ) );
    swap( ans , v2 ) ;
   }

   if( ans.size() > a )
    ans.resize( a ) ;

   printf( "%d " , ans.size() ) ;
   for( auto x : ans )
    printf("%d " , x ) ;
   printf("\n" ) ;
}

int main()
{
//ios_base::sync_with_stdio(0) , cin.tie(0) , cout.tie(0) ;

 scanf("%d%d%d" , &n , &m , &q ) ;
 for( int i = 1 ; i < n ; i ++){
    int v , u ;
    scanf("%d%d" , &v , &u);
    g[ v ].pb( u );
    g[ u ].pb( v );
 }

 dfs( 1 , 0 ) ;

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

    parrv[ 0 ][ c ].pb( i ) ;
 }

 for(int i = 1 ; i <= 30 ; i ++){
    for(int j = 1 ; j <= n ; j ++){

        parr[ i ][ j ] = parr[ i-1 ][ parr[ i-1 ][ j ] ] ;
        merge( all( parrv[ i-1 ][ j ] ) , all( parrv[ i-1 ][ parr[ i-1 ][ j ] ] ) , back_inserter( parrv[ i ][ j ] ) ) ;
        if( parrv[ i ][ j ].size() > 10 )
         parrv[ i ][ j ].resize( 10 ) ;
    }
 }

 while( q-- ){
    int v , u , a ;
    scanf("%d%d%d" , &v , &u , &a) ;
    lca( v , u , a );
 }

    return 0;
}


// In the Name of Allah
// Ya Ali

#include <bits/stdc++.h>

using namespace std;

#define F first
#define S second
#define pb push_back
#define all( x ) x.begin() , x.end()

const int maxn = 1e5 + 10 ;

int n , m , q , h[ maxn ] , parr[ 21 ][ maxn ] ;
vector< int > g[ maxn ] , parrv[ 21 ][ maxn ] ;

void dfs( int v , int p )
{
   for( auto u : g [ v ] ){
     if( u != p ){
        h[ u ] = h[ v ]+1 ;
        parr[ 0 ][ u ] = v;
        dfs( u , v ) ;
     }
   }
}

void lca( int v , int u , int a )
{
   vector< int > ans ;

   if( h [ v ] < h[ u ] )
     swap( v , u );

   int dis = h[ v ]-h[ u ];

   for(int i = 0 ; i <= 19 ;i ++){
     if( dis & (1<<i) ){

        vector< int > v1 ;
        merge( all( ans ) , all( parrv[ i ][ v ] ) , back_inserter( v1 ) ) ;
        swap( ans , v1 );
        while( ans.size() > a )
            ans.pop_back() ;

        v = parr[ i ][ v ];
     }
   }

   for(int i = 19 ; i >= 0 ; i --){
     if( parr[ i ][ v ] != parr[ i ][ u ] ){

        vector< int > v1 , v2 ;
        merge( all( parrv[ i ][ u ] ) , all( parrv[ i ][ v ] ) , back_inserter( v1 ) ) ;
        merge( all( ans ) , all( v1 ) , back_inserter( v2 ) ) ;
        swap( ans , v2 );

        while( ans.size() > a )
            ans.pop_back() ;

        v = parr[ i ][ v ];
        u = parr[ i ][ u ];
     }
   }

   if( v == u ){
    vector< int > v1 ;
    merge( all( ans ) , all( parrv[ 0 ][ v ] ) , back_inserter( v1 ) );
    swap( ans , v1 ) ;
   }
   else{
    vector< int > v1 , v2 ;
    merge( all( parrv[ 0 ][ u ] ) , all( parrv[ 1 ][ v ] ) , back_inserter( v1 ) );
    merge( all( ans ) , all( v1 ) , back_inserter( v2 ) );
    swap( ans , v2 ) ;
   }

   while( ans.size() > a )
     ans.pop_back() ;

   printf( "%d " , ans.size() ) ;
   for( auto x : ans )
    printf("%d " , x ) ;
   printf("\n" ) ;
}

int main()
{
//ios_base::sync_with_stdio(0) , cin.tie(0) , cout.tie(0) ;

 scanf("%d%d%d" , &n , &m , &q ) ;
 for( int i = 1 ; i < n ; i ++){
    int v , u ;
    scanf("%d%d" , &v , &u);
    g[ v ].pb( u );
    g[ u ].pb( v );
 }

 dfs( 1 , 0 ) ;

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

    parrv[ 0 ][ c ].pb( i ) ;
    if( parrv[ 0 ][ c ].size() > 10 )
      parrv[ 0 ][ c ].pop_back() ;
 }

 for(int i = 1 ; i <= 19 ; i ++){
    for(int j = 1 ; j <= n ; j ++){

        parr[ i ][ j ] = parr[ i-1 ][ parr[ i-1 ][ j ] ] ;
        merge( all( parrv[ i-1 ][ j ] ) , all( parrv[ i-1 ][ parr[ i-1 ][ j ] ] ) , back_inserter( parrv[ i ][ j ] ) ) ;
        while( parrv[ i ][ j ].size() > 10 )
          parrv[ i ][ j ].pop_back() ;
    }
 }

 while( q-- ){
    int v , u , a ;
    scanf("%d%d%d" , &v , &u , &a) ;
    lca( v , u , a );
 }

    return 0;
}


// In the Name of Allah
// Ya Ali

#include <bits/stdc++.h>

using namespace std;

#define F first
#define S second
#define pb push_back
#define all( x ) x.begin() , x.end()

const int maxn = 1e5 + 10 ;

int n , m , q , h[ maxn ] , parr[ 32 ][ maxn ] ;
vector< int > g[ maxn ] , parrv[ 32 ][ maxn ] ;

void dfs( int v , int p )
{
   for( auto u : g [ v ] ){
     if( u != p ){
        h[ u ] = h[ v ]+1 ;
        parr[ 0 ][ u ] = v;
        dfs( u , v ) ;
     }
   }
}

void lca( int v , int u , int a )
{
   vector< int > ans ;

   if( h [ v ] < h[ u ] )
     swap( v , u );

   int dis = h[ v ]-h[ u ];

   for(int i = 0 ; i <= 30 ;i ++){
     if( dis & (1<<i) ){

        vector< int > v1 ;
        merge( all( ans ) , all( parrv[ i ][ v ] ) , back_inserter( v1 ) ) ;
        swap( ans , v1 );
        while( ans.size() > a )
            ans.pop_back() ;

        v = parr[ i ][ v ];
     }
   }

   for(int i = 30 ; i >= 0 ; i --){
     if( parr[ i ][ v ] != parr[ i ][ u ] ){

        vector< int > v1 , v2 ;
        merge( all( parrv[ i ][ u ] ) , all( parrv[ i ][ v ] ) , back_inserter( v1 ) ) ;
        merge( all( ans ) , all( v1 ) , back_inserter( v2 ) ) ;
        swap( ans , v2 );

        while( ans.size() > a )
            ans.pop_back() ;

        v = parr[ i ][ v ];
        u = parr[ i ][ u ];
     }
   }

   if( v == u ){
    vector< int > v1 ;
    merge( all( ans ) , all( parrv[ 0 ][ v ] ) , back_inserter( v1 ) );
    swap( ans , v1 ) ;
   }
   else{
    vector< int > v1 , v2 ;
    merge( all( parrv[ 0 ][ u ] ) , all( parrv[ 1 ][ v ] ) , back_inserter( v1 ) );
    merge( all( ans ) , all( v1 ) , back_inserter( v2 ) );
    swap( ans , v2 ) ;
   }

   while( ans.size() > a )
     ans.pop_back() ;

   printf( "%d " , ans.size() ) ;
   for( auto x : ans )
    printf("%d " , x ) ;
   printf("\n" ) ;
}

int main()
{
//ios_base::sync_with_stdio(0) , cin.tie(0) , cout.tie(0) ;

 scanf("%d%d%d" , &n , &m , &q ) ;
 for( int i = 1 ; i < n ; i ++){
    int v , u ;
    scanf("%d%d" , &v , &u);
    g[ v ].pb( u );
    g[ u ].pb( v );
 }

 dfs( 1 , 0 ) ;

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

    parrv[ 0 ][ c ].pb( i ) ;
 }

 for(int i = 1 ; i <= 30 ; i ++){
    for(int j = 1 ; j <= n ; j ++){

        parr[ i ][ j ] = parr[ i-1 ][ parr[ i-1 ][ j ] ] ;
        merge( all( parrv[ i-1 ][ j ] ) , all( parrv[ i-1 ][ parr[ i-1 ][ j ] ] ) , back_inserter( parrv[ i ][ j ] ) ) ;
        while( parrv[ i ][ j ].size() > 10 )
          parrv[ i ][ j ].pop_back() ;
    }
 }

 while( q-- ){
    int v , u , a ;
    scanf("%d%d%d" , &v , &u , &a) ;
    lca( v , u , a );
 }

    return 0;
}


#include <bits/stdc++.h>

using namespace std;
#define ll int
#define pll pair<ll,ll>
#define ff first
#define ss second
#define pb push_back
#define endl "\n"
const ll maxn= 1e5+100;
//const ll mod= 1e9+7 ;
const ll base=15;
/// con 3 ngay
vector<ll> adj[maxn];

vector<ll> gr[maxn][20];
ll anc[maxn][20];
vector<ll> gr1[maxn];
ll cnt[maxn];
ll dep[maxn];
vector<ll> mrg(vector<ll> nw1,vector<ll> nw2)
{
    ll id1=0;
    ll id2=0;
    vector<ll> ans;
    ll pre=-1e15;
    while (1)
    {
        while (id1<nw1.size()&&nw1[id1]<=pre) id1++;
        while (id2<nw2.size()&&nw2[id2]<=pre) id2++;

        if (id1<nw1.size()&&id2<nw2.size()&&ans.size()<base)
        {

            if (nw1[id1]<nw2[id2])
            {
                ans.pb(nw1[id1]);
                pre=ans.back();
                id1++;
            }
            else
            {
                ans.pb(nw2[id2]);
                pre=ans.back();
                id2++;
            }
        }
        else
        {
            break;
        }
    }
    while (1)
    {
        while (id1<nw1.size()&&nw1[id1]<=pre) id1++;
        if (ans.size()<base&&id1<nw1.size())
        {

            ans.pb(nw1[id1]);
            pre=ans.back();
            id1++;
        }
        else
        {
            break;
        }
    }
    while (1)
    {
        while (id2<nw2.size()&&nw2[id2]<=pre) id2++;
        if (ans.size()<base&&id2<nw2.size())
        {

            ans.pb(nw2[id2]);
            pre=ans.back();
            id2++;
        }
        else
        {
            break;
        }
    }
    return ans;
}
void dfs(ll u,ll par)
{
    anc[u][0]=par;
    gr[u][0].clear();
    gr[u][0]=mrg(gr1[par],gr[u][0]);
    for (int i=1; i<=18; i++)
    {

        gr[u][i]=mrg(gr[u][i-1],gr[anc[u][i-1]][i-1]);
        anc[u][i]=anc[anc[u][i-1]][i-1];
        /*if (u==5)
        {
            cout <<gr[u][i].size()<<endl;
        }*/
    }

    cnt[u]+=(int)(gr1[u].size());
    for (auto to:adj[u])
    {
        if (to==par)
            continue;
        cnt[to]=cnt[u];
        dep[to]=dep[u]+1;
        dfs(to,u);

    }
}
ll lca(ll x,ll y)
{
    if (dep[x]<dep[y])
        swap(x,y);
    ll kc= dep[x]-dep[y];
    for (int i=18; i>=0; i--)
    {
        if (kc&(1ll<<i))
        {
            x=anc[x][i];
        }
    }
    if (x==y)
        return x;
    for (int i=18; i>=0; i--)
    {
        if (anc[x][i]!=anc[y][i])
        {
            x=anc[x][i];
            y=anc[y][i];
        }

    }
    return anc[x][0];

}
ll top_e(ll l,ll y)
{
    ll p=dep[y]-dep[l]-1;

}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //freopen("test.txt","r", stdin);

    if (fopen("atlarge.in","r"))
    {
        freopen("atlarge.in","r", stdin);
        freopen("atlarge.out", "w",stdout);
    }
    ll n, m, q;
    cin>>n>> m>> q;
    for (int i=1; i<=n-1; i++)
    {
        ll x, y;
        cin>>x>> y;
        adj[x].pb(y);
        adj[y].pb(x);
    }

    for (int i=1; i<=m; i++)
    {
        ll x;
        cin>>x;
        gr1[x].pb(i);
    }
    gr1[0].clear();
    for (int i=1; i<=n; i++)
    {
        sort(gr1[i].begin(),gr1[i].end());
        gr1[i].erase(unique(gr1[i].begin(),gr1[i].end()),gr1[i].end());
        while (gr1[i].size()>base)
        {
            gr1[i].pop_back();
        }
    }

    dfs(1,0);
    while (q--)
    {
        ll x, y, a;
        cin>>x>>y>>a;
        if (dep[x]<dep[y])
            swap(x,y);
        ll l=lca(x,y);
        // cout <<l<<" "<<x<<" "<<y<<endl;
        // cout <<k<<endl;
        if (y==l)
        {
            vector<ll> ans;
            ll kc=dep[x]-dep[l];
            ans=mrg(ans,gr1[x]);
            for (int i=18; i>=0; i--)
            {
                if (kc&(1ll<<i))
                {
                    ans=mrg(ans,gr[x][i]);
                    // cout <<gr[x][i].size()<<" "<<ans.size()<<endl;
                    x=anc[x][i];
                }
            }
            // cout <<k<<" "<<ans.size()<<endl;
            ll k=min((ll)ans.size(),a);

            cout <<k<<" ";
            for (int i=1; i<=k; i++)
            {
                cout <<ans[i-1]<<" ";
            }
            cout <<endl;
        }
        else
        {
            vector<ll> ans;
            ans.clear();
            ll kc=dep[x]-dep[l];
            ans=mrg(ans,gr1[x]);
            ans=mrg(ans,gr1[y]);
            for (int i=18; i>=0; i--)
            {
                if (kc&(1ll<<i))
                {
                    //cout <<i<<endl;
                    ans=mrg(ans,gr[x][i]);
                    x=anc[x][i];
                }
            }
            kc=dep[y]-dep[l]-1;
            for (int i=18; i>=0; i--)
            {
                if (kc&(1ll<<i))
                {

                    ans=mrg(ans,gr[y][i]);
                    y=anc[y][i];
                }
            }
            ll k=min((ll)ans.size(),a);
            cout <<k<<" ";
            for (int i=1; i<=k; i++)
            {
                cout <<ans[i-1]<<" ";
            }
            cout <<endl;

        }

    }

}