// Create your own template by modifying this file!
#include <bits/stdc++.h>
#include <string>
#include <vector>
#include <climits>
#include <cstring>
#include <map>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <stack>
#include <functional>
#include <bits/stdc++.h>

#define SZ(X) ((int)(X).size())
#define LEN(X) strlen(X)
#define FOR(i, c) for(auto &i: c)
#define ALL(x) (x).begin(),(x).end()
#define REP(i, n) for(int i=0;i<(n);i++)
#define REP1(i, a, b) for(int i=(a);i<=(b);i++)
#define REPL(i, x) for(int i=0;x[i];i++)
#define PER(i, n) for(int i=(n)-1;i>=0;i--)
#define PER1(i, a, b) for(int i=(a);i>=(b);i--)
#define DRI(x) int x;RI(x)
#define DRII(x, y) int x,y;RII(x,y)
#define DRIII(x, y, z) int x,y,z;RIII(x,y,z)
#define PI(x) printf("%d\n",x)
#define PIS(x) printf("%d ",x)
#ifdef ONLINE_JUDGE
#define PL(x) printf("%I64d\n",x);
#else
#define PL(x) printf("%lld\n",x)
#endif
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define BG begin()
#define ED end()
#define PQ priority_queue
#define MS0(x) memset(x,0,sizeof(x))
#define MS1(x) memset(x,-1,sizeof(x))
#define SEP(x) ((x)?'\n':' ')
#define V(x) vector<x>
using namespace std;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef long long LL;
const int INF = 1000000000;

static const int maxlog = 20;
#ifdef DEBUG
#define debug(args...)            {dbg,args; cerr<<endl;}
#else
#define debug(args...)              // Just strip off all debug tokens
#endif

struct debugger {
    template<typename T>
    debugger &operator,(const T &v) {
        cerr << v << " ";
        return *this;
    }
} dbg;

int merge1(int *as, int *ae, int *bs, int *be, int *rs) {
//    cout << "start: " << *as << " " << *bs << " addr:" << as << " " << ae << " " << bs << " " << be << " " << endl;
    int total = 0;
    for (; as < ae || bs < be; rs++) {
//        cout << "lol: " << *as << " " << *bs << " addr:" << as << " " << ae << " " << bs << " " << be << " " << endl;
        if (as == ae) {
            *rs = *bs;
            bs++;
        } else if (bs == be) {
            *rs = *as;
            as++;
        } else if (*as > *bs) {
            *rs = *bs;
            bs++;
        } else if (*bs > *as) {
            *rs = *as;
            as++;
        } else {
            *rs = *as;
            as++;
            bs++;
        }
        total++;
        if (total >= 10) break;
    }
    return total;
}

void dfs(vector<vector<int>> &g, int u, vector<bool> &vis, int par[][maxlog], int cit[][maxlog][11],
         int count[][maxlog], int n, vector<int> &h, int ch) {
    vis[u] = true;
    h[u] = ch;

    for (auto v : g[u]) {
        if (vis[v]) continue;
        par[v][1] = u;
        for (int i = 1; i < maxlog && par[v][i - 1] != -1; ++i) {
            if (i > 1) {
                par[v][i] = par[par[v][i - 1]][i - 1];
                count[v][i] = merge1(cit[v][i - 1], cit[v][i - 1] + count[v][i - 1], cit[par[v][i - 1]][i - 1],
                                     cit[par[v][i - 1]][i - 1] + count[par[v][i - 1]][i - 1], cit[v][i]);
            } else {
                par[v][i] = u;
                count[v][i] = merge1(cit[v][i - 1], cit[v][i - 1] + count[v][i - 1], cit[par[v][i]][i - 1],
                                     cit[par[v][i]][i - 1] + count[par[v][i]][i - 1], cit[v][i]);
            }
        }
        dfs(g, v, vis, par, cit, count, n, h, ch + 1);
    }
}

int main() {
    int n, m, q;
    cin >> n >> m >> q;
    vector<int> h(n, -1);
    int par[n][maxlog];
    int cit[n][maxlog][11];
    int count[n][maxlog];
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < maxlog; ++j) {
            count[i][j] = 0;
        }
    }
    for (int j = 0; j < n; ++j) {
        for (int i = 0; i < maxlog; ++i) {
            par[j][i] = -1;
        }
    }
    vector<vector<int>> g(n);
    for (int i = 0; i < n - 1; ++i) {
        int u, v;
        cin >> u >> v;
        g[u - 1].push_back(v - 1);
        g[v - 1].push_back(u - 1);
    }
    vector<set<int>> people(n);
    for (int l = 0; l < m; ++l) {
        int c;
        cin >> c;
        people[c - 1].insert(l);
        if (people[c - 1].size() > 10) {
            set<int>::iterator it = people[c - 1].end();
            it--;
            people[c - 1].erase(it);
        }
    }
    for (int l = 0; l < n; ++l) {
        par[l][0] = l;
        count[l][0] = (int) people[l].size();
        int i = 0;
        for (int p : people[l]) {
            cit[l][0][i] = p;
            i++;
        }
    }

    vector<bool> vis(n);
    dfs(g, 0, vis, par, cit, count, n, h, 0);

    int rans[11];
    int tmp[11];
    for (int k = 0; k < q; ++k) {
        int l, r, alimit;
        cin >> l >> r >> alimit;
        l--;
        r--;
        int rcount = 0;
        if (h[l] != h[r]) {
            if (h[l] > h[r]) {
                swap(l, r);
            }
            for (int i = maxlog - 1; i >= 0; --i) {
                if (par[r][i] < 0) continue;
                if (h[par[r][i]] < h[l]) continue;
                rcount = merge1(cit[r][i], cit[r][i] + count[r][i], rans, rans + rcount, tmp);
                for (int j = 0; j < rcount; ++j) {
                    rans[j] = tmp[j];
                }
                r = par[r][i];
                if (h[r] == h[l]) break;
            }
        } else {
            for (int i = 0; i < count[r][0]; ++i) {
                rans[i] = cit[r][0][i];
            }
            rcount = count[r][0];
        }

        int i;
        for (i = maxlog - 1; i >= 0; --i) {
            if (par[r][i] != par[l][i]) {
                rcount = merge1(cit[l][i], cit[l][i] + count[l][i], rans, rans + rcount, tmp);
                rcount = merge1(cit[r][i], cit[r][i] + count[r][i], tmp, tmp + rcount, rans);

                r = par[r][i];
                l = par[l][i];
            }
        }
        if (r != l) {
            rcount = merge1(cit[l][1], cit[l][1] + count[l][1], rans, rans + rcount, tmp);
            rcount = merge1(cit[r][1], cit[r][1] + count[r][1], tmp, tmp + rcount, rans);
        }

//        cout << "LCA:" << par[r][1] << " " << par[l][1] << " " << r << " " << l << " " << i <<  endl;

        int anscount = min(alimit, rcount);
        cout << anscount;
        for (int i = 0; i < anscount; ++i) {
            cout << " " << (rans[i] + 1);
        }
        cout << endl;
    }

    return 0;
}


// Create your own template by modifying this file!
#include <bits/stdc++.h>
#include <string>
#include <vector>
#include <climits>
#include <cstring>
#include <map>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <stack>
#include <functional>
#include <bits/stdc++.h>

#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define SZ(X) ((int)(X).size())
#define LEN(X) strlen(X)
#define FOR(i, c) for(auto &i: c)
#define ALL(x) (x).begin(),(x).end()
#define REP(i, n) for(int i=0;i<(n);i++)
#define REP1(i, a, b) for(int i=(a);i<=(b);i++)
#define REPL(i, x) for(int i=0;x[i];i++)
#define PER(i, n) for(int i=(n)-1;i>=0;i--)
#define PER1(i, a, b) for(int i=(a);i>=(b);i--)
#define RI(x) scanf("%d",&x)
#define DRI(x) int x;RI(x)
#define RII(x, y) scanf("%d%d",&x,&y)
#define DRII(x, y) int x,y;RII(x,y)
#define RIII(x, y, z) scanf("%d%d%d",&x,&y,&z)
#define DRIII(x, y, z) int x,y,z;RIII(x,y,z)
#define RS(x) scanf("%s",x)
#define PI(x) printf("%d\n",x)
#define PIS(x) printf("%d ",x)
#ifdef ONLINE_JUDGE
#define PL(x) printf("%I64d\n",x);
#else
#define PL(x) printf("%lld\n",x)
#endif
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define BG begin()
#define ED end()
#define PQ priority_queue
#define MS0(x) memset(x,0,sizeof(x))
#define MS1(x) memset(x,-1,sizeof(x))
#define SEP(x) ((x)?'\n':' ')
#define V(x) vector<x>
using namespace std;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef long long LL;
const int INF = 1000000000;

static const int maxlog = 17;
#ifdef DEBUG
#define debug(args...)            {dbg,args; cerr<<endl;}
#else
#define debug(args...)              // Just strip off all debug tokens
#endif

struct debugger {
    template<typename T>
    debugger &operator,(const T &v) {
        cerr << v << " ";
        return *this;
    }
} dbg;

int merge1(int *as, int *ae, int *bs, int *be, int *rs) {
    int total = 0;
    for (; as < ae || bs < be; rs++, total++) {
        if (as == ae) {
            *rs = *bs;
            bs++;
            continue;
        }

        if (bs == be) {
            *rs = *as;
            as++;
            continue;
        }

        if (*as > *bs) {
            *rs = *bs;
            bs++;
        } else if (*bs > *as) {
            *rs = *as;
            as++;
        } else {
            *rs = *as;
            as++;
            bs++;
        }
        if (total > 10) break;
    }
    return total;
}

void dfs(vector<vector<int>> &g, int u, vector<bool> &vis, int par[][maxlog], int cit[][maxlog][30],
         int count[][maxlog], int n, vector<int> &h, int ch) {
    vis[u] = true;
    h[u] = ch;

    for (auto v : g[u]) {
        if (vis[v]) continue;
        par[v][1] = u;
        for (int i = 1; i < maxlog && par[v][i - 1] != -1; ++i) {
            if (i > 1) {
                par[v][i] = par[par[v][i - 1]][i - 1];
                for (int j = 0; j < count[v][i - 1]; ++j) {
                    int *p = cit[v][i - 1] + j;
                }
                for (int j = 0; j < count[par[v][i - 1]][i - 1]; ++j) {
                    int *p = cit[par[v][i - 1]][i - 1] + j;
                }
                count[v][i] = merge1(cit[v][i - 1], cit[v][i - 1] + count[v][i - 1], cit[par[v][i - 1]][i - 1],
                                     cit[par[v][i - 1]][i - 1] + count[par[v][i - 1]][i - 1], cit[v][i]);
                for (int j = 0; j < count[v][i]; ++j) {
                    int *p = cit[v][i] + j;
                }
            } else {
                par[v][i] = u;
                for (int j = 0; j < count[v][i - 1]; ++j) {
                    int *p = cit[v][i - 1] + j;
                }
                for (int j = 0; j < count[par[v][i]][i - 1]; ++j) {
                    int *p = cit[par[v][i]][i - 1] + j;
                }
                count[v][i] = merge1(cit[v][i - 1], cit[v][i - 1] + count[v][i - 1], cit[par[v][i]][i - 1],
                                     cit[par[v][i]][i - 1] + count[par[v][i]][i - 1], cit[v][i]);
            }
        }
        dfs(g, v, vis, par, cit, count, n, h, ch + 1);
    }
}

int main() {
    int n, m, q;
    cin >> n >> m >> q;
    vector<int> h(n, -1);
    int par[n][maxlog];
    int cit[n][maxlog][30];
    int count[n][maxlog];
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < maxlog; ++j) {
            count[i][j] = 0;
        }
    }
    for (int j = 0; j < n; ++j) {
        for (int i = 0; i < maxlog; ++i) {
            par[j][i] = -1;
        }
    }
    vector<int> v;
    vector<vector<int>> g(n, v);
    for (int i = 0; i < n - 1; ++i) {
        int u, v;
        cin >> u >> v;
        g[u - 1].push_back(v - 1);
        g[v - 1].push_back(u - 1);
    }
    vector<set<int>> people(n);
    for (int l = 0; l < m; ++l) {
        int c;
//        scanf("%d", &c);
        cin >> c;
        people[c - 1].insert(l);
        if (people[c - 1].size() > 10) {
            set<int>::iterator it = people[c - 1].end();
            it--;
            people[c - 1].erase(it);
        }
    }
    for (int l = 0; l < n; ++l) {
        par[l][0] = l;
        count[l][0] = (int) people[l].size();
        int i = 0;
        for (int p : people[l]) {
            cit[l][0][i] = p;
            i++;
        }
    }

    vector<bool> vis(n);
    vector<vector<int>> st(n);
    dfs(g, 0, vis, par, cit, count, n, h, 0);

    int p2[maxlog + 1];
    p2[0] = 1;
//    p2[1] = 1;
    for (int i = 1; i <= maxlog; ++i) {
        p2[i] = 2 * p2[i - 1];
    }

    int lans[30];
    int rans[30];
    int tmp[30];
    for (int k = 0; k < q; ++k) {
        int l, r, a;
        cin >> l >> r >> a;
        l--;
        r--;
        int lcount = 0, rcount = 0;
        if (h[l] != h[r]) {
            if (h[l] > h[r]) {
                swap(l, r);
            }
            for (int i = maxlog - 1; i >= 0; --i) {
                if (par[r][i] < 0) continue;
                if (h[par[r][i]] < h[l]) continue;
                rcount = merge1(cit[r][i], cit[r][i] + count[r][i], rans, rans + rcount, tmp);
                for (int j = 0; j < rcount; ++j) {
                    rans[j] = tmp[j];
                }
                r = par[r][i];
                if (h[r] == h[l]) break;
            }
        } else {
            for (int i = 0; i < count[r][0]; ++i) {
                rans[i] = cit[r][0][i];
            }
            rcount = count[r][0];
        }

        for (int i = maxlog - 1; i >= 0; --i) {
            if (par[r][i] < 0 || par[l][i] < 0) continue;
            if (par[r][i] == par[l][i] && i > 0) continue;
            if (par[r][i] != par[l][i]) i++;
            rcount = merge1(cit[l][i], cit[l][i] + count[l][i], rans, rans + rcount, tmp);
            for (int j = 0; j < rcount; ++j) {
                rans[j] = tmp[j];
            }
            rcount = merge1(cit[r][i], cit[r][i] + count[r][i], rans, rans + rcount, tmp);
            for (int j = 0; j < rcount; ++j) {
                rans[j] = tmp[j];
            }
            r = par[r][i];
            l = par[l][i];

        }
        int anscount = min(a, rcount);
        cout << anscount;
        for (int i = 0; i < anscount; ++i) {
            cout << " " << (rans[i] + 1);
        }
        cout << endl;
    }

    return 0;
}


// Create your own template by modifying this file!
#include <bits/stdc++.h>
#include <string>
#include <vector>
#include <climits>
#include <cstring>
#include <map>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <stack>
#include <functional>
#include <bits/stdc++.h>

#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define SZ(X) ((int)(X).size())
#define LEN(X) strlen(X)
#define FOR(i, c) for(auto &i: c)
#define ALL(x) (x).begin(),(x).end()
#define REP(i, n) for(int i=0;i<(n);i++)
#define REP1(i, a, b) for(int i=(a);i<=(b);i++)
#define REPL(i, x) for(int i=0;x[i];i++)
#define PER(i, n) for(int i=(n)-1;i>=0;i--)
#define PER1(i, a, b) for(int i=(a);i>=(b);i--)
#define RI(x) scanf("%d",&x)
#define DRI(x) int x;RI(x)
#define RII(x, y) scanf("%d%d",&x,&y)
#define DRII(x, y) int x,y;RII(x,y)
#define RIII(x, y, z) scanf("%d%d%d",&x,&y,&z)
#define DRIII(x, y, z) int x,y,z;RIII(x,y,z)
#define RS(x) scanf("%s",x)
#define PI(x) printf("%d\n",x)
#define PIS(x) printf("%d ",x)
#ifdef ONLINE_JUDGE
#define PL(x) printf("%I64d\n",x);
#else
#define PL(x) printf("%lld\n",x)
#endif
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define BG begin()
#define ED end()
#define PQ priority_queue
#define MS0(x) memset(x,0,sizeof(x))
#define MS1(x) memset(x,-1,sizeof(x))
#define SEP(x) ((x)?'\n':' ')
#define V(x) vector<x>
using namespace std;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef long long LL;
const int INF = 1000000000;

static const int maxlog = 17;
#ifdef DEBUG
#define debug(args...)            {dbg,args; cerr<<endl;}
#else
#define debug(args...)              // Just strip off all debug tokens
#endif

struct debugger {
    template<typename T>
    debugger &operator,(const T &v) {
        cerr << v << " ";
        return *this;
    }
} dbg;

int merge1(int *as, int *ae, int *bs, int *be, int *rs) {
    int total = 0;
    for (; as < ae || bs < be; rs++, total++) {
        if (as == ae) {
            *rs = *bs;
            bs++;
            continue;
        }

        if (bs == be) {
            *rs = *as;
            as++;
            continue;
        }

        if (*as > *bs) {
            *rs = *bs;
            bs++;
        } else if (*bs > *as) {
            *rs = *as;
            as++;
        } else {
            *rs = *as;
            as++;
            bs++;
        }
    }
    return total > 11 ? 11 : total;
}

void dfs(vector<vector<int>> &g, int u, vector<bool> &vis, int par[][maxlog], int cit[][maxlog][30],
         int count[][maxlog], int n, vector<int> &h, int ch) {
    vis[u] = true;
    h[u] = ch;

    for (auto v : g[u]) {
        if (vis[v]) continue;
        par[v][1] = u;
        for (int i = 1; i < maxlog && par[v][i - 1] != -1; ++i) {
            if (i > 1) {
                par[v][i] = par[par[v][i - 1]][i - 1];
                for (int j = 0; j < count[v][i - 1]; ++j) {
                    int *p = cit[v][i - 1] + j;
                }
                for (int j = 0; j < count[par[v][i - 1]][i - 1]; ++j) {
                    int *p = cit[par[v][i - 1]][i - 1] + j;
                }
                count[v][i] = merge1(cit[v][i - 1], cit[v][i - 1] + count[v][i - 1], cit[par[v][i - 1]][i - 1],
                                     cit[par[v][i - 1]][i - 1] + count[par[v][i - 1]][i - 1], cit[v][i]);
                for (int j = 0; j < count[v][i]; ++j) {
                    int *p = cit[v][i] + j;
                }
            } else {
                par[v][i] = u;
                for (int j = 0; j < count[v][i - 1]; ++j) {
                    int *p = cit[v][i - 1] + j;
                }
                for (int j = 0; j < count[par[v][i]][i - 1]; ++j) {
                    int *p = cit[par[v][i]][i - 1] + j;
                }
                count[v][i] = merge1(cit[v][i - 1], cit[v][i - 1] + count[v][i - 1], cit[par[v][i]][i - 1],
                                     cit[par[v][i]][i - 1] + count[par[v][i]][i - 1], cit[v][i]);
            }
        }
        dfs(g, v, vis, par, cit, count, n, h, ch + 1);
    }
}

int main() {
    int n, m, q;
    cin >> n >> m >> q;
    vector<int> h(n, -1);
    int par[n][maxlog];
    int cit[n][maxlog][30];
    int count[n][maxlog];
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < maxlog; ++j) {
            count[i][j] = 0;
        }
    }
    for (int j = 0; j < n; ++j) {
        for (int i = 0; i < maxlog; ++i) {
            par[j][i] = -1;
        }
    }
    vector<int> v;
    vector<vector<int>> g(n, v);
    for (int i = 0; i < n - 1; ++i) {
        int u, v;
        cin >> u >> v;
        g[u - 1].push_back(v - 1);
        g[v - 1].push_back(u - 1);
    }
    vector<set<int>> people(n);
    for (int l = 0; l < m; ++l) {
        int c;
//        scanf("%d", &c);
        cin >> c;
        people[c - 1].insert(l);
        if (people[c - 1].size() > 10) {
            set<int>::iterator it = people[c - 1].end();
            it--;
            people[c - 1].erase(it);
        }
    }
    for (int l = 0; l < n; ++l) {
        par[l][0] = l;
        count[l][0] = (int) people[l].size();
        int i = 0;
        for (int p : people[l]) {
            cit[l][0][i] = p;
            i++;
        }
    }

    vector<bool> vis(n);
    vector<vector<int>> st(n);
    dfs(g, 0, vis, par, cit, count, n, h, 0);

    int p2[maxlog + 1];
    p2[0] = 1;
//    p2[1] = 1;
    for (int i = 1; i <= maxlog; ++i) {
        p2[i] = 2 * p2[i - 1];
    }

    for (int k = 0; k < q; ++k) {
        int l, r, a;
        cin >> l >> r >> a;
        l--;
        r--;
        int lans[30];
        int rans[30];
        int tmp[30];
        int lcount = 0, rcount = 0;
        if (h[l] != h[r]) {
            if (h[l] > h[r]) {
                swap(l, r);
            }
            for (int i = maxlog - 1; i >= 0; --i) {
                if (par[r][i] < 0) continue;
                if (h[par[r][i]] < h[l]) continue;
                rcount = merge1(cit[r][i], cit[r][i] + count[r][i], rans, rans + rcount, tmp);
                for (int j = 0; j < rcount; ++j) {
                    rans[j] = tmp[j];
                }
                r = par[r][i];
                if (h[r] == h[l]) break;
            }
        } else {
            for (int i = 0; i < count[r][0]; ++i) {
                rans[i] = cit[r][0][i];
            }
            rcount = count[r][0];
        }

        for (int i = maxlog - 1; i >= 0; --i) {
            if (par[r][i] < 0 || par[l][i] < 0) continue;
            if (par[r][i] == par[l][i] && i > 0) continue;
                                        if (par[r][i] != par[l][i]) i++;
            rcount = merge1(cit[l][i], cit[l][i] + count[l][i], rans, rans + rcount, tmp);
            for (int j = 0; j < rcount; ++j) {
                rans[j] = tmp[j];
            }
            rcount = merge1(cit[r][i], cit[r][i] + count[r][i], rans, rans + rcount, tmp);
            for (int j = 0; j < rcount; ++j) {
                rans[j] = tmp[j];
            }
            r = par[r][i];
            l = par[l][i];

        }
        int anscount = min(a, rcount);
        cout << anscount;
        for (int i = 0; i < anscount; ++i) {
            cout << " " << (rans[i] + 1);
        }
        cout << endl;
    }

    return 0;
}


// Create your own template by modifying this file!
#include <bits/stdc++.h>
#include <string>
#include <vector>
#include <climits>
#include <cstring>
#include <map>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <stack>
#include <functional>
#include <bits/stdc++.h>

#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define SZ(X) ((int)(X).size())
#define LEN(X) strlen(X)
#define FOR(i, c) for(auto &i: c)
#define ALL(x) (x).begin(),(x).end()
#define REP(i, n) for(int i=0;i<(n);i++)
#define REP1(i, a, b) for(int i=(a);i<=(b);i++)
#define REPL(i, x) for(int i=0;x[i];i++)
#define PER(i, n) for(int i=(n)-1;i>=0;i--)
#define PER1(i, a, b) for(int i=(a);i>=(b);i--)
#define RI(x) scanf("%d",&x)
#define DRI(x) int x;RI(x)
#define RII(x, y) scanf("%d%d",&x,&y)
#define DRII(x, y) int x,y;RII(x,y)
#define RIII(x, y, z) scanf("%d%d%d",&x,&y,&z)
#define DRIII(x, y, z) int x,y,z;RIII(x,y,z)
#define RS(x) scanf("%s",x)
#define PI(x) printf("%d\n",x)
#define PIS(x) printf("%d ",x)
#ifdef ONLINE_JUDGE
#define PL(x) printf("%I64d\n",x);
#else
#define PL(x) printf("%lld\n",x)
#endif
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define BG begin()
#define ED end()
#define PQ priority_queue
#define MS0(x) memset(x,0,sizeof(x))
#define MS1(x) memset(x,-1,sizeof(x))
#define SEP(x) ((x)?'\n':' ')
#define V(x) vector<x>
using namespace std;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef long long LL;
const int INF = 1000000000;

static const int maxlog = 17;
#ifdef DEBUG
#define debug(args...)            {dbg,args; cerr<<endl;}
#else
#define debug(args...)              // Just strip off all debug tokens
#endif

struct debugger {
    template<typename T>
    debugger &operator,(const T &v) {
        cerr << v << " ";
        return *this;
    }
} dbg;

int merge1(int *as, int *ae, int *bs, int *be, int *rs) {
    int total = 0;
    for (; as < ae || bs < be; rs++, total++) {
        if (as == ae) {
            *rs = *bs;
            bs++;
            continue;
        }

        if (bs == be) {
            *rs = *as;
            as++;
            continue;
        }

        if (*as > *bs) {
            *rs = *bs;
            bs++;
        } else if (*bs > *as) {
            *rs = *as;
            as++;
        } else {
            *rs = *as;
            as++;
            bs++;
        }
        if (total > 10) break;
    }
    return total;
}

void dfs(vector<vector<int>> &g, int u, vector<bool> &vis, int par[][maxlog], int cit[][maxlog][30],
         int count[][maxlog], int n, vector<int> &h, int ch) {
    vis[u] = true;
    h[u] = ch;

    for (auto v : g[u]) {
        if (vis[v]) continue;
        par[v][1] = u;
        for (int i = 1; i < maxlog && par[v][i - 1] != -1; ++i) {
            if (i > 1) {
                par[v][i] = par[par[v][i - 1]][i - 1];
                count[v][i] = merge1(cit[v][i - 1], cit[v][i - 1] + count[v][i - 1], cit[par[v][i - 1]][i - 1],
                                     cit[par[v][i - 1]][i - 1] + count[par[v][i - 1]][i - 1], cit[v][i]);
            } else {
                par[v][i] = u;
                count[v][i] = merge1(cit[v][i - 1], cit[v][i - 1] + count[v][i - 1], cit[par[v][i]][i - 1],
                                     cit[par[v][i]][i - 1] + count[par[v][i]][i - 1], cit[v][i]);
            }
        }
        dfs(g, v, vis, par, cit, count, n, h, ch + 1);
    }
}

int main() {
    int n, m, q;
    cin >> n >> m >> q;
    vector<int> h(n, -1);
    int par[n][maxlog];
    int cit[n][maxlog][30];
    int count[n][maxlog];
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < maxlog; ++j) {
            count[i][j] = 0;
        }
    }
    for (int j = 0; j < n; ++j) {
        for (int i = 0; i < maxlog; ++i) {
            par[j][i] = -1;
        }
    }
    vector<int> v;
    vector<vector<int>> g(n, v);
    for (int i = 0; i < n - 1; ++i) {
        int u, v;
        cin >> u >> v;
        g[u - 1].push_back(v - 1);
        g[v - 1].push_back(u - 1);
    }
    vector<set<int>> people(n);
    for (int l = 0; l < m; ++l) {
        int c;
//        scanf("%d", &c);
        cin >> c;
        people[c - 1].insert(l);
        if (people[c - 1].size() > 10) {
            set<int>::iterator it = people[c - 1].end();
            it--;
            people[c - 1].erase(it);
        }
    }
    for (int l = 0; l < n; ++l) {
        par[l][0] = l;
        count[l][0] = (int) people[l].size();
        int i = 0;
        for (int p : people[l]) {
            cit[l][0][i] = p;
            i++;
        }
    }

    vector<bool> vis(n);
    vector<vector<int>> st(n);
    dfs(g, 0, vis, par, cit, count, n, h, 0);

    int p2[maxlog + 1];
    p2[0] = 1;
//    p2[1] = 1;
    for (int i = 1; i <= maxlog; ++i) {
        p2[i] = 2 * p2[i - 1];
    }

    int lans[30];
    int rans[30];
    int tmp[30];
    for (int k = 0; k < q; ++k) {
        int l, r, a;
        cin >> l >> r >> a;
        l--;
        r--;
        int lcount = 0, rcount = 0;
        if (h[l] != h[r]) {
            if (h[l] > h[r]) {
                swap(l, r);
            }
            for (int i = maxlog - 1; i >= 0; --i) {
                if (par[r][i] < 0) continue;
                if (h[par[r][i]] < h[l]) continue;
                rcount = merge1(cit[r][i], cit[r][i] + count[r][i], rans, rans + rcount, tmp);
                for (int j = 0; j < rcount; ++j) {
                    rans[j] = tmp[j];
                }
                r = par[r][i];
                if (h[r] == h[l]) break;
            }
        } else {
            for (int i = 0; i < count[r][0]; ++i) {
                rans[i] = cit[r][0][i];
            }
            rcount = count[r][0];
        }

        for (int i = maxlog - 1; i >= 0; --i) {
            if (par[r][i] < 0 || par[l][i] < 0) continue;
            if (par[r][i] == par[l][i] && i > 0) continue;
            if (par[r][i] != par[l][i]) i++;
            rcount = merge1(cit[l][i], cit[l][i] + count[l][i], rans, rans + rcount, tmp);
            rcount = merge1(cit[r][i], cit[r][i] + count[r][i], tmp, tmp + rcount, rans);
            r = par[r][i];
            l = par[l][i];
        }
        int anscount = min(a, rcount);
        cout << anscount;
        for (int i = 0; i < anscount; ++i) {
            cout << " " << (rans[i] + 1);
        }
        cout << endl;
    }

    return 0;
}


// Create your own template by modifying this file!
#include <bits/stdc++.h>
#include <string>
#include <vector>
#include <climits>
#include <cstring>
#include <map>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <stack>
#include <functional>
#include <bits/stdc++.h>

#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define SZ(X) ((int)(X).size())
#define LEN(X) strlen(X)
#define FOR(i, c) for(auto &i: c)
#define ALL(x) (x).begin(),(x).end()
#define REP(i, n) for(int i=0;i<(n);i++)
#define REP1(i, a, b) for(int i=(a);i<=(b);i++)
#define REPL(i, x) for(int i=0;x[i];i++)
#define PER(i, n) for(int i=(n)-1;i>=0;i--)
#define PER1(i, a, b) for(int i=(a);i>=(b);i--)
#define RI(x) scanf("%d",&x)
#define DRI(x) int x;RI(x)
#define RII(x, y) scanf("%d%d",&x,&y)
#define DRII(x, y) int x,y;RII(x,y)
#define RIII(x, y, z) scanf("%d%d%d",&x,&y,&z)
#define DRIII(x, y, z) int x,y,z;RIII(x,y,z)
#define RS(x) scanf("%s",x)
#define PI(x) printf("%d\n",x)
#define PIS(x) printf("%d ",x)
#ifdef ONLINE_JUDGE
#define PL(x) printf("%I64d\n",x);
#else
#define PL(x) printf("%lld\n",x)
#endif
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define BG begin()
#define ED end()
#define PQ priority_queue
#define MS0(x) memset(x,0,sizeof(x))
#define MS1(x) memset(x,-1,sizeof(x))
#define SEP(x) ((x)?'\n':' ')
#define V(x) vector<x>
using namespace std;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef long long LL;
const int INF = 1000000000;

static const int maxlog = 17;
#ifdef DEBUG
#define debug(args...)            {dbg,args; cerr<<endl;}
#else
#define debug(args...)              // Just strip off all debug tokens
#endif

struct debugger {
    template<typename T>
    debugger &operator,(const T &v) {
        cerr << v << " ";
        return *this;
    }
} dbg;

int merge1(int *as, int *ae, int *bs, int *be, int *rs) {
    int total = 0;
    for (; as < ae || bs < be; rs++, total++) {
        if (as == ae) {
            *rs = *bs;
            bs++;
            continue;
        }

        if (bs == be) {
            *rs = *as;
            as++;
            continue;
        }

        if (*as > *bs) {
            *rs = *bs;
            bs++;
        } else if (*bs > *as) {
            *rs = *as;
            as++;
        } else {
            *rs = *as;
            as++;
            bs++;
        }
    }
    return total % 11;
}

void dfs(vector<vector<int>> &g, int u, vector<bool> &vis, int par[][maxlog], int cit[][maxlog][30],
         int count[][maxlog], int n, vector<vector<int>> &people, vector<int> &h, int ch) {
    vis[u] = true;
    h[u] = ch;

    for (auto v : g[u]) {
        if (vis[v]) continue;
        par[v][1] = u;
        for (int i = 1; i < maxlog && par[v][i - 1] != -1; ++i) {
            if (i > 1) {
                par[v][i] = par[par[v][i - 1]][i - 1];
                for (int j = 0; j < count[v][i - 1]; ++j) {
                    int *p = cit[v][i - 1] + j;
                }
                for (int j = 0; j < count[par[v][i - 1]][i - 1]; ++j) {
                    int *p = cit[par[v][i - 1]][i - 1] + j;
                }
                count[v][i] = merge1(cit[v][i - 1], cit[v][i - 1] + count[v][i - 1], cit[par[v][i - 1]][i - 1],
                                     cit[par[v][i - 1]][i - 1] + count[par[v][i - 1]][i - 1], cit[v][i]);
                for (int j = 0; j < count[v][i]; ++j) {
                    int *p = cit[v][i] + j;
                }
            } else {
                par[v][i] = u;
                for (int j = 0; j < count[v][i - 1]; ++j) {
                    int *p = cit[v][i - 1] + j;
                }
                for (int j = 0; j < count[par[v][i]][i - 1]; ++j) {
                    int *p = cit[par[v][i]][i - 1] + j;
                }
                count[v][i] = merge1(cit[v][i - 1], cit[v][i - 1] + count[v][i - 1], cit[par[v][i]][i - 1],
                                     cit[par[v][i]][i - 1] + count[par[v][i]][i - 1], cit[v][i]);
                for (int j = 0; j < count[v][i]; ++j) {
                    int *p = cit[v][i] + j;
                }
            }
        }
        dfs(g, v, vis, par, cit, count, n, people, h, ch + 1);
    }
}

int main() {
    int n, m, q;
    cin >> n >> m >> q;
    vector<int> h(n, -1);
    int par[n][maxlog];
    int cit[n][maxlog][30];
    int count[n][maxlog];
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < maxlog; ++j) {
            count[i][j] = 0;
        }
    }
    for (int j = 0; j < n; ++j) {
        for (int i = 0; i < maxlog; ++i) {
            par[j][i] = -1;
        }
    }
    vector<int> v;
    vector<vector<int>> g(n, v);
    for (int i = 0; i < n - 1; ++i) {
        int u, v;
        cin >> u >> v;
        g[u - 1].push_back(v - 1);
        g[v - 1].push_back(u - 1);
    }
    vector<vector<int>> people(n, v);
    for (int l = 0; l < m; ++l) {
        int c;
        cin >> c;
        people[c - 1].push_back(l);
    }
    for (int l = 0; l < n; ++l) {
        sort(people[l].begin(), people[l].end());
    }
    for (int l = 0; l < n; ++l) {
        par[l][0] = l;
        count[l][0] = (int) people[l].size();
        for (int i = 0; i < people[l].size(); ++i) {
            cit[l][0][i] = people[l][i];
        }
    }

    vector<bool> vis(n);
    vector<vector<int>> st(n);
    dfs(g, 0, vis, par, cit, count, n, people, h, 0);

    for (int k = 0; k < q; ++k) {
        int l, r, a;
        cin >> l >> r >> a;
        l--;
        r--;
        int lans[30];
        int rans[30];
        int tmp[30];
        int lcount = 0, rcount = 0;
        if (h[l] != h[r]) {
            if (h[l] > h[r]) {
                swap(l, r);
            }
            for (int i = maxlog - 1; i >= 0; --i) {
                if (par[r][i] < 0) continue;
                if (h[par[r][i]] < h[l]) continue;
                rcount = merge1(cit[r][i], cit[r][i] + count[r][i], rans, rans + rcount, tmp);
                for (int j = 0; j < rcount; ++j) {
                    rans[j] = tmp[j];
                }
                r = par[r][i];
                if (h[r] == h[l]) break;
            }
        } else {
            for (int i = 0; i < count[r][0]; ++i) {
                rans[i] = cit[r][0][i];
            }
            rcount = count[r][0];
        }

        for (int i = maxlog - 1; i >= 0; --i) {
            if (par[r][i] < 0 || par[l][i] < 0) continue;
            if (par[r][i] == par[l][i] && i > 0) continue;
                                        if (par[r][i] != par[l][i]) i++;
            rcount = merge1(cit[l][i], cit[l][i] + count[l][i], rans, rans + rcount, tmp);
            for (int j = 0; j < rcount; ++j) {
                rans[j] = tmp[j];
            }
            rcount = merge1(cit[r][i], cit[r][i] + count[r][i], rans, rans + rcount, tmp);
            for (int j = 0; j < rcount; ++j) {
                rans[j] = tmp[j];
            }
            r = par[r][i];
            l = par[l][i];

        }
        int anscount = min(a, rcount);
        cout << anscount;
        for (int i = 0; i < anscount; ++i) {
            cout << " " << (rans[i] + 1);
        }
        cout << endl;
    }

    return 0;
}


/*
 Created by Saidolda Bayan.
 Copyright (c) 2015 Bayan. All rights reserved.
 ID: baian.s1 137176ZP
 PROG: test
 LANG: C++
 */
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <string>
#include <set>
#include <iterator>
#include <map>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <cstdio>
#include <ctime>
#include <vector>
#include <cassert>
#include <queue>
#include <deque>
#define _USE_MATH_DEFINES
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define ll long long
using namespace std;
const int INF = 1e9+7, mod = 1e9+9, pw = 31;
const double eps = 1e-11;
//const long long INF = 1e18;
int n,m,q;
vector<int> a[105000],d[105000][30];
vector<int> g[105000];
int in[105000],out[105000];
bool used[105000];
int up[105000][30],l=20;
vector<int> res;
vector<int> add(vector<int > s,vector<int> t){
    res.resize(0);
    int i=0,j=0;
    while(res.size()<=10&&res.size()<s.size()+t.size()){
        if(i>=s.size()&&j>=t.size())break;
        if(i<s.size()&&j<t.size()&&s[i]==t[j]){
            res.pb(s[i++]);
            j++;
        }
        else if(i<s.size()&&(j>=t.size()||s[i]<t[j]))res.pb(s[i++]);
        else res.pb(t[j++]);
    }
    return res;
}
void dfs(int v=1,int p=1){
    static int kol=0;
    in[v]=++kol;
    used[v]=1;
    up[v][0]=p;
    d[v][0]=add(a[v],a[p]);
    for (int i=1; i<=l; ++i){
        up[v][i] = up[up[v][i-1]][i-1];
        d[v][i]=add(d[v][i-1],d[up[v][i-1]][i-1]);
    }
    for(int i=0;i<g[v].size();i++)if(!used[g[v][i]])dfs(g[v][i],v);
    out[v]=++kol;
}
bool ok(int u,int v){
    if(in[u]<=in[v]&&out[u]>=out[v])return 1;
    return 0;
}
int lca (int a, int b) {
    if (ok (a, b))  return a;
    if (ok (b, a))  return b;
    for (int i=l; i>=0; --i)
        if (!ok(up[a][i], b))
            a = up[a][i];
    return up[a][0];
}
vector<int> find(int a,int b){
    res.resize(0);
    for (int i=l; i>=0; --i)
        if (ok(b,up[a][i])){
            res=add(res,d[a][i]);
            a = up[a][i];
        }
    return res;
}
vector<int > get(int u,int v){
    res.resize(0);
    int to=lca(u,v);
    res=add(find(u,to),find(v,to));
    return res;
}
int main ()
{
    //ios_base::sync_with_stdio(0);cin.tie(NULL);
    //freopen(".in","r",stdin);
    //freopen(".out","w",stdout);
    scanf("%d%d%d",&n,&m,&q);
    for(int i=1;i<n;i++){
        int u,v;
        scanf("%d%d",&u,&v);
        g[u].pb(v);
        g[v].pb(u);
    }
    for(int i=1;i<=m;i++){
        int x;
        scanf("%d",&x);
        a[x].pb(i);
    }
    for(int i=1;i<=n;i++){
        sort(a[i].begin(),a[i].end());
        a[i].resize(min((int)a[i].size(),10));
    }
    dfs();
    vector<int> s;
    for(int i=1;i<=q;i++){
        int u,v,x;
        scanf("%d%d%d",&u,&v,&x);
        s=get(u,v);
        printf("%d ",min((int)s.size(),x));
        for(int i=0;i<x&&i<s.size();i++)printf("%d ",s[i]);
        printf("\n");
    }
    return 0;
}


/*
 Created by Saidolda Bayan.
 Copyright (c) 2015 Bayan. All rights reserved.
 ID: baian.s1 137176ZP
 PROG: test
 LANG: C++
 */
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <string>
#include <set>
#include <iterator>
#include <map>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <cstdio>
#include <ctime>
#include <vector>
#include <cassert>
#include <queue>
#include <deque>
#define _USE_MATH_DEFINES
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define ll long long
using namespace std;
const int INF = 1e9+7, mod = 1e9+9, pw = 31;
const double eps = 1e-11;
//const long long INF = 1e18;
int n,m,q;
vector<int> a[105000],d[105000][20];
vector<int> g[105000];
int in[105000],out[105000];
bool used[105000];
int up[105000][20],l=18;
vector<int> res;
vector<int> add(vector<int > s,vector<int> t){
    res.resize(0);
    int i=0,j=0;
    while(res.size()<=10){
        if(i>=s.size()&&j>=t.size())break;
        if(i<s.size()&&j<t.size()&&s[i]==t[j]){
            res.pb(s[i++]);
            while(j<t.size()&&t[j]==s[i-1])j++;
            while(i<s.size()&&s[i]==s[i-1])i++;
        }
        else if(i<s.size()&&(j>=t.size()||s[i]<t[j]))res.pb(s[i++]);
        else res.pb(t[j++]);
    }
    return res;
}
void dfs(int v=1,int p=1){
    static int kol=0;
    in[v]=++kol;
    used[v]=1;
    up[v][0]=p;
    d[v][0]=add(a[v],a[p]);
    for (int i=1; i<=l; ++i){
        up[v][i] = up[up[v][i-1]][i-1];
        d[v][i]=add(d[v][i-1],d[up[v][i-1]][i-1]);
    }
    for(int i=0;i<g[v].size();i++)if(!used[g[v][i]])dfs(g[v][i],v);
    out[v]=++kol;
}
bool ok(int u,int v){
    if(in[u]<=in[v]&&out[u]>=out[v])return 1;
    return 0;
}
int lca (int a, int b) {
    if (ok (a, b))  return a;
    if (ok (b, a))  return b;
    for (int i=l; i>=0; --i)
        if (!ok(up[a][i], b))
            a = up[a][i];
    return up[a][0];
}
vector<int> find(int a,int b){
    res.resize(0);
    for (int i=l; i>=0; --i)
        if (ok(b,up[a][i])){
            res=add(res,d[a][i]);
            a = up[a][i];
        }
    return res;
}
vector<int > get(int u,int v){
    res.resize(0);
    int to=lca(u,v);
    res=add(find(u,to),find(v,to));
    res=add(res,a[u]);
    res=add(res,a[v]);
    res=add(res,a[to]);
    return res;
}
int main ()
{
    //ios_base::sync_with_stdio(0);cin.tie(NULL);
    //freopen(".in","r",stdin);
    //freopen(".out","w",stdout);
    scanf("%d%d%d",&n,&m,&q);
    for(int i=1;i<n;i++){
        int u,v;
        scanf("%d%d",&u,&v);
        g[u].pb(v);
        g[v].pb(u);
    }
    for(int i=1;i<=m;i++){
        int x;
        scanf("%d",&x);
        a[x].pb(i);
    }
    for(int i=1;i<=n;i++){
        sort(a[i].begin(),a[i].end());
        a[i].resize(min((int)a[i].size(),10));
    }
    dfs();
    vector<int> s;
    for(int i=1;i<=q;i++){
        int u,v,x;
        scanf("%d%d%d",&u,&v,&x);
        s=get(u,v);
        printf("%d ",min((int)s.size(),x));
        for(int i=0;i<x&&i<s.size();i++)printf("%d ",s[i]);
        printf("\n");
    }
    return 0;
}


/*
 Created by Saidolda Bayan.
 Copyright (c) 2015 Bayan. All rights reserved.
 ID: baian.s1 137176ZP
 PROG: test
 LANG: C++
 */
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <string>
#include <set>
#include <iterator>
#include <map>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <cstdio>
#include <ctime>
#include <vector>
#include <cassert>
#include <queue>
#include <deque>
#define _USE_MATH_DEFINES
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define ll long long
using namespace std;
const int INF = 1e9+7, mod = 1e9+9, pw = 31;
const double eps = 1e-11;
//const long long INF = 1e18;
int n,m,q;
set<int> a[105000],d[105000][30];
vector<int> g[105000];
int in[105000],out[105000];
bool used[105000];
int up[105000][30],l=20;
set<int> res;
set<int> add(set<int > s,set<int> t){
    while(t.size()){
        s.insert(*t.begin());
        if(s.size()>10){
            s.erase(*s.rbegin());
        }
        t.erase(*t.begin());
    }
    return s;
}
void dfs(int v=1,int p=1){
    static int kol=0;
    in[v]=++kol;
    used[v]=1;
    up[v][0]=p;
    d[v][0]=add(a[v],a[p]);
    for (int i=1; i<=l; ++i){
        up[v][i] = up[up[v][i-1]][i-1];
        d[v][i]=add(d[v][i-1],d[up[v][i-1]][i-1]);
    }
    for(int i=0;i<g[v].size();i++)if(!used[g[v][i]])dfs(g[v][i],v);
    out[v]=++kol;
}
bool ok(int u,int v){
    if(in[u]<=in[v]&&out[u]>=out[v])return 1;
    return 0;
}
int lca (int a, int b) {
    if (ok (a, b))  return a;
    if (ok (b, a))  return b;
    for (int i=l; i>=0; --i)
        if (!ok(up[a][i], b))
            a = up[a][i];
    return up[a][0];
}
set<int> find(int a,int b){
    res.clear();
    for (int i=l; i>=0; --i)
        if (ok(b,up[a][i])){
            res=add(res,d[a][i]);
            a = up[a][i];
        }
    return res;
}
set<int > get(int u,int v,int x){
    res.clear();
    int to=lca(u,v);
    res=add(find(u,to),find(v,to));
    res=add(res,a[u]);
    res=add(res,a[v]);
    res=add(res,a[to]);
    return res;
}
int main ()
{
    //ios_base::sync_with_stdio(0);cin.tie(NULL);
    //freopen(".in","r",stdin);
    //freopen(".out","w",stdout);
    scanf("%d%d%d",&n,&m,&q);
    for(int i=1;i<n;i++){
        int u,v;
        scanf("%d%d",&u,&v);
        g[u].pb(v);
        g[v].pb(u);
    }
    for(int i=1;i<=m;i++){
        int x;
        scanf("%d",&x);
        a[x].insert(i);
        if(a[x].size()>10){
            a[x].erase(*a[x].rbegin());
        }
    }
    dfs();
    for(int i=1;i<=q;i++){
        int u,v,x;
        scanf("%d%d%d",&u,&v,&x);
        set<int> s=get(u,v,x);
        printf("%d ",min((int)s.size(),x));
        int kol=0;
        for(auto i:s){printf("%d ",i);if(++kol==x)break;}
        printf("\n");
    }
    return 0;
}


/*
 Created by Saidolda Bayan.
 Copyright (c) 2015 Bayan. All rights reserved.
 ID: baian.s1 137176ZP
 PROG: test
 LANG: C++
 */
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <string>
#include <set>
#include <iterator>
#include <map>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <cstdio>
#include <ctime>
#include <vector>
#include <cassert>
#include <queue>
#include <deque>
#define _USE_MATH_DEFINES
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define ll long long
using namespace std;
const int INF = 1e9+7, mod = 1e9+9, pw = 31;
const double eps = 1e-11;
//const long long INF = 1e18;
int n,m,q;
set<int> a[105000],d[105000][30];
vector<int> g[105000];
int in[105000],out[105000];
bool used[105000];
int up[105000][30],l=20;
set<int> add(set<int > s,set<int> t){
    while(t.size()){
        s.insert(*t.begin());
        if(s.size()>10){
            s.erase(*s.rbegin());
        }
        t.erase(*t.begin());
    }
    return s;
}
void dfs(int v=1,int p=1){
    static int kol=0;
    in[v]=++kol;
    used[v]=1;
    up[v][0]=p;
    d[v][0]=add(a[v],a[p]);
    for (int i=1; i<=l; ++i){
        up[v][i] = up[up[v][i-1]][i-1];
        d[v][i]=add(d[v][i-1],d[up[v][i-1]][i-1]);
    }
    for(int i=0;i<g[v].size();i++)if(!used[g[v][i]])dfs(g[v][i],v);
    out[v]=++kol;
}
bool ok(int u,int v){
    if(in[u]<=in[v]&&out[u]>=out[v])return 1;
    return 0;
}
int lca (int a, int b) {
    if (ok (a, b))  return a;
    if (ok (b, a))  return b;
    for (int i=l; i>=0; --i)
        if (!ok(up[a][i], b))
            a = up[a][i];
    return up[a][0];
}
set<int> find(int a,int b){
    set<int> res;
    for (int i=l; i>=0; --i)
        if (ok(b,up[a][i])){
            res=add(res,d[a][i]);
            a = up[a][i];
        }
    return res;
}
set<int > get(int u,int v,int x){
    set<int> res;
    int to=lca(u,v);
    res=add(find(u,to),find(v,to));
    res=add(res,a[u]);
    res=add(res,a[v]);
    res=add(res,a[to]);
    return res;
}
int main ()
{
    ios_base::sync_with_stdio(0);cin.tie(NULL);
    //freopen(".in","r",stdin);
    //freopen(".out","w",stdout);
    cin>>n>>m>>q;
    for(int i=1;i<n;i++){
        int u,v;
        cin>>u>>v;
        g[u].pb(v);
        g[v].pb(u);
    }
    for(int i=1;i<=m;i++){
        int x;
        cin>>x;
        a[x].insert(i);
        if(a[x].size()>10){
            a[x].erase(*a[x].rbegin());
        }
    }
    dfs();
    for(int i=1;i<=q;i++){
        int u,v,x;
        cin>>u>>v>>x;
        set<int> s=get(u,v,x);
        cout<<min((int)s.size(),x)<<" ";
        int kol=0;
        for(auto i:s){cout<<i<<" ";if(++kol==x)break;}
        cout<<endl;
    }
    return 0;
}


/*
 Created by Saidolda Bayan.
 Copyright (c) 2015 Bayan. All rights reserved.
 ID: baian.s1 137176ZP
 PROG: test
 LANG: C++
 */
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <string>
#include <set>
#include <iterator>
#include <map>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <cstdio>
#include <ctime>
#include <vector>
#include <cassert>
#include <queue>
#include <deque>
#define _USE_MATH_DEFINES
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define ll long long
using namespace std;
const int INF = 1e9+7, mod = 1e9+9, pw = 31;
const double eps = 1e-11;
//const long long INF = 1e18;
int n,m,q;
vector<int> a[105000],d[105000][21];
vector<int> g[105000];
int in[105000],out[105000];
bool used[105000];
int up[105000][21],l=19;
vector<int> res;
vector<int> add(vector<int > s,vector<int> t){
    res.resize(0);
    int i=0,j=0;
    while(res.size()<=10){
        if(i>=s.size()&&j>=t.size())break;
        if(i<s.size()&&j<t.size()&&s[i]==t[j]){
            res.pb(s[i++]);
            j++;
        }
        else if(i<s.size()&&(j>=t.size()||s[i]<t[j]))res.pb(s[i++]);
        else res.pb(t[j++]);
    }
    return res;
}
void dfs(int v=1,int p=1){
    static int kol=0;
    in[v]=++kol;
    used[v]=1;
    up[v][0]=p;
    d[v][0]=add(a[v],a[p]);
    for (int i=1; i<=l; ++i){
        up[v][i] = up[up[v][i-1]][i-1];
        d[v][i]=add(d[v][i-1],d[up[v][i-1]][i-1]);
    }
    for(int i=0;i<g[v].size();i++)if(!used[g[v][i]])dfs(g[v][i],v);
    out[v]=++kol;
}
bool ok(int u,int v){
    if(in[u]<=in[v]&&out[u]>=out[v])return 1;
    return 0;
}
int lca (int a, int b) {
    if (ok (a, b))  return a;
    if (ok (b, a))  return b;
    for (int i=l; i>=0; --i)
        if (!ok(up[a][i], b))
            a = up[a][i];
    return up[a][0];
}
vector<int> find(int a,int b){
    res.resize(0);
    for (int i=l; i>=0; --i)
        if (ok(b,up[a][i])){
            res=add(res,d[a][i]);
            a = up[a][i];
        }
    return res;
}
vector<int > get(int u,int v){
    res.resize(0);
    int to=lca(u,v);
    res=add(find(u,to),find(v,to));
    return res;
}
int main ()
{
    //ios_base::sync_with_stdio(0);cin.tie(NULL);
    //freopen(".in","r",stdin);
    //freopen(".out","w",stdout);
    scanf("%d%d%d",&n,&m,&q);
    for(int i=1;i<n;i++){
        int u,v;
        scanf("%d%d",&u,&v);
        g[u].pb(v);
        g[v].pb(u);
    }
    for(int i=1;i<=m;i++){
        int x;
        scanf("%d",&x);
        a[x].pb(i);
    }
    for(int i=1;i<=n;i++){
        sort(a[i].begin(),a[i].end());
        a[i].resize(min((int)a[i].size(),10));
    }
    dfs();
    vector<int> s;
    for(int i=1;i<=q;i++){
        int u,v,x;
        scanf("%d%d%d",&u,&v,&x);
        s=get(u,v);
        printf("%d ",min((int)s.size(),x));
        for(int i=0;i<x&&i<s.size();i++)printf("%d ",s[i]);
        printf("\n");
    }
    return 0;
}


/*
 Created by Saidolda Bayan.
 Copyright (c) 2015 Bayan. All rights reserved.
 ID: baian.s1 137176ZP
 PROG: test
 LANG: C++
 */
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <string>
#include <set>
#include <iterator>
#include <map>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <cstdio>
#include <ctime>
#include <vector>
#include <cassert>
#include <queue>
#include <deque>
#define _USE_MATH_DEFINES
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define ll long long
using namespace std;
const int INF = 1e9+7, mod = 1e9+9, pw = 31;
const double eps = 1e-11;
//const long long INF = 1e18;
int n,m,q;
set<int> a[105000],d[105000][30];
vector<int> g[105000];
int in[105000],out[105000];
bool used[105000];
int up[105000][30],l=20;
set<int> add(set<int > s,set<int> t){
    while(t.size()){
        s.insert(*t.begin());
        if(s.size()>10){
            s.erase(*s.rbegin());
        }
        t.erase(*t.begin());
    }
    return s;
}
void dfs(int v=1,int p=1){
    static int kol=0;
    in[v]=++kol;
    used[v]=1;
    up[v][0]=p;
    d[v][0]=add(a[v],a[p]);
    for (int i=1; i<=l; ++i){
        up[v][i] = up[up[v][i-1]][i-1];
        d[v][i]=add(d[v][i-1],d[up[v][i-1]][i-1]);
    }
    for(int i=0;i<g[v].size();i++)if(!used[g[v][i]])dfs(g[v][i],v);
    out[v]=++kol;
}
bool ok(int u,int v){
    if(in[u]<=in[v]&&out[u]>=out[v])return 1;
    return 0;
}
int lca (int a, int b) {
    if (ok (a, b))  return a;
    if (ok (b, a))  return b;
    for (int i=l; i>=0; --i)
        if (!ok(up[a][i], b))
            a = up[a][i];
    return up[a][0];
}
set<int> find(int a,int b){
    set<int> res;
    for (int i=l; i>=0; --i)
        if (ok(b,up[a][i])){
            res=add(res,d[a][i]);
            a = up[a][i];
        }
    return res;
}
set<int > get(int u,int v,int x){
    set<int> res;
    int to=lca(u,v);
    res=add(find(u,to),find(v,to));
    res=add(res,a[u]);
    res=add(res,a[v]);
    res=add(res,a[to]);
    return res;
}
int main ()
{
    //ios_base::sync_with_stdio(0);cin.tie(NULL);
    //freopen(".in","r",stdin);
    //freopen(".out","w",stdout);
    scanf("%d%d%d",&n,&m,&q);
    for(int i=1;i<n;i++){
        int u,v;
        scanf("%d%d",&u,&v);
        g[u].pb(v);
        g[v].pb(u);
    }
    for(int i=1;i<=m;i++){
        int x;
        scanf("%d",&x);
        a[x].insert(i);
        if(a[x].size()>10){
            a[x].erase(*a[x].rbegin());
        }
    }
    dfs();
    for(int i=1;i<=q;i++){
        int u,v,x;
        scanf("%d%d%d",&u,&v,&x);
        set<int> s=get(u,v,x);
        printf("%d ",min((int)s.size(),x));
        int kol=0;
        for(auto i:s){printf("%d ",i);if(++kol==x)break;}
        printf("\n");
    }
    return 0;
}


/*
 Created by Saidolda Bayan.
 Copyright (c) 2015 Bayan. All rights reserved.
 ID: baian.s1 137176ZP
 PROG: test
 LANG: C++
 */
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <string>
#include <set>
#include <iterator>
#include <map>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <cstdio>
#include <ctime>
#include <vector>
#include <cassert>
#include <queue>
#include <deque>
#define _USE_MATH_DEFINES
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define ll long long
using namespace std;
const int INF = 1e9+7, mod = 1e9+9, pw = 31;
const double eps = 1e-11;
//const long long INF = 1e18;
int n,m,q;
set<int> a[105000],d[105000][30];
vector<int> g[105000];
int in[105000],out[105000];
bool used[105000];
int up[105000][30],l=20;
set<int> add(set<int > s,set<int> t){
    while(t.size()){
        s.insert(*t.begin());
        if(s.size()>10){
            s.erase(*s.rbegin());
        }
        t.erase(*t.begin());
    }
    return s;
}
void dfs(int v=1,int p=0){
    static int kol=0;
    kol++;
    in[v]=kol;
    used[v]=1;
    up[v][0]=p;
    d[v][0]=add(a[v],a[up[v][0]]);
    for (int i=1; i<=l; ++i){
        up[v][i] = up[up[v][i-1]][i-1];
        d[v][i]=add(d[v][i-1],d[up[v][i-1]][i-1]);
    }
    for(int i=0;i<g[v].size();i++)if(!used[g[v][i]])dfs(g[v][i],v);
    kol++;
    out[v]=kol;
}
bool ok(int u,int v){
    //if(!u||!v)return 0;
    if(in[u]<=in[v]&&out[u]>=out[v])return 1;
    return 0;
}
int lca (int a, int b) {
    if (ok (a, b))  return a;
    if (ok (b, a))  return b;
    for (int i=l; i>=0; --i)
        if (!ok(up[a][i], b))
            a = up[a][i];
    return up[a][0];
}
set<int> find(int a,int b){
    set<int> res;
    for (int i=l; i>=0; --i)
        if (ok(b,up[a][i])){
            res=add(res,d[a][i]);
            a = up[a][i];
            //res=add(res,d[a][i]);
        }
    return res;
}
set<int > get(int u,int v,int x){
    set<int> res;
    int to=lca(u,v);
    res=add(find(u,to),find(v,to));
    res=add(res,a[u]);
    res=add(res,a[v]);
    res=add(res,a[lca(u,v)]);
    return res;
}
int main ()
{
    ios_base::sync_with_stdio(0);cin.tie(NULL);
    //freopen(".in","r",stdin);
    //freopen(".out","w",stdout);
    cin>>n>>m>>q;
    for(int i=1;i<n;i++){
        int u,v;
        cin>>u>>v;
        g[u].pb(v);
        g[v].pb(u);
    }
    for(int i=1;i<=m;i++){
        int x;
        cin>>x;
        a[x].insert(i);
        if(a[x].size()>10){
            a[x].erase(*a[x].rbegin());
        }
    }
    dfs();
    for(int i=1;i<=q;i++){
        int u,v,x;
        cin>>u>>v>>x;
        set<int> s=get(u,v,x);
        cout<<min((int)s.size(),x)<<" ";
        int kol=0;
        for(auto i:s){cout<<i<<" ";if(++kol==x)break;}
        cout<<endl;
    }
    return 0;
}


/*
 Created by Saidolda Bayan.
 Copyright (c) 2015 Bayan. All rights reserved.
 ID: baian.s1 137176ZP
 PROG: test
 LANG: C++
 */
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <string>
#include <set>
#include <iterator>
#include <map>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <cstdio>
#include <ctime>
#include <vector>
#include <cassert>
#include <queue>
#include <deque>
#define _USE_MATH_DEFINES
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define ll long long
using namespace std;
const int INF = 1e9+7, mod = 1e9+9, pw = 31;
const double eps = 1e-11;
//const long long INF = 1e18;
int n,m,q;
vector<int> a[105000],d[105000][30];
vector<int> g[105000];
int in[105000],out[105000];
bool used[105000];
int up[105000][30],l=20;
vector<int> res;
vector<int> add(vector<int > s,vector<int> t){
    res.resize(0);
    while(t.size()){
        s.pb(t[t.size()-1]);
        t.pop_back();
    }
    sort(s.begin(),s.end());
    for(int i=0;i<s.size();i++){
        if(!i||s[i]!=s[i-1])res.pb(s[i]);
    }
    res.resize(min(10,(int)res.size()));
    return res;
}
void dfs(int v=1,int p=1){
    static int kol=0;
    in[v]=++kol;
    used[v]=1;
    up[v][0]=p;
    d[v][0]=add(a[v],a[p]);
    for (int i=1; i<=l; ++i){
        up[v][i] = up[up[v][i-1]][i-1];
        d[v][i]=add(d[v][i-1],d[up[v][i-1]][i-1]);
    }
    for(int i=0;i<g[v].size();i++)if(!used[g[v][i]])dfs(g[v][i],v);
    out[v]=++kol;
}
bool ok(int u,int v){
    if(in[u]<=in[v]&&out[u]>=out[v])return 1;
    return 0;
}
int lca (int a, int b) {
    if (ok (a, b))  return a;
    if (ok (b, a))  return b;
    for (int i=l; i>=0; --i)
        if (!ok(up[a][i], b))
            a = up[a][i];
    return up[a][0];
}
vector<int> find(int a,int b){
    res.resize(0);
    for (int i=l; i>=0; --i)
        if (ok(b,up[a][i])){
            res=add(res,d[a][i]);
            a = up[a][i];
        }
    return res;
}
vector<int > get(int u,int v,int x){
    res.resize(0);
    int to=lca(u,v);
    res=add(find(u,to),find(v,to));
    res=add(res,a[u]);
    res=add(res,a[v]);
    res=add(res,a[to]);
    return res;
}
int main ()
{
    //ios_base::sync_with_stdio(0);cin.tie(NULL);
    //freopen(".in","r",stdin);
    //freopen(".out","w",stdout);
    scanf("%d%d%d",&n,&m,&q);
    for(int i=1;i<n;i++){
        int u,v;
        scanf("%d%d",&u,&v);
        g[u].pb(v);
        g[v].pb(u);
    }
    for(int i=1;i<=m;i++){
        int x;
        scanf("%d",&x);
        a[x].pb(i);
    }
    dfs();
    for(int i=1;i<=q;i++){
        int u,v,x;
        scanf("%d%d%d",&u,&v,&x);
        vector<int> s=get(u,v,x);
        printf("%d ",min((int)s.size(),x));
        int kol=0;
        for(auto i:s){printf("%d ",i);if(++kol==x)break;}
        printf("\n");
    }
    return 0;
}


/*
 Created by Saidolda Bayan.
 Copyright (c) 2015 Bayan. All rights reserved.
 ID: baian.s1 137176ZP
 PROG: test
 LANG: C++
 */
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <string>
#include <set>
#include <iterator>
#include <map>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <cstdio>
#include <ctime>
#include <vector>
#include <cassert>
#include <queue>
#include <deque>
#define _USE_MATH_DEFINES
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define ll long long
using namespace std;
const int INF = 1e9+7, mod = 1e9+9, pw = 31;
const double eps = 1e-11;
//const long long INF = 1e18;
int n,m,q;
vector<int> a[105000],d[105000][21];
vector<int> g[105000];
int in[105000],out[105000];
bool used[105000];
int up[105000][21],l=19;
vector<int> res;
vector<int> add(vector<int > s,vector<int> t){
    res.resize(0);
    int i=0,j=0;
    while(res.size()<=10){
        if(i>=s.size()&&j>=t.size())break;
        if(i<s.size()&&j<t.size()&&s[i]==t[j]){
            res.pb(s[i++]);
            while(j<t.size()&&t[j]==s[i-1])j++;
            while(i<s.size()&&s[i]==s[i-1])i++;
        }
        else if(i<s.size()&&(j>=t.size()||s[i]<t[j]))res.pb(s[i++]);
        else res.pb(t[j++]);
    }
    return res;
}
void dfs(int v=1,int p=1){
    static int kol=0;
    in[v]=++kol;
    used[v]=1;
    up[v][0]=p;
    d[v][0]=add(a[v],a[p]);
    for (int i=1; i<=l; ++i){
        up[v][i] = up[up[v][i-1]][i-1];
        d[v][i]=add(d[v][i-1],d[up[v][i-1]][i-1]);
    }
    for(int i=0;i<g[v].size();i++)if(!used[g[v][i]])dfs(g[v][i],v);
    out[v]=++kol;
}
bool ok(int u,int v){
    if(in[u]<=in[v]&&out[u]>=out[v])return 1;
    return 0;
}
int lca (int a, int b) {
    if (ok (a, b))  return a;
    if (ok (b, a))  return b;
    for (int i=l; i>=0; --i)
        if (!ok(up[a][i], b))
            a = up[a][i];
    return up[a][0];
}
vector<int> find(int a,int b){
    res.resize(0);
    for (int i=l; i>=0; --i)
        if (ok(b,up[a][i])){
            res=add(res,d[a][i]);
            a = up[a][i];
        }
    return res;
}
vector<int > get(int u,int v){
    res.resize(0);
    int to=lca(u,v);
    res=add(find(u,to),find(v,to));
    return res;
}
int main ()
{
    //ios_base::sync_with_stdio(0);cin.tie(NULL);
    //freopen(".in","r",stdin);
    //freopen(".out","w",stdout);
    scanf("%d%d%d",&n,&m,&q);
    for(int i=1;i<n;i++){
        int u,v;
        scanf("%d%d",&u,&v);
        g[u].pb(v);
        g[v].pb(u);
    }
    for(int i=1;i<=m;i++){
        int x;
        scanf("%d",&x);
        a[x].pb(i);
    }
    for(int i=1;i<=n;i++){
        sort(a[i].begin(),a[i].end());
        a[i].resize(min((int)a[i].size(),10));
    }
    dfs();
    vector<int> s;
    for(int i=1;i<=q;i++){
        int u,v,x;
        scanf("%d%d%d",&u,&v,&x);
        s=get(u,v);
        printf("%d ",min((int)s.size(),x));
        for(int i=0;i<x&&i<s.size();i++)printf("%d ",s[i]);
        printf("\n");
    }
    return 0;
}


/*
 Created by Saidolda Bayan.
 Copyright (c) 2015 Bayan. All rights reserved.
 ID: baian.s1 137176ZP
 PROG: test
 LANG: C++
 */
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <string>
#include <set>
#include <iterator>
#include <map>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <cstdio>
#include <ctime>
#include <vector>
#include <cassert>
#include <queue>
#include <deque>
#define _USE_MATH_DEFINES
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define ll long long
using namespace std;
const int INF = 1e9+7, mod = 1e9+9, pw = 31;
const double eps = 1e-11;
//const long long INF = 1e18;
int n,m,q;
vector<int> a[105000],d[105000][18];
vector<int> g[105000];
int in[105000],out[105000];
bool used[105000];
int up[105000][20],l=18;
vector<int> res;
vector<int> add(vector<int > s,vector<int> t){
    res.resize(0);
    int i=0,j=0;
    while(res.size()<=10&&res.size()<=s.size()+t.size()){
        if(i>=s.size()&&j>=t.size())break;
        if(i<s.size()&&j<t.size()&&s[i]==t[j]){
            res.pb(s[i++]);
            j++;
        }
        else if(i<s.size()&&(j>=t.size()||s[i]<t[j]))res.pb(s[i++]);
        else res.pb(t[j++]);
    }
    return res;
}
void dfs(int v=1,int p=1){
    static int kol=0;
    in[v]=++kol;
    used[v]=1;
    up[v][0]=p;
    d[v][0]=add(a[v],a[p]);
    for (int i=1; i<=l; ++i){
        up[v][i] = up[up[v][i-1]][i-1];
        d[v][i]=add(d[v][i-1],d[up[v][i-1]][i-1]);
    }
    for(int i=0;i<g[v].size();i++)if(!used[g[v][i]])dfs(g[v][i],v);
    out[v]=++kol;
}
bool ok(int u,int v){
    if(in[u]<=in[v]&&out[u]>=out[v])return 1;
    return 0;
}
int lca (int a, int b) {
    if (ok (a, b))  return a;
    if (ok (b, a))  return b;
    for (int i=l; i>=0; --i)
        if (!ok(up[a][i], b))
            a = up[a][i];
    return up[a][0];
}
vector<int> find(int a,int b){
    res.resize(0);
    for (int i=l; i>=0; --i)
        if (ok(b,up[a][i])){
            res=add(res,d[a][i]);
            a = up[a][i];
        }
    return res;
}
vector<int > get(int u,int v){
    res.resize(0);
    int to=lca(u,v);
    res=add(find(u,to),find(v,to));
    return res;
}
int main ()
{
    //ios_base::sync_with_stdio(0);cin.tie(NULL);
    //freopen(".in","r",stdin);
    //freopen(".out","w",stdout);
    scanf("%d%d%d",&n,&m,&q);
    for(int i=1;i<n;i++){
        int u,v;
        scanf("%d%d",&u,&v);
        g[u].pb(v);
        g[v].pb(u);
    }
    for(int i=1;i<=m;i++){
        int x;
        scanf("%d",&x);
        a[x].pb(i);
    }
    for(int i=1;i<=n;i++){
        sort(a[i].begin(),a[i].end());
        a[i].resize(min((int)a[i].size(),10));
    }
    dfs();
    vector<int> s;
    for(int i=1;i<=q;i++){
        int u,v,x;
        scanf("%d%d%d",&u,&v,&x);
        s=get(u,v);
        printf("%d ",min((int)s.size(),x));
        for(int i=0;i<x&&i<s.size();i++)printf("%d ",s[i]);
        printf("\n");
    }
    return 0;
}


#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;

int anc[100004][40], L[100004];
int path[100004][40][12], *buf = new int[12];
vector<int> adj[100004];
int n, m, q, u, v, a;

void merge(int *a, int *b)
{
  int k = 0, i = 0, j = 0;
  for (; a[i] != -1 && b[j] != -1 && k < 10;)
  {
    if (a[i] == b[j])
      buf[k++] = a[i],
      i++, j++;
    else if (a[i] < b[j])
      buf[k++] = a[i++];
    else
      buf[k++] = b[j++];
  }
  while (k < 10 && a[i] != -1) buf[k++] = a[i++];
  while (k < 10 && b[j] != -1) buf[k++] = b[j++];
  for (int i = 0; i < k; ++i) a[i] = buf[i];
  a[k] = -1;
}

void dfs(int cur, int par)
{
  anc[cur][0] = cur;
  anc[cur][1] = par;
  L[cur] = L[par] + 1;
  for (int ch : adj[cur])
    if (ch != par) dfs(ch, cur);
}

int main() {
  scanf("%d%d%d", &n, &m, &q);
  memset(path, -1, sizeof path);

  for (int i = 1; i < n; ++i)
    scanf("%d%d", &u, &v),
    adj[u].push_back(v),
    adj[v].push_back(u);

  for (int i = 1; i <= m; ++i) {
    scanf("%d", &u);
    int sz = 0;
    while (path[u][0][sz] != -1) sz++;
    if (sz < 10) path[u][0][sz] = i;
  }

  dfs(1, 0);

  for (int i = 1; i <= n; ++i)
    merge(path[i][1], path[i][0]),
    merge(path[i][1], path[anc[i][1]][0]);

  //prelca
  for (int lv = 2; lv < 40; ++lv)
  {
    for (int i = 1; i <= n; ++i)
    {
      int prv = anc[i][lv - 1];
      anc[i][lv] = anc[prv][lv - 1];
      merge(path[i][lv], path[i][lv - 1]);
      merge(path[i][lv], path[prv][lv - 1]);
    }
  }

  int x[12], y[12];
  while (q--)
  {
    scanf("%d%d%d", &u, &v, &a),
    x[0] = y[0] = -1;

    // lca + list merge
    if (L[u] > L[v]) swap(u,v);
    for (int i = 1, d = L[v] - L[u]; d; ++i)
      if (d & (1<<(i-1))) {
        d ^= (1<<(i-1)),
        merge(y, path[v][i]),
        v = anc[v][i];
      }

    for (int up = 20; up && u != v; up--)
    {
      if (anc[u][up] != anc[v][up])
        merge(x, path[u][up]),
        u = anc[u][up],
        merge(y, path[v][up]),
        v = anc[v][up];
    }
    if (u != v)
      merge(x, path[u][1]),
      u = anc[u][1],
      merge(y, path[v][1]),
      v = anc[v][1];

    merge(x, y);
    merge(x, path[u][0]);

    int sz = 0;
    while (x[sz] != -1) sz++;
    if (a > sz) a = sz;
    printf("%d", a);
    for (int i = 0; i < a; ++i) printf(" %d", x[i]);
    puts("");
  }
}


#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;

int anc[100004][40], L[100004];
vector<int> path[100004][40], adj[100004];
int n, m, q, u, v, a;

void merge(vector<int>& a, vector<int>& b)
{
  for (int x : b)
    a.push_back(x);
  sort(a.begin(), a.end());
  a.erase(unique(a.begin(), a.end()), a.end());
  while (a.size() > 10) a.pop_back();
}

void dfs(int cur, int par)
{
  anc[cur][0] = cur;
  anc[cur][1] = par;
  L[cur] = L[par] + 1;
  for (int ch : adj[cur])
    if (ch != par) dfs(ch, cur);
}

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cin >> n >> m >> q;

  for (int i = 1; i < n; ++i)
    cin >> u >> v,
    adj[u].push_back(v),
    adj[v].push_back(u);

  for (int i = 1; i <= m; ++i)
    cin >> u,
    path[u][0].push_back(i);

  dfs(1, 0);

  for (int i = 1; i <= n; ++i)
    sort(path[i][0].begin(), path[i][0].end());

  for (int i = 1; i <= n; ++i)
    merge(path[i][1], path[i][0]),
    merge(path[i][1], path[anc[i][1]][0]);

  //prelca
  for (int lv = 2; lv < 40; ++lv)
  {
    for (int i = 1; i <= n; ++i)
    {
      int prv = anc[i][lv - 1];
      anc[i][lv] = anc[prv][lv - 1];
      merge(path[i][lv], path[i][lv - 1]);
      merge(path[i][lv], path[prv][lv - 1]);
    }
  }

  // cout << path[5][2].size();
  // for (int ans : path[5][2]) cout << ' ' << ans;
  // cout << '\n';
  vector<int> x, y;
  while (q--)
  {
    cin >> u >> v >> a,
    x.clear(),
    y.clear();

    // lca + list merge
    if (L[u] > L[v]) swap(u,v);
    for (int i = 1, d = L[v] - L[u]; d; ++i)
      if (d & (1<<(i-1))) {
        d ^= (1<<(i-1)),
        merge(y, path[v][i]),
        v = anc[v][i];
      }

    for (int up = 20; up && u != v; up--)
    {
      if (up == 1 || anc[u][up] != anc[v][up])
        merge(x, path[u][up]),
        u = anc[u][up],
        merge(y, path[v][up]),
        v = anc[v][up];
    }
    // cout << anc[u][1] << anc[v][1] << endl;

    merge(x, y);
    if (a > x.size()) a = x.size();
    cout << a;
    for (int i = 0; i < a; ++i) cout << ' ' << x[i];
    cout << '\n';
  }
}


#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;

int anc[100004][40], L[100004];
vector<int> path[100004][40], adj[100004];
int n, m, q, u, v, a;

void merge(vector<int>& a, vector<int>& b)
{
  for (int x : b)
    a.push_back(x);
  sort(a.begin(), a.end());
  a.erase(unique(a.begin(), a.end()), a.end());
  while (a.size() > 10) a.pop_back();
}

void dfs(int cur, int par)
{
  anc[cur][0] = cur;
  anc[cur][1] = par;
  L[cur] = L[par] + 1;
  for (int ch : adj[cur])
    if (ch != par) dfs(ch, cur);
}

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cin >> n >> m >> q;

  for (int i = 1; i < n; ++i)
    cin >> u >> v,
    adj[u].push_back(v),
    adj[v].push_back(u);

  for (int i = 1; i <= m; ++i)
    cin >> u,
    path[u][0].push_back(i);

  dfs(1, 0);

  for (int i = 1; i <= n; ++i)
    sort(path[i][0].begin(), path[i][0].end());

  for (int i = 1; i <= n; ++i)
    merge(path[i][1], path[i][0]),
    merge(path[i][1], path[anc[i][1]][0]);

  //prelca
  for (int lv = 2; lv < 40; ++lv)
  {
    for (int i = 1; i <= n; ++i)
    {
      int prv = anc[i][lv - 1];
      anc[i][lv] = anc[prv][lv - 1];
      merge(path[i][lv], path[i][lv - 1]);
      merge(path[i][lv], path[prv][lv - 1]);
    }
  }

  vector<int> x, y;
  while (q--)
  {
    cin >> u >> v >> a,
    x.clear(),
    y.clear();

    // lca + list merge
    if (L[u] > L[v]) swap(u,v);
    for (int i = 1, d = L[v] - L[u]; d; ++i)
      if (d & (1<<(i-1))) {
        d ^= (1<<(i-1)),
        merge(y, path[v][i]),
        v = anc[v][i];
      }

    for (int up = 20; up && u != v; up--)
    {
      if (anc[u][up])
        merge(x, path[u][up]),
        u = anc[u][up],
        merge(y, path[v][up]),
        v = anc[v][up];
    }

    merge(x, y);
    merge(x, path[u][0]);
    if (a > x.size()) a = x.size();
    cout << a;
    for (int i = 0; i < a; ++i) cout << ' ' << x[i];
    cout << '\n';
  }
}


#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;

int anc[100004][40], L[100004];
vector<int> path[100004][40], adj[100004];
int n, m, q, u, v, a;

void merge(vector<int>& a, vector<int>& b)
{
  for (int x : b)
    a.push_back(x);
  sort(a.begin(), a.end());
  a.erase(unique(a.begin(), a.end()), a.end());
  while (a.size() > 10) a.pop_back();
}

void dfs(int cur, int par)
{
  anc[cur][0] = cur;
  anc[cur][1] = par;
  L[cur] = L[par] + 1;
  for (int ch : adj[cur])
    if (ch != par) dfs(ch, cur);
}

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cin >> n >> m >> q;

  for (int i = 1; i < n; ++i)
    cin >> u >> v,
    adj[u].push_back(v),
    adj[v].push_back(u);

  for (int i = 1; i <= m; ++i)
    cin >> u,
    path[u][0].push_back(i);

  dfs(1, 0);

  for (int i = 1; i <= n; ++i)
    sort(path[i][0].begin(), path[i][0].end());

  for (int i = 1; i <= n; ++i)
    merge(path[i][1], path[i][0]),
    merge(path[i][1], path[anc[i][1]][0]);

  //prelca
  for (int lv = 2; lv < 40; ++lv)
  {
    for (int i = 1; i <= n; ++i)
    {
      int prv = anc[i][lv - 1];
      anc[i][lv] = anc[prv][lv - 1];
      merge(path[i][lv], path[i][lv - 1]);
      merge(path[i][lv], path[prv][lv - 1]);
    }
  }

  // cout << path[5][2].size();
  // for (int ans : path[5][2]) cout << ' ' << ans;
  // cout << '\n';
  vector<int> x, y;
  while (q--)
  {
    cin >> u >> v >> a,
    x.clear(),
    y.clear();

    // lca + list merge
    if (L[u] > L[v]) swap(u,v);
    for (int i = 1, d = L[v] - L[u]; d; ++i)
      if (d & (1<<(i-1))) {
        d ^= (1<<(i-1)),
        merge(y, path[v][i]),
        v = anc[v][i];
      }

    for (int up = 20; up && u != v; up--)
    {
      if (up == 1 || anc[u][up] != anc[v][up])
        merge(x, path[u][up]),
        u = anc[u][up],
        merge(y, path[v][up]),
        v = anc[v][up];
    }
    // cout << u << v << endl;

    merge(x, y);
    merge(x, path[u][0]);
    if (a > x.size()) a = x.size();
    cout << a;
    for (int i = 0; i < a; ++i) cout << ' ' << x[i];
    cout << '\n';
  }
}


#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;

int anc[100004][40], L[100004];
vector<int> path[100004][40], adj[100004];
int n, m, q, u, v, a;

void merge(vector<int>& a, vector<int>& b)
{
  for (int x : b)
    a.push_back(x);
  sort(a.begin(), a.end());
  a.erase(unique(a.begin(), a.end()), a.end());
  while (a.size() > 10) a.pop_back();
}

void dfs(int cur, int par)
{
  anc[cur][0] = cur;
  anc[cur][1] = par;
  L[cur] = L[par] + 1;
  for (int ch : adj[cur])
    if (ch != par) dfs(ch, cur);
}

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cin >> n >> m >> q;

  for (int i = 1; i < n; ++i)
    cin >> u >> v,
    adj[u].push_back(v),
    adj[v].push_back(u);

  for (int i = 1; i <= m; ++i)
    cin >> u,
    path[u][0].push_back(i);

  dfs(1, 0);

  for (int i = 1; i <= n; ++i)
    sort(path[i][0].begin(), path[i][0].end());

  for (int i = 1; i <= n; ++i)
    merge(path[i][1], path[i][0]),
    merge(path[i][1], path[anc[i][1]][0]);

  //prelca
  for (int lv = 2; lv < 40; ++lv)
  {
    for (int i = 1; i <= n; ++i)
    {
      int prv = anc[i][lv - 1];
      anc[i][lv] = anc[prv][lv - 1];
      merge(path[i][lv], path[i][lv - 1]);
      merge(path[i][lv], path[prv][lv - 1]);
    }
  }

  vector<int> x, y;
  while (q--)
  {
    cin >> u >> v >> a,
    x.clear(),
    y.clear();

    // lca + list merge
    if (L[u] > L[v]) swap(u,v);
    for (int i = 1, d = L[v] - L[u]; d; ++i)
      if (d & (1<<(i-1))) {
        d ^= (1<<(i-1)),
        merge(y, path[v][i]),
        v = anc[v][i];
      }

    for (int up = 20; up && u != v; up--)
    {
      if (anc[u][up] != anc[v][up])
        merge(x, path[u][up]),
        u = anc[u][up],
        merge(y, path[v][up]),
        v = anc[v][up];
    }
    if (u != v)
      merge(x, path[u][1]),
      u = anc[u][1],
      merge(y, path[v][1]),
      v = anc[v][1];

    merge(x, y);
    merge(x, path[u][0]);
    if (a > x.size()) a = x.size();
    cout << a;
    for (int i = 0; i < a; ++i) cout << ' ' << x[i];
    cout << '\n';
  }
}


#include <iostream>
#include <vector>
using namespace std;
const int maxn = 1e5+10, maxlog = 18;
vector < int > v[maxn];
vector < int > a[maxn];
int depth[maxn];
vector < int > s[maxlog][maxn];
int sparce[maxlog][maxn];
void dfs(int x, int p = 0) {
    depth[x] = depth[p] + 1;
    sparce[0][x] = p;
    for (int i : a[x]) {
        if (s[0][x].size() == 11) break;
        s[0][x].push_back(i);
    }
    for (int i : v[x]) {
        if (i == p) continue;
        dfs(i, x);
    }
}
int equalize(int x, int y) {
    for (int i = maxlog - 1 ; i >= 0 ; --i)
        if (depth[sparce[i][x]] >= depth[y])
            x = sparce[i][x];
    return x;
}
int find_lca(int x, int y) {
    if (x == y) return x;
    for (int i = maxlog-1 ; i >= 0 ; --i) {
        if (sparce[i][x] != sparce[i][y]) {
            x = sparce[i][x];
            y = sparce[i][y];
        }
    }
    return sparce[0][x];
}
int lca(int x, int y) {
    if (depth[x] > depth[y]) swap(x, y);
    return find_lca(x, equalize(y, x));
}
int mn;
vector < int > res;
bool print;
void merge(const vector < int > &a1, const vector < int > &b1) {
    int it_a = 0;
    int it_b = 0;
    res.clear();
    mn = 0;
    while (res.size() < 11 && (it_a < a1.size() || it_b < b1.size())) {
        while(it_b < b1.size() && it_a < a1.size() && a1[it_a] == b1[it_b]) ++it_b;
        while(!res.empty() && it_b < b1.size() && b1[it_b] == res.back()) ++it_b;
        while(!res.empty() && it_a < a1.size() && a1[it_a] == res.back()) ++it_a;
        if (it_b == b1.size()) {
            res.push_back(a1[it_a]);
            ++it_a;
            continue;
        }
        if (it_a == a1.size()) {
            res.push_back(b1[it_b]);
            ++it_b;
            continue;
        }
        if (b1[it_b] < a1[it_a]) {
            res.push_back(b1[it_b]);
            ++it_b;
        } else {
            res.push_back(a1[it_a]);
            ++it_a;
        }
    }
}
void f(int x, int lca, vector < int > &curr) {
    for (int i = maxlog-1 ; i >= 0 ; --i) {
        if (depth[sparce[i][x]] >= depth[lca]) {
            merge(curr, s[i][x]);
            curr = res;
            x = sparce[i][x];
        }
    }
    merge(curr, {});
    curr = res;
}
vector < int > a1, b1, ans;
int x, y, z, n, m, t, len, curr_lca;
int main () {
    ios_base :: sync_with_stdio(0);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cin >> n >> m >> t;
    for (int i = 1 ; i < n ; ++i) {
        cin >> x >> y;
        v[x].push_back(y);
        v[y].push_back(x);
    }
    for (int i = 1 ; i <= m ; ++i) {
        cin >> x;
        a[x].push_back(i);
    }
    dfs(1);
    for (int i = 1 ; i < maxlog ; ++i) {
        for (int j = 1 ; j <= n ; ++j) {
            sparce[i][j] = sparce[i-1][sparce[i-1][j]];
            s[i][j] = s[i-1][j];
            merge(s[i][j], s[i-1][sparce[i-1][j]]);
            s[i][j] = res;
        }
    }
    for (int i = 1 ; i <= n ; ++i) {
        v[i].clear();
        a[i].clear();
    }
    for (int i = 0 ; i < t ; ++i) {
        cin >> x >> y >> z;
        curr_lca = sparce[0][lca(x, y)];
        a1.clear();
        b1.clear();
        f(x, curr_lca, a1);
        f(y, curr_lca, b1);
        merge(a1, b1);
        a1 = res;
        if (a1.empty()) {
            cout << 0 << '\n';
            continue;
        }
        ans.clear();
        ans.push_back(a1[0]);
        for (int i = 1 ; i < a1.size() ; ++i)
            if (a1[i] != a1[i-1]) ans.push_back(a1[i]);
        len = min(z, (int)ans.size());
        cout << len << ' ';
        for (int i = 0 ; i < len ; ++i)
            cout << ans[i] << ' ';
        cout << '\n';
    }
    return 0;
}


#include <iostream>
#include <vector>
#include <set>
using namespace std;
const int maxn = 1e5+10, maxlog = 20;
vector < int > v[maxn];
vector < int > a[maxn];
int depth[maxn];
set < int > s[20][maxn];
int sparce[maxlog][maxn];
void dfs(int x, int p = 0) {
    depth[x] = depth[p] + 1;
    sparce[0][x] = p;
    for (int i : a[x]) {
        if (s[0][x].size() == 10) break;
        s[0][x].insert(i);
    }
    for (int i : v[x]) {
        if (i == p) continue;
        dfs(i, x);
    }
}
int equalize(int x, int y) {
    for (int i = maxlog - 1 ; i >= 0 ; --i)
        if (depth[sparce[i][x]] >= depth[y])
            x = sparce[i][x];
    return x;
}
int find_lca(int x, int y) {
    if (x == y) return x;
    for (int i = maxlog-1 ; i >= 0 ; --i) {
        if (sparce[i][x] != sparce[i][y]) {
            x = sparce[i][x];
            y = sparce[i][y];
        }
    }
    return sparce[0][x];
}
int lca(int x, int y) {
    if (depth[x] > depth[y]) swap(x, y);
    return find_lca(x, equalize(y, x));
}
int mn;
set < int > merge(const set < int > &a1, const set < int > &b1) {
    auto it_a = a1.begin();
    auto it_b = b1.begin();
    set < int > res;
    mn = 0;
    while (res.size() < 10 && (it_a != a1.end() || it_b != b1.end())) {
        if (it_b == b1.end()) {
            res.insert(*it_a);
            ++it_a;
            continue;
        }
        if (it_a == a1.end()) {
            res.insert(*it_b);
            ++it_b;
            continue;
        }
        if (*it_b < *it_a) {
            res.insert(*it_b);
            ++it_b;
        } else {
            res.insert(*it_a);
            ++it_a;
        }
    }
    return res;
}
void f(int x, int lca, set < int > &curr) {
    for (int i = maxlog-2 ; i >= 0 ; --i) {
        if (depth[sparce[i][x]] >= depth[lca]) {
            curr = merge(curr, s[i][x]);
            x = sparce[i][x];
        }
    }
    merge(curr, {});
}
set < int > a1, b1;
int x, y, z, n, m, t, len, curr_lca;
int main () {
    ios_base :: sync_with_stdio(0);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cin >> n >> m >> t;
    for (int i = 1 ; i < n ; ++i) {
        cin >> x >> y;
        v[x].push_back(y);
        v[y].push_back(x);
    }
    for (int i = 1 ; i <= m ; ++i) {
        cin >> x;
        a[x].push_back(i);
    }
    dfs(1);
    for (int i = 1 ; i < maxlog ; ++i) {
        for (int j = 1 ; j <= n ; ++j) {
            sparce[i][j] = sparce[i-1][sparce[i-1][j]];
            s[i][j] = s[i-1][j];
            for (int x : s[i-1][sparce[i-1][j]])
                s[i][j].insert(x);
            auto it = s[i][j].end();
            while(s[i][j].size() > 10) {
                --it;
                s[i][j].erase(it);
            }
        }
    }
    for (int i = 1 ; i <= n ; ++i) {
        v[i].clear();
        a[i].clear();
    }
    for (int i = 0 ; i < t ; ++i) {
        cin >> x >> y >> z;
        curr_lca = sparce[0][lca(x, y)];
        a1.clear();
        b1.clear();
        f(x, curr_lca, a1);
        f(y, curr_lca, b1);
        a1 = merge(a1, b1);
        len = min(z, (int)a1.size());
        cout << len;
        auto it = a1.begin();
        for (int i = 0 ; i < len ; ++i) {
            cout << ' ' << *it;
            ++it;
        }
        cout << '\n';
    }
    return 0;
}


#include <iostream>
#include <vector>
using namespace std;
const int maxn = 1e5+10, maxlog = 18;
vector < int > v[maxn];
vector < int > a[maxn];
int depth[maxn];
vector < int > s[maxlog][maxn];
int sparce[maxlog][maxn];
void dfs(int x, int p = 0) {
    depth[x] = depth[p] + 1;
    sparce[0][x] = p;
    for (int i : a[x]) {
        if (s[0][x].size() == 11) break;
        //if (i == 16 && x == 3) cout << "helluw\n";
        s[0][x].push_back(i);
    }
    for (int i : v[x]) {
        if (i == p) continue;
        dfs(i, x);
    }
}
int equalize(int x, int y) {
    for (int i = maxlog - 1 ; i >= 0 ; --i)
        if (depth[sparce[i][x]] >= depth[y])
            x = sparce[i][x];
    return x;
}
int find_lca(int x, int y) {
    if (x == y) return x;
    for (int i = maxlog-1 ; i >= 0 ; --i) {
        if (sparce[i][x] != sparce[i][y]) {
            x = sparce[i][x];
            y = sparce[i][y];
        }
    }
    return sparce[0][x];
}
int lca(int x, int y) {
    if (depth[x] > depth[y]) swap(x, y);
    return find_lca(x, equalize(y, x));
}
int mn;
vector < int > res;
bool print;
void merge(const vector < int > &a1, const vector < int > &b1) {
    int it_a = 0;
    int it_b = 0;
    res.clear();
    //cerr << "res.size(): " << res.size() << '\n';
    mn = 0;
    //cerr << "sizes: " << a1.size() << ' ' << b1.size() << '\n';
    while (res.size() < 11 && (it_a < a1.size() || it_b < b1.size())) {
        //cerr << "here: " << it_a << ' ' << it_b << ' ' << a1.size() << ' ' << b1.size() << '\n';
        while(it_b < b1.size() && it_a < a1.size() && a1[it_a] == b1[it_b]) ++it_b;
        while(!res.empty() && it_b < b1.size() && b1[it_b] == res.back()) ++it_b;
        while(!res.empty() && it_a < a1.size() && a1[it_a] == res.back()) ++it_a;
        if (it_b == b1.size()) {
            res.push_back(a1[it_a]);
            ++it_a;
            continue;
        }
        if (it_a == a1.size()) {
            res.push_back(b1[it_b]);
            ++it_b;
            continue;
        }
        //cerr << "curr: " << it_a << ' ' << it_b << ' ' << a1[it_a] << ' ' << b1[it_b] << '\n';
        if (b1[it_b] < a1[it_a]) {
            res.push_back(b1[it_b]);
            //cerr << "b1\n";
            ++it_b;
        } else {
            res.push_back(a1[it_a]);
            //cerr << "a1\n";
            ++it_a;
        }
    }
}
void f(int x, int lca, vector < int > &curr) {
    for (int i = maxlog-1 ; i >= 0 ; --i) {
        if (depth[sparce[i][x]] >= depth[lca]) {
            //cout << "razl: " << i << ' ' << x << '\n';
            merge(curr, s[i][x]);
            curr = res;
            x = sparce[i][x];
        }
    }
    merge(curr, {});
    curr = res;
}
vector < int > a1, b1, ans;
int x, y, z, n, m, t, len, curr_lca;
int main () {
    ios_base :: sync_with_stdio(0);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cin >> n >> m >> t;
    for (int i = 1 ; i < n ; ++i) {
        cin >> x >> y;
        v[x].push_back(y);
        v[y].push_back(x);
    }
    for (int i = 1 ; i <= m ; ++i) {
        cin >> x;
        a[x].push_back(i);
    }
    dfs(1);
    for (int i = 7 ; i <= 7 ; ++i) {
        for (int j = 0 ; j < 1 ; ++j) {
            /*cerr << sparce[j][i] << " s[" << j << "][" << i << "]: ";
            for (int x : s[j][i]) cout << x << ' ';
            cout << '\n';*/
        }
    }
    for (int i = 1 ; i < maxlog ; ++i) {
        for (int j = 1 ; j <= n ; ++j) {
            sparce[i][j] = sparce[i-1][sparce[i-1][j]];
            s[i][j] = s[i-1][j];
            /*cerr << "####################################\n";
            cout << "i, j: " << i << ' ' << j << "\n";
            cout << "beg s[1][9]: ";
            for (int br : s[1][9]) cout << br << ' ';
            cout << '\n';*/
            merge(s[i][j], s[i-1][sparce[i-1][j]]);
            /*cout << "fin s[1][9]: ";
            for (int br : s[1][9]) cout << br << ' ';
            cout << '\n';*/
            s[i][j] = res;
            /*cout << "fin2 s[1][9]: ";
            for (int br : s[1][9]) cout << br << ' ';
            cout << '\n';*/
        }
        /*cerr  << "after s[" << 1 << "][" << 9 << "]: ";
        for (int br : s[1][9]) cout << br << ' ';
        cout << '\n';*/
    }
    /*cout  << " s[" << 1 << "][" << 9 << "]: ";
    for (int br : s[1][9]) cout << br << ' ';
    cout << '\n';*/
    for (int i = 1 ; i <= n ; ++i) {
        v[i].clear();
        a[i].clear();
    }
    for (int i = 0 ; i < t ; ++i) {
        cin >> x >> y >> z;
        curr_lca = sparce[0][lca(x, y)];
        a1.clear();
        b1.clear();
        f(x, curr_lca, a1);
        //cout << "\n";
        f(y, curr_lca, b1);
        //cout << "##############\n";
        merge(a1, b1);
        /*cerr << "a1 before: ";
        for (int i : a1) cout << i << ' ';
        cout << '\n';
        cerr << "b1 before: ";
        for (int i : b1) cout << i << ' ';
        cout << '\n';*/
        a1 = res;
        if (a1.empty()) {
            cout << 0 << '\n';
            continue;
        }
        /*cerr << "a1 after: ";
        for (int i : a1) cout << i << ' ';
        cout << '\n';*/
        ans.clear();
        ans.push_back(a1[0]);
        for (int i = 1 ; i < a1.size() ; ++i)
            if (a1[i] != a1[i-1]) ans.push_back(a1[i]);
        len = min(z, (int)ans.size());
        cout << len << ' ';
        for (int i = 0 ; i < len ; ++i)
            cout << ans[i] << ' ';
        cout << '\n';
        //cout << "\n\n";
    }
    return 0;
}


#include <iostream>
#include <vector>
#include <set>
using namespace std;
const int maxn = 1e5+10, maxlog = 20;
vector < int > v[maxn];
vector < int > a[maxn];
int depth[maxn];
set < int > s[maxlog][maxn];
int sparce[maxlog][maxn];
void dfs(int x, int p = 0) {
    depth[x] = depth[p] + 1;
    sparce[0][x] = p;
    for (int i : a[x]) {
        if (s[0][x].size() == 10) break;
        s[0][x].insert(i);
    }
    for (int i : v[x]) {
        if (i == p) continue;
        dfs(i, x);
    }
}
int equalize(int x, int y) {
    for (int i = maxlog - 1 ; i >= 0 ; --i)
        if (depth[sparce[i][x]] >= depth[y])
            x = sparce[i][x];
    return x;
}
int find_lca(int x, int y) {
    if (x == y) return x;
    for (int i = maxlog-1 ; i >= 0 ; --i) {
        if (sparce[i][x] != sparce[i][y]) {
            x = sparce[i][x];
            y = sparce[i][y];
        }
    }
    return sparce[0][x];
}
int lca(int x, int y) {
    if (depth[x] > depth[y]) swap(x, y);
    return find_lca(x, equalize(y, x));
}
int mn;
set < int > res;
void merge(const set < int > &a1, const set < int > &b1) {
    auto it_a = a1.begin();
    auto it_b = b1.begin();
    res.clear();
    mn = 0;
    while (res.size() < 10 && (it_a != a1.end() || it_b != b1.end())) {
        if (it_b == b1.end()) {
            res.insert(*it_a);
            ++it_a;
            continue;
        }
        if (it_a == a1.end()) {
            res.insert(*it_b);
            ++it_b;
            continue;
        }
        if (*it_b < *it_a) {
            res.insert(*it_b);
            ++it_b;
        } else {
            res.insert(*it_a);
            ++it_a;
        }
    }
}
void f(int x, int lca, set < int > &curr) {
    for (int i = maxlog-2 ; i >= 0 ; --i) {
        if (depth[sparce[i][x]] >= depth[lca]) {
            merge(curr, s[i][x]);
            curr = res;
            x = sparce[i][x];
        }
    }
    merge(curr, {});
    curr = res;
}
set < int > a1, b1;
int x, y, z, n, m, t, len, curr_lca;
int main () {
    ios_base :: sync_with_stdio(0);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cin >> n >> m >> t;
    for (int i = 1 ; i < n ; ++i) {
        cin >> x >> y;
        v[x].push_back(y);
        v[y].push_back(x);
    }
    for (int i = 1 ; i <= m ; ++i) {
        cin >> x;
        a[x].push_back(i);
    }
    dfs(1);
    for (int i = 1 ; i < maxlog ; ++i) {
        for (int j = 1 ; j <= n ; ++j) {
            sparce[i][j] = sparce[i-1][sparce[i-1][j]];
            s[i][j] = s[i-1][j];
            for (int x : s[i-1][sparce[i-1][j]])
                s[i][j].insert(x);
            auto it = s[i][j].end();
            while(s[i][j].size() > 10) {
                --it;
                s[i][j].erase(it);
            }
        }
    }
    for (int i = 1 ; i <= n ; ++i) {
        v[i].clear();
        a[i].clear();
    }
    for (int i = 0 ; i < t ; ++i) {
        cin >> x >> y >> z;
        curr_lca = sparce[0][lca(x, y)];
        a1.clear();
        b1.clear();
        f(x, curr_lca, a1);
        f(y, curr_lca, b1);
        merge(a1, b1);
        a1 = res;
        len = min(z, (int)a1.size());
        cout << len;
        auto it = a1.begin();
        for (int i = 0 ; i < len ; ++i) {
            cout << ' ' << *it;
            ++it;
        }
        cout << '\n';
    }
    return 0;
}


#include <iostream>
#include <vector>
#include <set>
using namespace std;
const int maxn = 1e5+10, maxlog = 18;
vector < int > v[maxn];
vector < int > a[maxn];
int depth[maxn];
set < int > s[maxlog][maxn];
int sparce[maxlog][maxn];
void dfs(int x, int p = 0) {
    depth[x] = depth[p] + 1;
    sparce[0][x] = p;
    for (int i : a[x]) {
        if (s[0][x].size() == 10) break;
        s[0][x].insert(i);
    }
    for (int i : v[x]) {
        if (i == p) continue;
        dfs(i, x);
    }
}
int equalize(int x, int y) {
    for (int i = maxlog - 1 ; i >= 0 ; --i)
        if (depth[sparce[i][x]] >= depth[y])
            x = sparce[i][x];
    return x;
}
int find_lca(int x, int y) {
    if (x == y) return x;
    for (int i = maxlog-1 ; i >= 0 ; --i) {
        if (sparce[i][x] != sparce[i][y]) {
            x = sparce[i][x];
            y = sparce[i][y];
        }
    }
    return sparce[0][x];
}
int lca(int x, int y) {
    if (depth[x] > depth[y]) swap(x, y);
    return find_lca(x, equalize(y, x));
}
int mn;
set < int > res;
void merge(const set < int > &a1, const set < int > &b1) {
    auto it_a = a1.begin();
    auto it_b = b1.begin();
    res.clear();
    mn = 0;
    while (res.size() < 10 && (it_a != a1.end() || it_b != b1.end())) {
        if (it_b == b1.end()) {
            res.insert(*it_a);
            ++it_a;
            continue;
        }
        if (it_a == a1.end()) {
            res.insert(*it_b);
            ++it_b;
            continue;
        }
        if (*it_b < *it_a) {
            res.insert(*it_b);
            ++it_b;
        } else {
            res.insert(*it_a);
            ++it_a;
        }
    }
}
void f(int x, int lca, set < int > &curr) {
    for (int i = maxlog-2 ; i >= 0 ; --i) {
        if (depth[sparce[i][x]] >= depth[lca]) {
            merge(curr, s[i][x]);
            curr = res;
            x = sparce[i][x];
        }
    }
    merge(curr, {});
    curr = res;
}
set < int > a1, b1;
int x, y, z, n, m, t, len, curr_lca;
int main () {
    ios_base :: sync_with_stdio(0);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cin >> n >> m >> t;
    for (int i = 1 ; i < n ; ++i) {
        cin >> x >> y;
        v[x].push_back(y);
        v[y].push_back(x);
    }
    for (int i = 1 ; i <= m ; ++i) {
        cin >> x;
        a[x].push_back(i);
    }
    dfs(1);
    for (int i = 1 ; i < maxlog ; ++i) {
        for (int j = 1 ; j <= n ; ++j) {
            sparce[i][j] = sparce[i-1][sparce[i-1][j]];
            s[i][j] = s[i-1][j];
            merge(s[i][j], s[i-1][sparce[i-1][j]]);
            s[i][j] = res;
        }
    }
    for (int i = 1 ; i <= n ; ++i) {
        v[i].clear();
        a[i].clear();
    }
    for (int i = 0 ; i < t ; ++i) {
        cin >> x >> y >> z;
        curr_lca = sparce[0][lca(x, y)];
        a1.clear();
        b1.clear();
        f(x, curr_lca, a1);
        f(y, curr_lca, b1);
        merge(a1, b1);
        a1 = res;
        len = min(z, (int)a1.size());
        cout << len;
        auto it = a1.begin();
        for (int i = 0 ; i < len ; ++i) {
            cout << ' ' << *it;
            ++it;
        }
        cout << '\n';
    }
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
const int maxn = 1e5+10, maxlog = 18;
vector < int > v[maxn];
vector < int > a[maxn];
int depth[maxn];
vector < int > s[maxlog][maxn];
int sparce[maxlog][maxn];
void dfs(int x, int p = 0) {
    depth[x] = depth[p] + 1;
    sparce[0][x] = p;
    for (int i : a[x]) {
        if (s[0][x].size() == 10) break;
        s[0][x].push_back(i);
    }
    for (int i : v[x]) {
        if (i == p) continue;
        dfs(i, x);
    }
}
int equalize(int x, int y) {
    for (int i = maxlog - 1 ; i >= 0 ; --i)
        if (depth[sparce[i][x]] >= depth[y])
            x = sparce[i][x];
    return x;
}
int find_lca(int x, int y) {
    if (x == y) return x;
    for (int i = maxlog-1 ; i >= 0 ; --i) {
        if (sparce[i][x] != sparce[i][y]) {
            x = sparce[i][x];
            y = sparce[i][y];
        }
    }
    return sparce[0][x];
}
int lca(int x, int y) {
    if (depth[x] > depth[y]) swap(x, y);
    return find_lca(x, equalize(y, x));
}
int mn;
vector < int > res;
bool print;
void merge(const vector < int > &a1, const vector < int > &b1) {
    int it_a = 0;
    int it_b = 0;
    res.clear();
    //cerr << "res.size(): " << res.size() << '\n';
    mn = 0;
    //cerr << "sizes: " << a1.size() << ' ' << b1.size() << '\n';
    while (res.size() < 10 && (it_a < a1.size() || it_b < b1.size())) {
        //cerr << "here: " << it_a << ' ' << it_b << ' ' << a1.size() << ' ' << b1.size() << '\n';
        if (it_b == b1.size()) {
            res.push_back(a1[it_a]);
            ++it_a;
            continue;
        }
        if (it_a == a1.size()) {
            res.push_back(b1[it_b]);
            ++it_b;
            continue;
        }
        //cerr << "curr: " << it_a << ' ' << it_b << ' ' << a1[it_a] << ' ' << b1[it_b] << '\n';
        if (b1[it_b] < a1[it_a]) {
            res.push_back(b1[it_b]);
            //cerr << "b1\n";
            ++it_b;
        } else {
            res.push_back(a1[it_a]);
            //cerr << "a1\n";
            ++it_a;
        }
    }
}
void f(int x, int lca, vector < int > &curr) {
    for (int i = maxlog-1 ; i >= 0 ; --i) {
        if (depth[sparce[i][x]] >= depth[lca]) {
            merge(curr, s[i][x]);
            curr = res;
            x = sparce[i][x];
        }
    }
    merge(curr, {});
    curr = res;
}
vector < int > a1, b1, ans;
int x, y, z, n, m, t, len, curr_lca;
int main () {
    ios_base :: sync_with_stdio(0);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cin >> n >> m >> t;
    for (int i = 1 ; i < n ; ++i) {
        cin >> x >> y;
        v[x].push_back(y);
        v[y].push_back(x);
    }
    for (int i = 1 ; i <= m ; ++i) {
        cin >> x;
        a[x].push_back(i);
    }
    dfs(1);
    for (int i = 1 ; i < maxlog ; ++i) {
        for (int j = 1 ; j <= n ; ++j) {
            sparce[i][j] = sparce[i-1][sparce[i-1][j]];
            s[i][j] = s[i-1][j];
            merge(s[i][j], s[i-1][sparce[i-1][j]]);
            s[i][j] = res;
        }
    }
    for (int i = 1 ; i <= n ; ++i)
        sort(s[0][i].begin(), s[0][i].end());
    /*for (int i = 1 ; i <= n ; ++i) {
        for (int j = 0 ; j < 3 ; ++j) {
            cerr << sparce[j][i] << " s[" << j << "][" << i << "]: ";
            for (int x : s[j][i]) cout << x << ' ';
            cout << '\n';
        }
    }*/
    for (int i = 1 ; i <= n ; ++i) {
        v[i].clear();
        a[i].clear();
    }
    for (int i = 0 ; i < t ; ++i) {
        cin >> x >> y >> z;
        curr_lca = sparce[0][lca(x, y)];
        a1.clear();
        b1.clear();
        f(x, curr_lca, a1);
        f(y, curr_lca, b1);
        //cout << "##############\n";
        merge(a1, b1);
        /*cerr << "a1 before: ";
        for (int i : a1) cout << i << ' ';
        cout << '\n';*/
        a1 = res;
        if (a1.empty()) {
            cout << 0 << '\n';
            continue;
        }
        /*cerr << "a1 after: ";
        for (int i : a1) cout << i << ' ';
        cout << '\n';*/
        ans.clear();
        ans.push_back(a1[0]);
        for (int i = 1 ; i < a1.size() ; ++i)
            if (a1[i] != a1[i-1]) ans.push_back(a1[i]);
        len = min(z, (int)ans.size());
        cout << len << ' ';
        for (int i = 0 ; i < len ; ++i)
            cout << ans[i] << ' ';
        cout << '\n';
    }
    return 0;
}