#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int INF = (1<<29);
const int INFF = 0x7fffffff;
const ll LINF = (1ll<<60);
const ll LINFF = 0x7fffffffffffffff;
const double PI = 3.14159265359;

#define _fi(n) for(int i = 0;i < n;i++)
#define _fj(n) for(int j = 0;j < n;j++)
#define _fk(n) for(int k = 0;k < n;k++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define prec(x) cout << fixed << setprecision(x)
#define sz(x) (int)x.size()

#define hash sodnf9843bsd
#define pqueue priority_queue
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define len length
#define endl '\n'

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ll rnd(ll a, ll b){return uniform_int_distribution<ll>(a, b)(rng);}

int const maxn = 1e5+7;
int const maxnlog = (int)log2(maxn)+1;
int n, m, q;
vector<int> st[maxn+7][maxnlog+7] = {};
vector<int>adj[maxn+7];
int parent[maxn+7] = {};
int depth[maxn+7] = {};
int heavy[maxn+7] = {};
int head[maxn+7] = {};
int pos[maxn+7] = {};
int curr_pos = 1;

void fix_size(vector<int> &v){
    sort(all(v));
    v.resize(unique(all(v))-v.begin());
    if (sz(v) > 10) v.resize(10);
}

void add_set(vector<int>&src, const vector<int>&a, const vector<int>&b){
    for(int x:a) src.pb(x);
    for(int x:b) src.pb(x);
}

void build(const vector<vector<int>> &v){
    for(int i = 0;i < sz(v);i++) {
        st[i][0] = v[i];
        fix_size(st[i][0]);
    }

    for(int j = 1;j <= maxnlog;j++){
        for(int i = 0;i+(1<<j) <= maxn;i++){
            add_set(st[i][j], st[i][j-1], st[i+(1<<(j-1))][j-1]);
            fix_size(st[i][j]);
        }
    }
}

void tree_query(vector<int>&res, int l, int r){
    int j = 31-__builtin_clz(r-l+1);
    add_set(res, st[l][j], st[r-(1<<j)+1][j]);
}

int dfs(int a){
    int size = 1;
    int max_csize = 0;

    for(int b:adj[a]){
        if (b == parent[a]) continue;
        parent[b] = a;
        depth[b] = depth[a]+1;

        int csize = dfs(b);
        size += csize;
        if (csize > max_csize){
            max_csize = csize;
            heavy[a] = b;
        }
    }

    return size;
}

void decompose(int a, int h){
    head[a] = h;
    pos[a] = curr_pos++;

    if (heavy[a] != 0) decompose(heavy[a], h);
    for(int b:adj[a]){
        if (b == heavy[a] || b == parent[a]) continue;
        decompose(b, b);
    }
}

vector<int> query(int a, int b){
    vector<int> res;

    while(head[a] != head[b]){
        if (depth[head[a]] < depth[head[b]]) swap(a, b);

        tree_query(res, pos[head[a]], pos[a]);

        a = parent[head[a]];
    }

    if (pos[a] > pos[b]) swap(a, b);

    tree_query(res, pos[a], pos[b]);
    fix_size(res);

    return res;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);

    cin>>n>>m>>q;

    _fi(n-1){
        int a, b;cin>>a>>b;
        adj[a].pb(b);
        adj[b].pb(a);
    }

    dfs(1);
    decompose(1, 1);

    vector<vector<int>>v(n+1);
    _fi(m){
        int c;cin>>c;
        v[pos[c]].pb(i+1);
    }
    build(v);

    _fi(q){
        int a, b, k;cin>>a>>b>>k;

        vector<int> ans = query(a, b);
        int s = min(sz(ans), k);

        cout << s << " ";
        for(int x:ans){
            s--;
            cout << x << " ";
            if (s == 0) break;
        }
        cout << endl;
    }

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int INF = (1<<29);
const int INFF = 0x7fffffff;
const ll LINF = (1ll<<60);
const ll LINFF = 0x7fffffffffffffff;
const double PI = 3.14159265359;

#define _fi(n) for(int i = 0;i < n;i++)
#define _fj(n) for(int j = 0;j < n;j++)
#define _fk(n) for(int k = 0;k < n;k++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define prec(x) cout << fixed << setprecision(x)
#define sz(x) (int)x.size()

#define hash sodnf9843bsd
#define pqueue priority_queue
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define len length
#define endl '\n'

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ll rnd(ll a, ll b){return uniform_int_distribution<ll>(a, b)(rng);}

int const maxn = 1e5;
int const maxnlog = (int)log2(maxn)+2;
int n, m, q;
set<int> st[maxn+7][maxnlog+7] = {};
int log_[maxn+7] = {};
vector<int>adj[maxn+7];
int parent[maxn+7] = {};
int depth[maxn+7] = {};
int heavy[maxn+7] = {};
int head[maxn+7] = {};
int pos[maxn+7] = {};
int curr_pos = 1;

void fix_size(set<int> &s){
    while(s.size() > 10) s.erase(*s.rbegin());
}

void add_set(set<int>&src, const set<int>&a, const set<int>&b){
    for(int x:a) src.insert(x);
    for(int x:b) src.insert(x);
}

void build(const vector<set<int>> &v){
    for(int i = 0;i < sz(v);i++) {
        st[i][0] = v[i];
        fix_size(st[i][0]);
    }

    for(int j = 1;j <= maxnlog;j++){
        for(int i = 0;i+(1<<j) <= maxn;i++){
            add_set(st[i][j], st[i][j-1], st[i+(1<<(j-1))][j-1]);
            fix_size(st[i][j]);
        }
    }

    log_[1] = 0;
    for(int i = 2;i <= maxn;i++) log_[i] = log_[i/2]+1;
}

void tree_query(set<int>&res, int l, int r){
    int j = log_[r-l+1];
    add_set(res, st[l][j], st[r-(1<<j)+1][j]);
}

int dfs(int a){
    int size = 1;;
    int max_csize = 0;

    for(int b:adj[a]){
        if (b == parent[a]) continue;
        parent[b] = a;
        depth[b] = depth[a]+1;

        int csize = dfs(b);
        size += csize;
        if (csize > max_csize){
            max_csize = csize;
            heavy[a] = b;
        }
    }

    return size;
}

void decompose(int a, int h){
    head[a] = h;
    pos[a] = curr_pos++;

    if (heavy[a] != 0) decompose(heavy[a], h);
    for(int b:adj[a]){
        if (b == heavy[a] || b == parent[a]) continue;
        decompose(b, b);
    }
}

set<int> query(int a, int b){
    set<int> res;

    while(head[a] != head[b]){
        if (depth[head[a]] < depth[head[b]]) swap(a, b);

        tree_query(res, pos[head[a]], pos[a]);

        a = parent[head[a]];
    }

    if (pos[a] > pos[b]) swap(a, b);

    tree_query(res, pos[a], pos[b]);
    fix_size(res);

    return res;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);

    cin>>n>>m>>q;

    _fi(n-1){
        int a, b;cin>>a>>b;
        adj[a].pb(b);
        adj[b].pb(a);
    }

    dfs(1);
    decompose(1, 1);

    vector<set<int>>v(n+1);
    _fi(m){
        int c;cin>>c;
        v[pos[c]].insert(i+1);
    }
    build(v);

    _fi(q){
        int a, b, k;cin>>a>>b>>k;

        set<int> ans = query(a, b);
        int s = min(sz(ans), k);

        cout << s << " ";
        for(int x:ans){
            s--;
            cout << x << " ";
            if (s == 0) break;
        }
        cout << endl;
    }

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int INF = (1<<29);
const int INFF = 0x7fffffff;
const ll LINF = (1ll<<60);
const ll LINFF = 0x7fffffffffffffff;
const double PI = 3.14159265359;

#define _fi(n) for(int i = 0;i < n;i++)
#define _fj(n) for(int j = 0;j < n;j++)
#define _fk(n) for(int k = 0;k < n;k++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define prec(x) cout << fixed << setprecision(x)
#define sz(x) (int)x.size()

#define hash sodnf9843bsd
#define pqueue priority_queue
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define len length
#define endl '\n'

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ll rnd(ll a, ll b){return uniform_int_distribution<ll>(a, b)(rng);}

int const maxn = 1e5;
int const maxnlog = (int)log2(maxn)+5;
int n, m, q;
vector<int> st[maxn+7][maxnlog+7] = {};
int log_[maxn+7] = {};
vector<int>adj[maxn+7];
int parent[maxn+7] = {};
int depth[maxn+7] = {};
int heavy[maxn+7] = {};
int head[maxn+7] = {};
int pos[maxn+7] = {};
int curr_pos = 1;

void fix_size(vector<int> &v){
    sort(all(v));
    v.resize(unique(all(v))-v.begin());
    if (sz(v) > 10) v.resize(10);
}

void add_set(vector<int>&src, const vector<int>&a, const vector<int>&b){
    for(int x:a) src.pb(x);
    for(int x:b) src.pb(x);
}

void build(const vector<vector<int>> &v){
    for(int i = 0;i < sz(v);i++) {
        st[i][0] = v[i];
        fix_size(st[i][0]);
    }

    for(int j = 1;j <= maxnlog;j++){
        for(int i = 0;i+(1<<j) <= maxn;i++){
            add_set(st[i][j], st[i][j-1], st[i+(1<<(j-1))][j-1]);
            fix_size(st[i][j]);
        }
    }

    log_[1] = 0;
    for(int i = 2;i <= maxn;i++) log_[i] = log_[i/2]+1;
}

void tree_query(vector<int>&res, int l, int r){
    int j = log_[r-l+1];
    add_set(res, st[l][j], st[r-(1<<j)+1][j]);
}

int dfs(int a){
    int size = 1;
    int max_csize = 0;

    for(int b:adj[a]){
        if (b == parent[a]) continue;
        parent[b] = a;
        depth[b] = depth[a]+1;

        int csize = dfs(b);
        size += csize;
        if (csize > max_csize){
            max_csize = csize;
            heavy[a] = b;
        }
    }

    return size;
}

void decompose(int a, int h){
    head[a] = h;
    pos[a] = curr_pos++;

    if (heavy[a] != 0) decompose(heavy[a], h);
    for(int b:adj[a]){
        if (b == heavy[a] || b == parent[a]) continue;
        decompose(b, b);
    }
}

vector<int> query(int a, int b){
    vector<int> res;

    while(head[a] != head[b]){
        if (depth[head[a]] < depth[head[b]]) swap(a, b);

        tree_query(res, pos[head[a]], pos[a]);

        a = parent[head[a]];
    }

    if (pos[a] > pos[b]) swap(a, b);

    tree_query(res, pos[a], pos[b]);
    fix_size(res);

    return res;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);

    cin>>n>>m>>q;

    _fi(n-1){
        int a, b;cin>>a>>b;
        adj[a].pb(b);
        adj[b].pb(a);
    }

    dfs(1);
    decompose(1, 1);

    vector<vector<int>>v(n+1);
    _fi(m){
        int c;cin>>c;
        v[pos[c]].pb(i+1);
    }
    build(v);

    _fi(q){
        int a, b, k;cin>>a>>b>>k;

        vector<int> ans = query(a, b);
        int s = min(sz(ans), k);

        cout << s << " ";
        for(int x:ans){
            s--;
            cout << x << " ";
            if (s == 0) break;
        }
        cout << endl;
    }

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int INF = (1<<29);
const int INFF = 0x7fffffff;
const ll LINF = (1ll<<60);
const ll LINFF = 0x7fffffffffffffff;
const double PI = 3.14159265359;

#define _fi(n) for(int i = 0;i < n;i++)
#define _fj(n) for(int j = 0;j < n;j++)
#define _fk(n) for(int k = 0;k < n;k++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define prec(x) cout << fixed << setprecision(x)
#define sz(x) (int)x.size()

#define hash sodnf9843bsd
#define pqueue priority_queue
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define len length
#define endl '\n'

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ll rnd(ll a, ll b){return uniform_int_distribution<ll>(a, b)(rng);}

int const maxn = 1e5;
int const maxnlog = (int)log2(maxn)+1;
int n, m, q;
vector<int> st[maxn+7][maxnlog+7] = {};
vector<int>adj[maxn+7];
int parent[maxn+7] = {};
int depth[maxn+7] = {};
int heavy[maxn+7] = {};
int head[maxn+7] = {};
int pos[maxn+7] = {};
int curr_pos = 1;

void fix_size(vector<int> &v){
    sort(all(v));
    v.resize(unique(all(v))-v.begin());
    if (sz(v) > 10) v.resize(10);
}

void add_set(vector<int>&src, const vector<int>&a, const vector<int>&b){
    for(int x:a) src.pb(x);
    for(int x:b) src.pb(x);
}

void build(const vector<vector<int>> &v){
    for(int i = 0;i < sz(v);i++) {
        st[i][0] = v[i];
        fix_size(st[i][0]);
    }

    for(int j = 1;j <= maxnlog;j++){
        for(int i = 0;i+(1<<j) <= maxn+1;i++){
            add_set(st[i][j], st[i][j-1], st[i+(1<<(j-1))][j-1]);
            fix_size(st[i][j]);
        }
    }
}

void tree_query(vector<int>&res, int l, int r){
    int j = 31-__builtin_clz(r-l);
    add_set(res, st[l][j], st[r-(1<<j)+1][j]);
}

int dfs(int a){
    int size = 1;
    int max_csize = 0;

    for(int b:adj[a]){
        if (b == parent[a]) continue;
        parent[b] = a;
        depth[b] = depth[a]+1;

        int csize = dfs(b);
        size += csize;
        if (csize > max_csize){
            max_csize = csize;
            heavy[a] = b;
        }
    }

    return size;
}

void decompose(int a, int h){
    head[a] = h;
    pos[a] = curr_pos++;

    if (heavy[a] != 0) decompose(heavy[a], h);
    for(int b:adj[a]){
        if (b == heavy[a] || b == parent[a]) continue;
        decompose(b, b);
    }
}

vector<int> query(int a, int b){
    vector<int> res;

    while(head[a] != head[b]){
        if (depth[head[a]] < depth[head[b]]) swap(a, b);

        tree_query(res, pos[head[a]], pos[a]);

        a = parent[head[a]];
    }

    if (pos[a] > pos[b]) swap(a, b);

    tree_query(res, pos[a], pos[b]);
    fix_size(res);

    return res;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);

    cin>>n>>m>>q;

    _fi(n-1){
        int a, b;cin>>a>>b;
        adj[a].pb(b);
        adj[b].pb(a);
    }

    dfs(1);
    decompose(1, 1);

    vector<vector<int>>v(n+1);
    _fi(m){
        int c;cin>>c;
        v[pos[c]].pb(i+1);
    }
    build(v);

    _fi(q){
        int a, b, k;cin>>a>>b>>k;

        vector<int> ans = query(a, b);
        int s = min(sz(ans), k);

        cout << s << " ";
        for(int x:ans){
            s--;
            cout << x << " ";
            if (s == 0) break;
        }
        cout << endl;
    }

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int INF = (1<<29);
const int INFF = 0x7fffffff;
const ll LINF = (1ll<<60);
const ll LINFF = 0x7fffffffffffffff;
const double PI = 3.14159265359;

#define _fi(n) for(int i = 0;i < n;i++)
#define _fj(n) for(int j = 0;j < n;j++)
#define _fk(n) for(int k = 0;k < n;k++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define prec(x) cout << fixed << setprecision(x)
#define sz(x) (int)x.size()

#define hash sodnf9843bsd
#define pqueue priority_queue
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define len length
#define endl '\n'

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ll rnd(ll a, ll b){return uniform_int_distribution<ll>(a, b)(rng);}

int const maxn = 1e5+1;
int const maxnlog = (int)log2(maxn)+1;
int n, m, q;
vector<int> st[maxn+7][maxnlog+7] = {};
int log_[maxn+7] = {};
vector<int>adj[maxn+7];
int parent[maxn+7] = {};
int depth[maxn+7] = {};
int heavy[maxn+7] = {};
int head[maxn+7] = {};
int pos[maxn+7] = {};
int curr_pos = 1;

void fix_size(vector<int> &v){
    sort(all(v));
    v.resize(unique(all(v))-v.begin());
    if (sz(v) > 10) v.resize(10);
}

void add_set(vector<int>&src, const vector<int>&a, const vector<int>&b){
    for(int x:a) src.pb(x);
    for(int x:b) src.pb(x);
}

void build(const vector<vector<int>> &v){
    for(int i = 0;i < sz(v);i++) {
        st[i][0] = v[i];
        fix_size(st[i][0]);
    }

    for(int j = 1;j <= maxnlog;j++){
        for(int i = 0;i+(1<<j) <= maxn;i++){
            add_set(st[i][j], st[i][j-1], st[i+(1<<(j-1))][j-1]);
            fix_size(st[i][j]);
        }
    }

    log_[1] = 0;
    for(int i = 2;i <= maxn;i++) log_[i] = log_[i/2]+1;
}

void tree_query(vector<int>&res, int l, int r){
    int j = log_[r-l+1];
    add_set(res, st[l][j], st[r-(1<<j)+1][j]);
}

int dfs(int a){
    int size = 1;
    int max_csize = 0;

    for(int b:adj[a]){
        if (b == parent[a]) continue;
        parent[b] = a;
        depth[b] = depth[a]+1;

        int csize = dfs(b);
        size += csize;
        if (csize > max_csize){
            max_csize = csize;
            heavy[a] = b;
        }
    }

    return size;
}

void decompose(int a, int h){
    head[a] = h;
    pos[a] = curr_pos++;

    if (heavy[a] != 0) decompose(heavy[a], h);
    for(int b:adj[a]){
        if (b == heavy[a] || b == parent[a]) continue;
        decompose(b, b);
    }
}

vector<int> query(int a, int b){
    vector<int> res;

    while(head[a] != head[b]){
        if (depth[head[a]] < depth[head[b]]) swap(a, b);

        tree_query(res, pos[head[a]], pos[a]);

        a = parent[head[a]];
    }

    if (pos[a] > pos[b]) swap(a, b);

    tree_query(res, pos[a], pos[b]);
    fix_size(res);

    return res;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);

    cin>>n>>m>>q;

    _fi(n-1){
        int a, b;cin>>a>>b;
        adj[a].pb(b);
        adj[b].pb(a);
    }

    dfs(1);
    decompose(1, 1);

    vector<vector<int>>v(n+1);
    _fi(m){
        int c;cin>>c;
        v[pos[c]].pb(i+1);
    }
    build(v);

    _fi(q){
        int a, b, k;cin>>a>>b>>k;

        vector<int> ans = query(a, b);
        int s = min(sz(ans), k);

        cout << s << " ";
        for(int x:ans){
            s--;
            cout << x << " ";
            if (s == 0) break;
        }
        cout << endl;
    }

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int INF = (1<<29);
const int INFF = 0x7fffffff;
const ll LINF = (1ll<<60);
const ll LINFF = 0x7fffffffffffffff;
const double PI = 3.14159265359;

#define _fi(n) for(int i = 0;i < n;i++)
#define _fj(n) for(int j = 0;j < n;j++)
#define _fk(n) for(int k = 0;k < n;k++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define prec(x) cout << fixed << setprecision(x)
#define sz(x) (int)x.size()

#define hash sodnf9843bsd
#define pqueue priority_queue
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define len length
#define endl '\n'

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ll rnd(ll a, ll b){return uniform_int_distribution<ll>(a, b)(rng);}

// Testando minha implementação de treap
struct treap{
private:
    struct node{
        int key, prior;
        node *l = nullptr, *r = nullptr;
        int cnt = 1;

        node(int k) : key(k), prior(rand()) {}
    };

    node *t = nullptr;

    int cnt(node *n){
        return n?n->cnt:0;
    }

    void upd_cnt(node *n){
        if (n) n->cnt = 1+cnt(n->l)+cnt(n->r);
    }

    void split(node *root, int key, node *&l, node *&r){
        if (!root) l = r = nullptr;
        else if (key <= root->key){
            r = root;
            split(root->l, key, l, root->l);
        }
        else{
            l = root;
            split(root->r, key, root->r, r);
        }

        upd_cnt(l);
        upd_cnt(r);
    }

    void insert(node *&root, node *element){
        if (!root) return void(root = element);

        if (element->prior > root->prior){
            split(root, element->key, element->l, element->r);
            root = element;
        }
        else{
            if (element->key < root->key) insert(root->l, element);
            else insert(root->r, element);
        }

        upd_cnt(root);
    }

    void merge(node *&root, node *l, node *r){
        if (!r || !l) root = l?l:r;
        else if (l->prior > r->prior){
            root = l;
            merge(l->r, l->r, r);
        }
        else{
            root = r;
            merge(r->l, l, r->l);
        }

        upd_cnt(root);
    }

    void erase(node *&root, int key){
        if (!root) return;
        if (root->key == key) {
            node *aux = root;
            merge(root, root->l, root->r);
            delete aux;
        }
        else{
            if (key < root->key) erase(root->l, key);
            else erase(root->r, key);
        }

        upd_cnt(root);
    }

    void del(node *n){
        if (!n) return;
        del(n->l);
        del(n->r);
        delete n;
    }

    /* ==================== EXTRA ==================== */
    int kth(node *root, int pos){ // O(log(N))
        if (!root) return 0;

        int p = 1+cnt(root->l);
        if (p == pos) return root->key;

        if (p > pos) return kth(root->l, pos);
        else return kth(root->r, pos-p);
    }

    node *unite(node *l, node *r){ // O(M*log(N/M))
        if (!l || !r) return l?l:r;
        if (l->prior < r->prior) swap(l, r);
        node *tl;
        node *tr;
        split(r, l->key, tl, tr);
        l->l = unite(l->l, tl);
        l->r = unite(l->r, tr);

        upd_cnt(l);
        return l;
    }

    void print(node *n){
        if (!n) return;
        print(n->l);
        cout << n->key << " ";
        print(n->r);
    }

public:
    void insert(int key){
        insert(t, new node(key));
    }

    void erase(int key){
        erase(t, key);
    }

    ~treap(){
        del(t);
    }

    /* ==================== EXTRA ==================== */
    bool find(int key){
        node *aux = t;
        while(aux && aux->key != key){
            if (key < aux->key) aux = aux->l;
            else aux = aux->r;
        }
        return aux != nullptr;
    }

    int order_of_key(int key){
        int res = 0;

        node *l = nullptr, *r = nullptr;
        split(t, key, l, r);
        res = cnt(l);

        merge(t, l, r);
        return res;
    }

    void erase_range(int l, int r){
        node *tl = nullptr, *tr = nullptr, *aux = nullptr;
        split(t, l, tl, aux);
        split(aux, r+1, aux, tr);
        del(aux);
        merge(t, tl, tr);
    }

    int kth(int pos){
        return kth(t, pos+1);
    }

    void unite(treap &b){
        t = unite(t, b.t);
        b.t = nullptr;
    }

    int size(){
        return cnt(t);
    }

    void print(){
        print(t);
        cout << endl;
    }
};

void fix_size(treap *a){
    if (a->size() > 10) a->erase_range(a->kth(10), INF);
}

void add_treap(treap *a, treap *b){
    if (b == nullptr) return;

    for(int j = 0;j < b->size();j++){
        a->insert(b->kth(j));
    }

    fix_size(a);
}

int n, m, q;

struct hld{
    vector<vector<int>>adj;
    vector<int> parent, depth, heavy, head, pos;
    vector<treap*>tree;
    int curr_pos = 1;

    hld(){
        adj.resize(n+7);
        parent.resize(n+7);
        depth.resize(n+7);
        heavy.resize(n+7);
        head.resize(n+7);
        pos.resize(n+7);
        tree.resize(4*n+7, nullptr);

        for(int i = 0;i < sz(tree);i++){
            tree[i] = new treap();
        }
    }

    ~hld(){
        for(int i = 0;i < sz(tree);i++){
            if (tree[i] != nullptr) delete tree[i];
        }
    }

    void update(int i, int x, int node = 1, int tl = 0, int tr = n){
        if (tl > i || tr < i) return;
        if (tl == tr && tl == i) {
            tree[node]->insert(x);
            fix_size(tree[node]);
            return;
        }
        int mid = (tl+tr)/2;
        update(i, x, node*2, tl, mid);
        update(i, x, node*2+1, mid+1, tr);

        delete tree[node];
        tree[node] = new treap();

        add_treap(tree[node], tree[node*2]);
        add_treap(tree[node], tree[node*2+1]);
    };

    treap *tree_query(int l, int r, int node = 1, int tl = 0, int tr = n){
        if (l > r) return nullptr;
        if (tl == l && tr == r) {
            treap *tmp = new treap();
            add_treap(tmp, tree[node]);
            return tmp;
        }
        int mid = (tl+tr)/2;
        treap *left = tree_query(l, min(r, mid), node*2, tl, mid);
        treap *right = tree_query(max(mid+1, l), r, node*2+1, mid+1, tr);

        if (left != nullptr){
            add_treap(left, right);
            delete right;
            return left;
        }
        else if (right != nullptr){
            add_treap(right, left);
            delete left;
            return right;
        }
        else return nullptr;
    }

    int dfs(int a){
        int size = 1;
        int max_csize = 0;

        for(int b:adj[a]){
            if (b == parent[a]) continue;
            parent[b] = a;
            depth[b] = depth[a]+1;

            int csize = dfs(b);
            size += csize;
            if (csize > max_csize){
                max_csize = csize;
                heavy[a] = b;
            }
        }

        return size;
    }

    void decompose(int a, int h){
        head[a] = h;
        pos[a] = curr_pos++;

        if (heavy[a] != 0) decompose(heavy[a], h);
        for(int b:adj[a]){
            if (b == heavy[a] || b == parent[a]) continue;
            decompose(b, b);
        }
    }

    treap *query(int a, int b){
        treap *res = new treap();

        while(head[a] != head[b]){
            if (depth[head[a]] < depth[head[b]]) swap(a, b);

            treap *tmp = tree_query(pos[head[a]], pos[a]);
            add_treap(res, tmp);
            delete tmp;

            a = parent[head[a]];
        }

        if (pos[a] > pos[b]) swap(a, b);

        treap *tmp = tree_query(pos[a], pos[b]);
        add_treap(res, tmp);
        delete tmp;

        return res;
    }

};

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);

    cin>>n>>m>>q;

    hld h = hld();

    _fi(n-1){
        int a, b;cin>>a>>b;
        h.adj[a].pb(b);
        h.adj[b].pb(a);
    }

    h.dfs(1);
    h.decompose(1, 1);

    _fi(m){
        int c;cin>>c;
        h.update(h.pos[c], i+1);
    }

    _fi(q){
        int a, b, k;cin>>a>>b>>k;

        treap *t = h.query(a, b);

        int s = min(t->size(), k);
        cout << s << " ";
        for(int j = 0;j < s;j++) cout << t->kth(j) << " ";
        cout << endl;

        delete t;
    }

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int INF = (1<<29);
const int INFF = 0x7fffffff;
const ll LINF = (1ll<<60);
const ll LINFF = 0x7fffffffffffffff;
const double PI = 3.14159265359;

#define _fi(n) for(int i = 0;i < n;i++)
#define _fj(n) for(int j = 0;j < n;j++)
#define _fk(n) for(int k = 0;k < n;k++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define prec(x) cout << fixed << setprecision(x)
#define sz(x) (int)x.size()

#define hash sodnf9843bsd
#define pqueue priority_queue
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define len length
#define endl '\n'

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ll rnd(ll a, ll b){return uniform_int_distribution<ll>(a, b)(rng);}

int const maxn = 1e5+9;
int const maxnlog = (int)log2(maxn)+1;
int n, m, q;
vector<int> st[maxn+7][maxnlog+7] = {};
int log_[maxn+7] = {};
vector<int>adj[maxn+7];
int parent[maxn+7] = {};
int depth[maxn+7] = {};
int heavy[maxn+7] = {};
int head[maxn+7] = {};
int pos[maxn+7] = {};
int curr_pos = 1;

void fix_size(vector<int> &v){
    sort(all(v));
    v.resize(unique(all(v))-v.begin());
    if (sz(v) > 10) v.resize(10);
}

void add_set(vector<int>&src, const vector<int>&a, const vector<int>&b){
    for(int x:a) src.pb(x);
    for(int x:b) src.pb(x);
}

void build(const vector<vector<int>> &v){
    for(int i = 0;i < sz(v);i++) {
        st[i][0] = v[i];
        fix_size(st[i][0]);
    }

    for(int j = 1;j <= maxnlog;j++){
        for(int i = 0;i+(1<<j) <= maxn;i++){
            add_set(st[i][j], st[i][j-1], st[i+(1<<(j-1))][j-1]);
            fix_size(st[i][j]);
        }
    }

    log_[1] = 0;
    for(int i = 2;i <= maxn;i++) log_[i] = log_[i/2]+1;
}

void tree_query(vector<int>&res, int l, int r){
    int j = log_[r-l+1];
    add_set(res, st[l][j], st[r-(1<<j)+1][j]);
}

int dfs(int a){
    int size = 1;
    int max_csize = 0;

    for(int b:adj[a]){
        if (b == parent[a]) continue;
        parent[b] = a;
        depth[b] = depth[a]+1;

        int csize = dfs(b);
        size += csize;
        if (csize > max_csize){
            max_csize = csize;
            heavy[a] = b;
        }
    }

    return size;
}

void decompose(int a, int h){
    head[a] = h;
    pos[a] = curr_pos++;

    if (heavy[a] != 0) decompose(heavy[a], h);
    for(int b:adj[a]){
        if (b == heavy[a] || b == parent[a]) continue;
        decompose(b, b);
    }
}

vector<int> query(int a, int b){
    vector<int> res;

    while(head[a] != head[b]){
        if (depth[head[a]] < depth[head[b]]) swap(a, b);

        tree_query(res, pos[head[a]], pos[a]);

        a = parent[head[a]];
    }

    if (pos[a] > pos[b]) swap(a, b);

    tree_query(res, pos[a], pos[b]);
    fix_size(res);

    return res;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);

    cin>>n>>m>>q;

    _fi(n-1){
        int a, b;cin>>a>>b;
        adj[a].pb(b);
        adj[b].pb(a);
    }

    dfs(1);
    decompose(1, 1);

    vector<vector<int>>v(n+1);
    _fi(m){
        int c;cin>>c;
        v[pos[c]].pb(i+1);
    }
    build(v);

    _fi(q){
        int a, b, k;cin>>a>>b>>k;

        vector<int> ans = query(a, b);
        int s = min(sz(ans), k);

        cout << s << " ";
        for(int x:ans){
            s--;
            cout << x << " ";
            if (s == 0) break;
        }
        cout << endl;
    }

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int INF = (1<<29);
const int INFF = 0x7fffffff;
const ll LINF = (1ll<<60);
const ll LINFF = 0x7fffffffffffffff;
const double PI = 3.14159265359;

#define _fi(n) for(int i = 0;i < n;i++)
#define _fj(n) for(int j = 0;j < n;j++)
#define _fk(n) for(int k = 0;k < n;k++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define prec(x) cout << fixed << setprecision(x)
#define sz(x) (int)x.size()

#define hash sodnf9843bsd
#define pqueue priority_queue
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define len length
#define endl '\n'

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ll rnd(ll a, ll b){return uniform_int_distribution<ll>(a, b)(rng);}

int const maxn = 1e5;
int const maxnlog = (int)log2(maxn)+1;
int n, m, q;
vector<int> st[maxn+7][maxnlog+7] = {};
vector<int>adj[maxn+7];
int parent[maxn+7] = {};
int depth[maxn+7] = {};
int heavy[maxn+7] = {};
int head[maxn+7] = {};
int pos[maxn+7] = {};
int curr_pos = 1;

void fix_size(vector<int> &v){
    sort(all(v));
    v.resize(unique(all(v))-v.begin());
    if (sz(v) > 10) v.resize(10);
}

void add_set(vector<int>&src, const vector<int>&a, const vector<int>&b){
    for(int x:a) src.pb(x);
    for(int x:b) src.pb(x);
}

void build(const vector<vector<int>> &v){
    for(int i = 0;i < sz(v);i++) {
        st[i][0] = v[i];
        fix_size(st[i][0]);
    }

    for(int j = 1;j <= maxnlog;j++){
        for(int i = 0;i+(1<<j) <= maxn;i++){
            add_set(st[i][j], st[i][j-1], st[i+(1<<(j-1))][j-1]);
            fix_size(st[i][j]);
        }
    }
}

void tree_query(vector<int>&res, int l, int r){
    int j = 31-__builtin_clz(r-l);
    add_set(res, st[l][j], st[r-(1<<j)+1][j]);
}

int dfs(int a){
    int size = 1;
    int max_csize = 0;

    for(int b:adj[a]){
        if (b == parent[a]) continue;
        parent[b] = a;
        depth[b] = depth[a]+1;

        int csize = dfs(b);
        size += csize;
        if (csize > max_csize){
            max_csize = csize;
            heavy[a] = b;
        }
    }

    return size;
}

void decompose(int a, int h){
    head[a] = h;
    pos[a] = curr_pos++;

    if (heavy[a] != 0) decompose(heavy[a], h);
    for(int b:adj[a]){
        if (b == heavy[a] || b == parent[a]) continue;
        decompose(b, b);
    }
}

vector<int> query(int a, int b){
    vector<int> res;

    while(head[a] != head[b]){
        if (depth[head[a]] < depth[head[b]]) swap(a, b);

        tree_query(res, pos[head[a]], pos[a]);

        a = parent[head[a]];
    }

    if (pos[a] > pos[b]) swap(a, b);

    tree_query(res, pos[a], pos[b]);
    fix_size(res);

    return res;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);

    cin>>n>>m>>q;

    _fi(n-1){
        int a, b;cin>>a>>b;
        adj[a].pb(b);
        adj[b].pb(a);
    }

    dfs(1);
    decompose(1, 1);

    vector<vector<int>>v(n+1);
    _fi(m){
        int c;cin>>c;
        v[pos[c]].pb(i+1);
    }
    build(v);

    _fi(q){
        int a, b, k;cin>>a>>b>>k;

        vector<int> ans = query(a, b);
        int s = min(sz(ans), k);

        cout << s << " ";
        for(int x:ans){
            s--;
            cout << x << " ";
            if (s == 0) break;
        }
        cout << endl;
    }

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int INF = (1<<29);
const int INFF = 0x7fffffff;
const ll LINF = (1ll<<60);
const ll LINFF = 0x7fffffffffffffff;
const double PI = 3.14159265359;

#define _fi(n) for(int i = 0;i < n;i++)
#define _fj(n) for(int j = 0;j < n;j++)
#define _fk(n) for(int k = 0;k < n;k++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define prec(x) cout << fixed << setprecision(x)
#define sz(x) (int)x.size()

#define hash sodnf9843bsd
#define pqueue priority_queue
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define len length
#define endl '\n'

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ll rnd(ll a, ll b){return uniform_int_distribution<ll>(a, b)(rng);}

void fix_size(set<int> &s){
    while(sz(s) > 10) s.erase(*s.rbegin());
}

set<int> merge_set(const set<int>&a, const set<int>&b){
    set<int> res;

    for(int x:a) res.insert(x);
    for(int x:b) res.insert(x);
    fix_size(res);

    return res;
}

void add_set(set<int>&a, const set<int>&b){
    for(int x:b) a.insert(x);
}

int n, m, q;

struct hld{
    vector<vector<int>>adj;
    vector<int> parent, depth, heavy, head, pos;
    vector<set<int>>tree;
    int curr_pos = 1;

    hld(){
        adj.resize(n+7);
        parent.resize(n+7);
        depth.resize(n+7);
        heavy.resize(n+7);
        head.resize(n+7);
        pos.resize(n+7);
        tree.resize(4*n+7);
    }

    void update(int i, int x, int node = 1, int tl = 0, int tr = n){
        if (tl > i || tr < i) return;
        if (tl == tr && tl == i) {
            tree[node].insert(x);
            fix_size(tree[node]);
            return;
        }
        int mid = (tl+tr)/2;
        update(i, x, node*2, tl, mid);
        update(i, x, node*2+1, mid+1, tr);

        tree[node] = merge_set(tree[node*2], tree[node*2+1]);
    };

    set<int> tree_query(int l, int r, int node = 1, int tl = 0, int tr = n){
        if (l > r) return {};
        if (tl == l && tr == r) return tree[node];
        int mid = (tl+tr)/2;
        set<int> left = tree_query(l, min(r, mid), node*2, tl, mid);
        set<int> right = tree_query(max(mid+1, l), r, node*2+1, mid+1, tr);
        return merge_set(left, right);
    }

    int dfs(int a){
        int size = 1;
        int max_csize = 0;

        for(int b:adj[a]){
            if (b == parent[a]) continue;
            parent[b] = a;
            depth[b] = depth[a]+1;

            int csize = dfs(b);
            size += csize;
            if (csize > max_csize){
                max_csize = csize;
                heavy[a] = b;
            }
        }

        return size;
    }

    void decompose(int a, int h){
        head[a] = h;
        pos[a] = curr_pos++;

        if (heavy[a] != 0) decompose(heavy[a], h);
        for(int b:adj[a]){
            if (b == heavy[a] || b == parent[a]) continue;
            decompose(b, b);
        }
    }

    set<int> query(int a, int b){
        set<int> res;

        while(head[a] != head[b]){
            if (depth[head[a]] < depth[head[b]]) swap(a, b);
            add_set(res, tree_query(pos[head[a]], pos[a]));
            a = parent[head[a]];
        }

        if (pos[a] > pos[b]) swap(a, b);
        add_set(res, tree_query(pos[a], pos[b]));

        return res;
    }

};

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);

    cin>>n>>m>>q;

    hld h = hld();

    _fi(n-1){
        int a, b;cin>>a>>b;
        h.adj[a].pb(b);
        h.adj[b].pb(a);
    }

    h.dfs(1);
    h.decompose(1, 1);

    _fi(m){
        int c;cin>>c;
        h.update(h.pos[c], i+1);
    }

    _fi(q){
        int a, b, k;cin>>a>>b>>k;

        set<int> st = h.query(a, b);

        int s = min(sz(st), k);
        cout << s << " ";
        for(int x:st) {
            s--;
            cout << x << " ";
            if (s == 0) break;
        }
        cout << endl;
    }

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int INF = (1<<29);
const int INFF = 0x7fffffff;
const ll LINF = (1ll<<60);
const ll LINFF = 0x7fffffffffffffff;
const double PI = 3.14159265359;

#define _fi(n) for(int i = 0;i < n;i++)
#define _fj(n) for(int j = 0;j < n;j++)
#define _fk(n) for(int k = 0;k < n;k++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define prec(x) cout << fixed << setprecision(x)
#define sz(x) (int)x.size()

#define hash sodnf9843bsd
#define pqueue priority_queue
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define len length
#define endl '\n'

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ll rnd(ll a, ll b){return uniform_int_distribution<ll>(a, b)(rng);}

int const maxn = 1e5;
int const maxnlog = (int)log2(maxn)+2;
int n, m, q;
vector<int> st[maxn+7][maxnlog+7] = {};
int log_[maxn+7] = {};
vector<int>adj[maxn+7];
int parent[maxn+7] = {};
int depth[maxn+7] = {};
int heavy[maxn+7] = {};
int head[maxn+7] = {};
int pos[maxn+7] = {};
int curr_pos = 1;

void fix_size(vector<int> &v){
    sort(all(v));
    v.resize(unique(all(v))-v.begin());
    if (sz(v) > 10) v.resize(10);
}

void add_set(vector<int>&src, const vector<int>&a, const vector<int>&b){
    for(int x:a) src.pb(x);
    for(int x:b) src.pb(x);
}

void build(const vector<vector<int>>v){
    for(int i = 0;i < sz(v);i++) {
        st[i][0] = v[i];
        fix_size(st[i][0]);
    }

    for(int j = 1;j <= maxnlog;j++){
        for(int i = 0;i+(1<<j) <= maxn;i++){
            add_set(st[i][j], st[i][j-1], st[i+(1<<(j-1))][j-1]);
            fix_size(st[i][j]);
        }
    }

    log_[1] = 0;
    for(int i = 2;i <= maxn;i++) log_[i] = log_[i/2]+1;
}

void tree_query(vector<int>&res, int l, int r){
    int j = log_[r-l+1];
    add_set(res, st[l][j], st[r-(1<<j)+1][j]);
}

int dfs(int a){
    int size = 1;
    int max_csize = 0;

    for(int b:adj[a]){
        if (b == parent[a]) continue;
        parent[b] = a;
        depth[b] = depth[a]+1;

        int csize = dfs(b);
        size += csize;
        if (csize > max_csize){
            max_csize = csize;
            heavy[a] = b;
        }
    }

    return size;
}

void decompose(int a, int h){
    head[a] = h;
    pos[a] = curr_pos++;

    if (heavy[a] != 0) decompose(heavy[a], h);
    for(int b:adj[a]){
        if (b == heavy[a] || b == parent[a]) continue;
        decompose(b, b);
    }
}

vector<int> query(int a, int b){
    vector<int> res;

    while(head[a] != head[b]){
        if (depth[head[a]] < depth[head[b]]) swap(a, b);

        tree_query(res, pos[head[a]], pos[a]);

        a = parent[head[a]];
    }

    if (pos[a] > pos[b]) swap(a, b);

    tree_query(res, pos[a], pos[b]);
    fix_size(res);

    return res;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);

    cin>>n>>m>>q;

    _fi(n-1){
        int a, b;cin>>a>>b;
        adj[a].pb(b);
        adj[b].pb(a);
    }

    dfs(1);
    decompose(1, 1);

    vector<vector<int>>v(n+1);
    _fi(m){
        int c;cin>>c;
        v[pos[c]].pb(i+1);
    }
    build(v);

    _fi(q){
        int a, b, k;cin>>a>>b>>k;

        vector<int> ans = query(a, b);
        int s = min(sz(ans), k);

        cout << s << " ";
        for(int x:ans){
            s--;
            cout << x << " ";
            if (s == 0) break;
        }
        cout << endl;
    }

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int INF = (1<<29);
const int INFF = 0x7fffffff;
const ll LINF = (1ll<<60);
const ll LINFF = 0x7fffffffffffffff;
const double PI = 3.14159265359;

#define _fi(n) for(int i = 0;i < n;i++)
#define _fj(n) for(int j = 0;j < n;j++)
#define _fk(n) for(int k = 0;k < n;k++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define prec(x) cout << fixed << setprecision(x)
#define sz(x) (int)x.size()

#define hash sodnf9843bsd
#define pqueue priority_queue
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define len length
#define endl '\n'

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ll rnd(ll a, ll b){return uniform_int_distribution<ll>(a, b)(rng);}

int const maxn = 1e5+2;
int const maxnlog = (int)log2(maxn)+1;
int n, m, q;
vector<int> st[maxn+7][maxnlog+7] = {};
int log_[maxn+7] = {};
vector<int>adj[maxn+7];
int parent[maxn+7] = {};
int depth[maxn+7] = {};
int heavy[maxn+7] = {};
int head[maxn+7] = {};
int pos[maxn+7] = {};
int curr_pos = 1;

void fix_size(vector<int> &v){
    sort(all(v));
    v.resize(unique(all(v))-v.begin());
    if (sz(v) > 10) v.resize(10);
}

void add_set(vector<int>&src, const vector<int>&a, const vector<int>&b){
    for(int x:a) src.pb(x);
    for(int x:b) src.pb(x);
}

void build(const vector<vector<int>> &v){
    for(int i = 0;i < sz(v);i++) {
        st[i][0] = v[i];
        fix_size(st[i][0]);
    }

    for(int j = 1;j <= maxnlog;j++){
        for(int i = 0;i+(1<<j) <= maxn;i++){
            add_set(st[i][j], st[i][j-1], st[i+(1<<(j-1))][j-1]);
            fix_size(st[i][j]);
        }
    }

    log_[1] = 0;
    for(int i = 2;i <= maxn;i++) log_[i] = log_[i/2]+1;
}

void tree_query(vector<int>&res, int l, int r){
    int j = log_[r-l+1];
    add_set(res, st[l][j], st[r-(1<<j)+1][j]);
}

int dfs(int a){
    int size = 1;
    int max_csize = 0;

    for(int b:adj[a]){
        if (b == parent[a]) continue;
        parent[b] = a;
        depth[b] = depth[a]+1;

        int csize = dfs(b);
        size += csize;
        if (csize > max_csize){
            max_csize = csize;
            heavy[a] = b;
        }
    }

    return size;
}

void decompose(int a, int h){
    head[a] = h;
    pos[a] = curr_pos++;

    if (heavy[a] != 0) decompose(heavy[a], h);
    for(int b:adj[a]){
        if (b == heavy[a] || b == parent[a]) continue;
        decompose(b, b);
    }
}

vector<int> query(int a, int b){
    vector<int> res;

    while(head[a] != head[b]){
        if (depth[head[a]] < depth[head[b]]) swap(a, b);

        tree_query(res, pos[head[a]], pos[a]);

        a = parent[head[a]];
    }

    if (pos[a] > pos[b]) swap(a, b);

    tree_query(res, pos[a], pos[b]);
    fix_size(res);

    return res;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);

    cin>>n>>m>>q;

    _fi(n-1){
        int a, b;cin>>a>>b;
        adj[a].pb(b);
        adj[b].pb(a);
    }

    dfs(1);
    decompose(1, 1);

    vector<vector<int>>v(n+1);
    _fi(m){
        int c;cin>>c;
        v[pos[c]].pb(i+1);
    }
    build(v);

    _fi(q){
        int a, b, k;cin>>a>>b>>k;

        vector<int> ans = query(a, b);
        int s = min(sz(ans), k);

        cout << s << " ";
        for(int x:ans){
            s--;
            cout << x << " ";
            if (s == 0) break;
        }
        cout << endl;
    }

    return 0;
}


//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4")

#include <bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

#define pb push_back
#define F first
#define S second
#define lll long long
#define lld long double

using namespace std;
using namespace __gnu_pbds;

template <typename T>
using ordered_set = tree <T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

const int N = 3e5 + 229;
const lll M = 1e9 + 7;
const lll M2 = 1e9 + 9;
const int mod = 998244353;
const int rx[4] = {1, -1, 0, 0};
const int ry[4] = {0, 0, 1, -1};
const lld eps = 1e-7;
const double pi = acos(-1.0);

vector < int > g[N], all[N];

int up[N][20], calc[N][20][11], c[N], timer, tin[N], tout[N], sz[N][20], nowsz, now[100], nov[100];

void dfs(int v, int p = 0) {
    ++timer;
    tin[v] = timer;
    up[v][0] = p;
    int uk1 = 0, uk2 = 0;
    if (v == p) {
        for (auto i : all[v]) {
            calc[v][0][sz[v][0]] = i;
            ++sz[v][0];
        }
    } else if (int(all[v].size()) || int(all[p].size())) {
        while (uk1 < int(all[v].size()) || uk2 < int(all[p].size())) {
            if (uk1 < int(all[v].size())
                    && (uk2 == int(all[p].size()) || all[v][uk1] < all[p][uk2])) {
                calc[v][0][uk1 + uk2] = all[v][uk1];
                ++uk1;
            } else {
                calc[v][0][uk1 + uk2] = all[p][uk2];
                ++uk2;
            }
            ++sz[v][0];
        }
    }
    int f = 0;
    for (int i = 1; i < 20; ++i) {
        up[v][i] = up[up[v][i - 1]][i - 1];
        uk1 = 0;
        uk2 = 0;
        if (up[v][i] == up[v][i - 1]) {
            for (int j = 0; j < sz[v][i - 1]; ++j) {
                calc[v][i][j] = calc[v][i - 1][j];
                ++sz[v][i];
            }
            continue;
        }
        while (uk1 < sz[v][i - 1] || uk2 < sz[up[v][i - 1]][i - 1]) {
            if (uk1 + uk2 > 10) {
                break;
            }
            if (uk1 < sz[v][i - 1]
                    && (uk2 == sz[up[v][i - 1]][i - 1] || calc[v][i - 1][uk1] <= calc[up[v][i - 1]][i - 1][uk2])) {
                calc[v][i][sz[v][i]] = calc[v][i - 1][uk1];
                ++uk1;
                ++sz[v][i];
            } else {
                if (f < int(all[p].size()) && calc[up[v][i - 1]][i - 1][uk2] == all[p][f]) {
                    ++f;
                } else {
                    calc[v][i][sz[v][i]] = calc[up[v][i - 1]][i - 1][uk2];
                    ++sz[v][i];
                }
                ++uk2;
            }
        }
    }
    for (auto to : g[v]) {
        if (to == p) {
            continue;
        }
        dfs(to, v);
    }
    ++timer;
    tout[v] = timer;
}

bool upper(int a, int b) {
    return (tin[a] <= tin[b] && tout[a] >= tout[b]);
}

int lca(int a, int b) {
    if (upper(a, b)) {
        return a;
    }
    if (upper(b, a)) {
        return b;
    }
    for (int i = 19; i >= 0; --i) {
        if (!upper(up[a][i], b)) {
            a = up[a][i];
        }
    }
    return up[a][0];
}

void Merge(int v, int i) {
    int uk1 = 0, uk2 = 0, mem = 0;
    while (uk1 < nowsz || uk2 < sz[v][i]) {
        if (mem == 10) {
            break;
        }
        if (uk1 < nowsz && (uk2 == sz[v][i]
         || now[uk1] <= calc[v][i][uk2])) {
            nov[mem] = now[uk1];
            ++uk1;
            ++mem;
         } else {
            if (!uk1 || now[uk1] != calc[v][i][uk2]) {
                nov[mem] = calc[v][i][uk2];
                ++mem;
            }
            ++uk2;
         }
    }
    nowsz = mem;
    for (int i = 0; i < nowsz; ++i) {
        now[i] = nov[i];
    }
}

void solve(int a, int b, bool f = 0) {
    for (int i = 19; i >= 0; --i) {
        if (!upper(up[b][i], a)) {
            Merge(b, i);
            b = up[b][i];
        }
    }
    if (!f) {
        Merge(b, 0);
    } else {
        sz[100001][0] = 0;
        for (auto i : all[b]) {
            calc[100001][0][sz[100001][0]] = i;
            ++sz[100001][0];
        }
        Merge(100001, 0);
    }
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    srand(time(0));
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
#endif
    int n, m, q, x, y, z, pr;
    cin >> n >> m >> q;
    for (int i = 0; i + 1 < n; ++i) {
        cin >> x >> y;
        --x;
        --y;
        g[x].pb(y);
        g[y].pb(x);
    }
    for (int i = 0; i < m; ++i) {
        cin >> x;
        --x;
        all[x].pb(i + 1);
    }
    for (int i = 0; i < n; ++i) {
        sort(all[i].begin(), all[i].end());
        if (int(all[i].size()) > 10) {
            all[i].resize(10);
        }
    }
    dfs(0);
    for (int i = 0; i < q; ++i) {
        cin >> x >> y >> z;
        --x;
        --y;
        if (x == y) {
            nowsz = z;
            nowsz = min(nowsz, int(all[x].size()));
            cout << nowsz << ' ';
            for (int j = 0; j < nowsz; ++j) {
                cout << all[x][j] << ' ';
            }
            cout << '\n';
            continue;
        }
        nowsz = 0;
        pr = lca(x, y);
        if (pr == x) {
            solve(pr, y);
        } else if (pr == y) {
            solve(pr, x);
        } else {
            solve(pr, x);
            solve(pr, y, 1);
        }
        nowsz = min(nowsz, z);
        cout << nowsz << ' ';
        for (int j = 0; j < nowsz; ++j) {
            cout << now[j] << ' ';
        }
        cout << '\n';
    }
    return 0;
}


//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4")

#include <bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

#define pb push_back
#define F first
#define S second
#define lll long long
#define lld long double

using namespace std;
using namespace __gnu_pbds;

template <typename T>
using ordered_set = tree <T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

const int N = 3e5 + 229;
const lll M = 1e9 + 7;
const lll M2 = 1e9 + 9;
const int mod = 998244353;
const int rx[4] = {1, -1, 0, 0};
const int ry[4] = {0, 0, 1, -1};
const lld eps = 1e-7;
const double pi = acos(-1.0);

vector < int > g[N], all[N];

int up[N][20], calc[N][20][11], c[N], timer, tin[N], tout[N], sz[N][20], nowsz, now[100], nov[100];

void dfs(int v, int p = 0) {
    ++timer;
    tin[v] = timer;
    up[v][0] = p;
    int uk1 = 0, uk2 = 0;
    if (v == p) {
        for (auto i : all[v]) {
            calc[v][0][sz[v][0]] = i;
            ++sz[v][0];
        }
    } else if (int(all[v].size()) || int(all[p].size())) {
        while (uk1 < int(all[v].size()) || uk2 < int(all[p].size())) {
            if (uk1 < int(all[v].size())
                    && (uk2 == int(all[p].size()) || all[v][uk1] < all[p][uk2])) {
                calc[v][0][uk1 + uk2] = all[v][uk1];
                ++uk1;
            } else {
                calc[v][0][uk1 + uk2] = all[p][uk2];
                ++uk2;
            }
            ++sz[v][0];
        }
    }
    int f = 0;
    for (int i = 1; i < 20; ++i) {
        up[v][i] = up[up[v][i - 1]][i - 1];
        uk1 = 0;
        uk2 = 0;
        if (up[v][i] == up[v][i - 1]) {
            for (int j = 0; j < sz[v][i - 1]; ++j) {
                calc[v][i][j] = calc[v][i - 1][j];
                ++sz[v][i];
            }
            continue;
        }
        while (uk1 < sz[v][i - 1] || uk2 < sz[up[v][i - 1]][i - 1]) {
            if (uk1 + uk2 > 10) {
                break;
            }
            if (uk1 < sz[v][i - 1]
                    && (uk2 == sz[up[v][i - 1]][i - 1] || calc[v][i - 1][uk1] <= calc[up[v][i - 1]][i - 1][uk2])) {
                calc[v][i][sz[v][i]] = calc[v][i - 1][uk1];
                ++uk1;
                ++sz[v][i];
            } else {
                if (f < int(all[p].size()) && calc[up[v][i - 1]][i - 1][uk2] == all[p][f]) {
                    ++f;
                } else {
                    calc[v][i][sz[v][i]] = calc[up[v][i - 1]][i - 1][uk2];
                    ++sz[v][i];
                }
                ++uk2;
            }
        }
    }
    for (auto to : g[v]) {
        if (to == p) {
            continue;
        }
        dfs(to, v);
    }
    ++timer;
    tout[v] = timer;
}

bool upper(int a, int b) {
    return (tin[a] <= tin[b] && tout[a] >= tout[b]);
}

int lca(int a, int b) {
    if (upper(a, b)) {
        return a;
    }
    if (upper(b, a)) {
        return b;
    }
    for (int i = 19; i >= 0; --i) {
        if (!upper(up[a][i], b)) {
            a = up[a][i];
        }
    }
    return up[a][0];
}

void Merge(int v, int i) {
    int uk1 = 0, uk2 = 0, mem = 0;
    while (uk1 < nowsz || uk2 < sz[v][i]) {
        if (mem == 10) {
            break;
        }
        if (uk1 < nowsz && (uk2 == sz[v][i]
         || now[uk1] <= calc[v][i][uk2])) {
            nov[mem] = now[uk1];
            ++uk1;
            ++mem;
         } else {
            if (!uk1 || now[uk1] != calc[v][i][uk2]) {
                nov[mem] = calc[v][i][uk2];
                ++mem;
            }
            ++uk2;
         }
    }
    nowsz = mem;
    for (int i = 0; i < nowsz; ++i) {
        now[i] = nov[i];
    }
}

void solve(int a, int b, bool f = 0) {
    for (int i = 19; i >= 0; --i) {
        if (!upper(up[b][i], a)) {
            Merge(b, i);
            b = up[b][i];
        }
    }
    if (!f) {
        Merge(b, 0);
    } else {
        sz[100001][0] = 0;
        for (auto i : all[b]) {
            calc[100001][0][sz[100001][0]] = i;
            ++sz[100001][0];
        }
        Merge(100001, 0);
    }
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    srand(time(0));
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
#endif
    int n, m, q, x, y, z, pr;
    cin >> n >> m >> q;
    for (int i = 0; i + 1 < n; ++i) {
        cin >> x >> y;
        --x;
        --y;
        g[x].pb(y);
        g[y].pb(x);
    }
    for (int i = 0; i < m; ++i) {
        cin >> x;
        --x;
        all[x].pb(i + 1);
    }
    for (int i = 0; i < n; ++i) {
        sort(all[i].begin(), all[i].end());
        if (int(all[i].size()) > 10) {
            all[i].resize(10);
        }
    }
    dfs(0);
    for (int i = 0; i < q; ++i) {
        cin >> x >> y >> z;
        --x;
        --y;
        if (x == y) {
            nowsz = z;
            nowsz = min(nowsz, int(all[x].size()));
            cout << nowsz << ' ';
            for (int j = 0; j < nowsz; ++j) {
                cout << all[x][j] << ' ';
            }
            cout << '\n';
        }
        nowsz = 0;
        pr = lca(x, y);
        if (pr == x) {
            solve(pr, y);
        } else if (pr == y) {
            solve(pr, x);
        } else {
            solve(pr, x);
            solve(pr, y, 1);
        }
        nowsz = min(nowsz, z);
        cout << nowsz << ' ';
        for (int j = 0; j < nowsz; ++j) {
            cout << now[j] << ' ';
        }
        cout << '\n';
    }
    return 0;
}


//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4")

#include <bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

#define pb push_back
#define F first
#define S second
#define lll long long
#define lld long double

using namespace std;
using namespace __gnu_pbds;

template <typename T>
using ordered_set = tree <T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

const int N = 3e5 + 229;
const lll M = 1e9 + 7;
const lll M2 = 1e9 + 9;
const int mod = 998244353;
const int rx[4] = {1, -1, 0, 0};
const int ry[4] = {0, 0, 1, -1};
const lld eps = 1e-7;
const double pi = acos(-1.0);

vector < int > g[N], all[N];

int up[N][20], calc[N][20][11], c[N], timer, tin[N], tout[N], sz[N][20], nowsz, now[100], nov[100];

void dfs(int v, int p = 0) {
    ++timer;
    tin[v] = timer;
    up[v][0] = p;
    int uk1 = 0, uk2 = 0;
    if (v == p) {
        for (auto i : all[v]) {
            calc[v][0][sz[v][0]] = i;
            ++sz[v][0];
        }
    } else if (int(all[v].size()) || int(all[p].size())) {
        while (uk1 < int(all[v].size()) || uk2 < int(all[p].size())) {
            if (sz[v][0] > 10) {
                break;
            }
            if (uk1 < int(all[v].size())
                    && (uk2 == int(all[p].size()) || all[v][uk1] < all[p][uk2])) {
                calc[v][0][uk1 + uk2] = all[v][uk1];
                ++uk1;
            } else {
                calc[v][0][uk1 + uk2] = all[p][uk2];
                ++uk2;
            }
            ++sz[v][0];
        }
    }
    int f = 0;
    for (int i = 1; i < 20; ++i) {
        up[v][i] = up[up[v][i - 1]][i - 1];
        f = 0;
        uk1 = 0;
        uk2 = 0;
        if (up[v][i] == up[v][i - 1]) {
            for (int j = 0; j < sz[v][i - 1]; ++j) {
                calc[v][i][j] = calc[v][i - 1][j];
                ++sz[v][i];
            }
            continue;
        }
        while (uk1 < sz[v][i - 1] || uk2 < sz[up[v][i - 1]][i - 1]) {
            if (sz[v][i] > 10) {
                break;
            }
            if (uk1 < sz[v][i - 1]
                    && (uk2 == sz[up[v][i - 1]][i - 1] || calc[v][i - 1][uk1] <= calc[up[v][i - 1]][i - 1][uk2])) {
                calc[v][i][sz[v][i]] = calc[v][i - 1][uk1];
                ++uk1;
                ++sz[v][i];
            } else {
                if (f < int(all[up[v][i - 1]].size()) && all[up[v][i - 1]][f] == calc[v][i][sz[v][i] - 1]) {
                    ++f;
                } else {
                    calc[v][i][sz[v][i]] = calc[up[v][i - 1]][i - 1][uk2];
                    ++sz[v][i];
                }
                ++uk2;
            }
        }
    }
    for (auto to : g[v]) {
        if (to == p) {
            continue;
        }
        dfs(to, v);
    }
    ++timer;
    tout[v] = timer;
}

bool upper(int a, int b) {
    return (tin[a] <= tin[b] && tout[a] >= tout[b]);
}

int lca(int a, int b) {
    if (upper(a, b)) {
        return a;
    }
    if (upper(b, a)) {
        return b;
    }
    for (int i = 19; i >= 0; --i) {
        if (!upper(up[a][i], b)) {
            a = up[a][i];
        }
    }
    return up[a][0];
}

void Merge(int v, int i) {
    int uk1 = 0, uk2 = 0, mem = 0;
    while (uk1 < nowsz || uk2 < sz[v][i]) {
        if (mem == 10) {
            break;
        }
        if (uk1 < nowsz && (uk2 == sz[v][i]
         || now[uk1] <= calc[v][i][uk2])) {
            nov[mem] = now[uk1];
            ++uk1;
            ++mem;
         } else {
            if (!uk1 || now[uk1 - 1] != calc[v][i][uk2]) {
                nov[mem] = calc[v][i][uk2];
                ++mem;
            }
            ++uk2;
         }
    }
    nowsz = mem;
    for (int i = 0; i < nowsz; ++i) {
        now[i] = nov[i];
    }
}

void solve(int a, int b, bool f = 0) {
    for (int i = 19; i >= 0; --i) {
        if (!upper(up[b][i], a)) {
            Merge(b, i);
            b = up[b][i];
        }
    }
    if (!f) {
        Merge(b, 0);
    } else {
        sz[100001][0] = 0;
        for (auto i : all[b]) {
            calc[100001][0][sz[100001][0]] = i;
            ++sz[100001][0];
        }
        Merge(100001, 0);
    }
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    srand(time(0));
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
#endif
    int n, m, q, x, y, z, pr;
    cin >> n >> m >> q;
    for (int i = 0; i + 1 < n; ++i) {
        cin >> x >> y;
        --x;
        --y;
        g[x].pb(y);
        g[y].pb(x);
    }
    for (int i = 0; i < m; ++i) {
        cin >> x;
        --x;
        all[x].pb(i + 1);
    }
    for (int i = 0; i < n; ++i) {
        sort(all[i].begin(), all[i].end());
        if (int(all[i].size()) > 10) {
            all[i].resize(10);
        }
    }
    dfs(0);
    for (int i = 0; i < q; ++i) {
        cin >> x >> y >> z;
        --x;
        --y;
        if (x == y) {
            nowsz = z;
            nowsz = min(nowsz, int(all[x].size()));
            cout << nowsz << ' ';
            for (int j = 0; j < nowsz; ++j) {
                cout << all[x][j] << ' ';
            }
            cout << '\n';
            continue;
        }
        nowsz = 0;
        pr = lca(x, y);
        if (pr == x) {
            solve(pr, y);
        } else if (pr == y) {
            solve(pr, x);
        } else {
            solve(pr, x);
            solve(pr, y, 1);
        }
        nowsz = min(nowsz, z);
        cout << nowsz << ' ';
        for (int j = 0; j < nowsz; ++j) {
            cout << now[j] << ' ';
        }
        cout << '\n';
    }
    return 0;
}


//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4")

#include <bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

#define pb push_back
#define F first
#define S second
#define lll long long
#define lld long double

using namespace std;
using namespace __gnu_pbds;

template <typename T>
using ordered_set = tree <T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

const int N = 3e5 + 229;
const lll M = 1e9 + 7;
const lll M2 = 1e9 + 9;
const int mod = 998244353;
const int rx[4] = {1, -1, 0, 0};
const int ry[4] = {0, 0, 1, -1};
const lld eps = 1e-7;
const double pi = acos(-1.0);

vector < int > g[N], all[N];

int up[N][20], c[N], timer, tin[N], tout[N];

set < int > calc[N][20], now;

void dfs(int v, int p = 0) {
    ++timer;
    tin[v] = timer;
    up[v][0] = p;
    for (auto i : all[v]) {
        calc[v][0].insert(i);
    }
    for (auto i : all[p]) {
        calc[v][0].insert(i);
    }
    while (int(calc[v][0].size()) > 10) {
        calc[v][0].erase(*calc[v][0].rbegin());
    }
    for (int i = 1; i < 20; ++i) {
        up[v][i] = up[up[v][i - 1]][i - 1];
        for (auto j : calc[v][i - 1]) {
            calc[v][i].insert(j);
        }
        for (auto j : calc[up[v][i - 1]][i - 1]) {
            calc[v][i].insert(j);
        }
        while (int(calc[v][i].size()) > 10) {
            calc[v][i].erase(*calc[v][i].rbegin());
        }
    }
    for (auto to : g[v]) {
        if (to == p) {
            continue;
        }
        dfs(to, v);
    }
    ++timer;
    tout[v] = timer;
}

bool upper(int a, int b) {
    return (tin[a] <= tin[b] && tout[a] >= tout[b]);
}

int lca(int a, int b) {
    if (upper(a, b)) {
        return a;
    }
    if (upper(b, a)) {
        return b;
    }
    for (int i = 19; i >= 0; --i) {
        if (!upper(up[a][i], b)) {
            a = up[a][i];
        }
    }
    return up[a][0];
}

void Merge(int v, int i) {
    for (auto j : calc[v][i]) {
        now.insert(j);
    }
    while (int(now.size()) > 10) {
        now.erase(*now.rbegin());
    }
}

void solve(int a, int b, bool f = 0) {
    for (int i = 19; i >= 0; --i) {
        if (!upper(up[b][i], a)) {
            Merge(b, i);
            b = up[b][i];
        }
    }
    if (!f) {
        Merge(b, 0);
    } else {
        while (!calc[100001][0].empty()) {
            calc[100001][0].erase(calc[100001][0].begin());
        }
        for (auto i : all[b]) {
            calc[100001][0].insert(i);
        }
        Merge(100001, 0);
    }
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    srand(time(0));
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
#endif
    int n, m, q, x, y, z, pr;
    cin >> n >> m >> q;
    for (int i = 0; i + 1 < n; ++i) {
        cin >> x >> y;
        --x;
        --y;
        g[x].pb(y);
        g[y].pb(x);
    }
    for (int i = 0; i < m; ++i) {
        cin >> x;
        --x;
        all[x].pb(i + 1);
    }
    for (int i = 0; i < n; ++i) {
        sort(all[i].begin(), all[i].end());
        if (int(all[i].size()) > 10) {
            all[i].resize(10);
        }
    }
    dfs(0);
    int nowsz;
    for (int i = 0; i < q; ++i) {
        cin >> x >> y >> z;
        --x;
        --y;
        if (x == y) {
            nowsz = min(z, int(all[x].size()));
            cout << nowsz << ' ';
            for (int j = 0; j < nowsz; ++j) {
                cout << all[x][j] << ' ';
            }
            cout << '\n';
            continue;
        }
        nowsz = 0;
        pr = lca(x, y);
        if (pr == x) {
            solve(pr, y);
        } else if (pr == y) {
            solve(pr, x);
        } else {
            solve(pr, x);
            solve(pr, y, 1);
        }
        nowsz = int(now.size());
        nowsz = min(nowsz, z);
        cout << nowsz << ' ';
        for (auto j : now) {
            --nowsz;
            if (nowsz < 0) {
                break;
            }
            cout << j << ' ';
        }
        cout << '\n';
    }
    return 0;
}


//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4")

#include <bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

#define pb push_back
#define F first
#define S second
#define lll long long
#define lld long double

using namespace std;
using namespace __gnu_pbds;

template <typename T>
using ordered_set = tree <T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

const int N = 3e5 + 229;
const lll M = 1e9 + 7;
const lll M2 = 1e9 + 9;
const int mod = 998244353;
const int rx[4] = {1, -1, 0, 0};
const int ry[4] = {0, 0, 1, -1};
const lld eps = 1e-7;
const double pi = acos(-1.0);

vector < int > g[N], all[N];

int up[N][20], calc[N][20][11], c[N], timer, tin[N], tout[N], sz[N][20], nowsz, now[100], nov[100];

void dfs(int v, int p = 0) {
    ++timer;
    tin[v] = timer;
    up[v][0] = p;
    int uk1 = 0, uk2 = 0;
    if (v == p) {
        for (auto i : all[v]) {
            calc[v][0][sz[v][0]] = i;
            ++sz[v][0];
        }
    } else if (int(all[v].size()) || int(all[p].size())) {
        while (uk1 < int(all[v].size()) || uk2 < int(all[p].size())) {
            if (uk1 < int(all[v].size())
                    && (uk2 == int(all[p].size()) || all[v][uk1] < all[p][uk2])) {
                calc[v][0][uk1 + uk2] = all[v][uk1];
                ++uk1;
            } else {
                calc[v][0][uk1 + uk2] = all[p][uk2];
                ++uk2;
            }
            ++sz[v][0];
        }
    }
    int f = 0;
    for (int i = 1; i < 20; ++i) {
        up[v][i] = up[up[v][i - 1]][i - 1];
        uk1 = 0;
        uk2 = 0;
        if (up[v][i] == up[v][i - 1]) {
            for (int j = 0; j < sz[v][i - 1]; ++j) {
                calc[v][i][j] = calc[v][i - 1][j];
                ++sz[v][i];
            }
            continue;
        }
        while (uk1 < sz[v][i - 1] || uk2 < sz[up[v][i - 1]][i - 1]) {
            if (uk1 + uk2 > 10) {
                break;
            }
            if (uk1 < sz[v][i - 1]
                    && (uk2 == sz[up[v][i - 1]][i - 1] || calc[v][i - 1][uk1] <= calc[up[v][i - 1]][i - 1][uk2])) {
                calc[v][i][sz[v][i]] = calc[v][i - 1][uk1];
                ++uk1;
                ++sz[v][i];
            } else {
                if (f < int(all[p].size()) && calc[up[v][i - 1]][i - 1][uk2] == all[p][f]) {
                    ++f;
                } else {
                    calc[v][i][sz[v][i]] = calc[up[v][i - 1]][i - 1][uk2];
                    ++sz[v][i];
                }
                ++uk2;
            }
        }
    }
    for (auto to : g[v]) {
        if (to == p) {
            continue;
        }
        dfs(to, v);
    }
    ++timer;
    tout[v] = timer;
}

bool upper(int a, int b) {
    return (tin[a] <= tin[b] && tout[a] >= tout[b]);
}

int lca(int a, int b) {
    if (upper(a, b)) {
        return a;
    }
    if (upper(b, a)) {
        return b;
    }
    for (int i = 19; i >= 0; --i) {
        if (!upper(up[a][i], b)) {
            a = up[a][i];
        }
    }
    return up[a][0];
}

void Merge(int v, int i) {
    int uk1 = 0, uk2 = 0, mem = 0;
    while (uk1 < nowsz || uk2 < sz[v][i]) {
        if (mem == 10) {
            break;
        }
        if (uk1 < nowsz && (uk2 == sz[v][i]
         || now[uk1] <= calc[v][i][uk2])) {
            nov[mem] = now[uk1];
            ++uk1;
            ++mem;
         } else {
            if (!uk1 || now[uk1 - 1] != calc[v][i][uk2]) {
                nov[mem] = calc[v][i][uk2];
                ++mem;
            }
            ++uk2;
         }
    }
    nowsz = mem;
    for (int i = 0; i < nowsz; ++i) {
        now[i] = nov[i];
    }
}

void solve(int a, int b, bool f = 0) {
    for (int i = 19; i >= 0; --i) {
        if (!upper(up[b][i], a)) {
            Merge(b, i);
            b = up[b][i];
        }
    }
    if (!f) {
        Merge(b, 0);
    } else {
        sz[100001][0] = 0;
        for (auto i : all[b]) {
            calc[100001][0][sz[100001][0]] = i;
            ++sz[100001][0];
        }
        Merge(100001, 0);
    }
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    srand(time(0));
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
#endif
    int n, m, q, x, y, z, pr;
    cin >> n >> m >> q;
    for (int i = 0; i + 1 < n; ++i) {
        cin >> x >> y;
        --x;
        --y;
        g[x].pb(y);
        g[y].pb(x);
    }
    for (int i = 0; i < m; ++i) {
        cin >> x;
        --x;
        all[x].pb(i + 1);
    }
    for (int i = 0; i < n; ++i) {
        sort(all[i].begin(), all[i].end());
        if (int(all[i].size()) > 10) {
            all[i].resize(10);
        }
    }
    dfs(0);
    for (int i = 0; i < q; ++i) {
        cin >> x >> y >> z;
        --x;
        --y;
        if (x == y) {
            nowsz = z;
            nowsz = min(nowsz, int(all[x].size()));
            cout << nowsz << ' ';
            for (int j = 0; j < nowsz; ++j) {
                cout << all[x][j] << ' ';
            }
            cout << '\n';
            continue;
        }
        nowsz = 0;
        pr = lca(x, y);
        if (pr == x) {
            solve(pr, y);
        } else if (pr == y) {
            solve(pr, x);
        } else {
            solve(pr, x);
            solve(pr, y, 1);
        }
        nowsz = min(nowsz, z);
        cout << nowsz << ' ';
        for (int j = 0; j < nowsz; ++j) {
            cout << now[j] << ' ';
        }
        cout << '\n';
    }
    return 0;
}


//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4")

#include <bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

#define pb push_back
#define F first
#define S second
#define lll long long
#define lld long double

using namespace std;
using namespace __gnu_pbds;

template <typename T>
using ordered_set = tree <T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

const int N = 3e5 + 229;
const lll M = 1e9 + 7;
const lll M2 = 1e9 + 9;
const int mod = 998244353;
const int rx[4] = {1, -1, 0, 0};
const int ry[4] = {0, 0, 1, -1};
const lld eps = 1e-7;
const double pi = acos(-1.0);

vector < int > g[N], all[N];

int up[N][20], c[N], timer, tin[N], tout[N];

set < int > calc[N][20], now;

void dfs(int v, int p = 0) {
    ++timer;
    tin[v] = timer;
    up[v][0] = p;
    for (auto i : all[v]) {
        calc[v][0].insert(i);
    }
    for (auto i : all[p]) {
        calc[v][0].insert(i);
    }
    while (int(calc[v][0].size()) > 10) {
        calc[v][0].erase(*calc[v][0].rbegin());
    }
    for (int i = 1; i < 20; ++i) {
        up[v][i] = up[up[v][i - 1]][i - 1];
        for (auto j : calc[v][i - 1]) {
            calc[v][i].insert(j);
        }
        for (auto j : calc[up[v][i - 1]][i - 1]) {
            calc[v][i].insert(j);
        }
        while (int(calc[v][i].size()) > 10) {
            calc[v][i].erase(*calc[v][i].rbegin());
        }
    }
    for (auto to : g[v]) {
        if (to == p) {
            continue;
        }
        dfs(to, v);
    }
    ++timer;
    tout[v] = timer;
}

bool upper(int a, int b) {
    return (tin[a] <= tin[b] && tout[a] >= tout[b]);
}

int lca(int a, int b) {
    if (upper(a, b)) {
        return a;
    }
    if (upper(b, a)) {
        return b;
    }
    for (int i = 19; i >= 0; --i) {
        if (!upper(up[a][i], b)) {
            a = up[a][i];
        }
    }
    return up[a][0];
}

void Merge(int v, int i) {
    for (auto j : calc[v][i]) {
        now.insert(j);
    }
    while (int(now.size()) > 10) {
        now.erase(*now.rbegin());
    }
}

void solve(int a, int b, bool f = 0) {
    for (int i = 19; i >= 0; --i) {
        if (!upper(up[b][i], a)) {
            Merge(b, i);
            b = up[b][i];
        }
    }
    if (!f) {
        Merge(b, 0);
    } else {
        while (!calc[100001][0].empty()) {
            calc[100001][0].erase(calc[100001][0].begin());
        }
        for (auto i : all[b]) {
            calc[100001][0].insert(i);
        }
        Merge(100001, 0);
    }
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    srand(time(0));
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
#endif
    int n, m, q, x, y, z, pr;
    cin >> n >> m >> q;
    for (int i = 0; i + 1 < n; ++i) {
        cin >> x >> y;
        --x;
        --y;
        g[x].pb(y);
        g[y].pb(x);
    }
    for (int i = 0; i < m; ++i) {
        cin >> x;
        --x;
        all[x].pb(i + 1);
    }
    for (int i = 0; i < n; ++i) {
        sort(all[i].begin(), all[i].end());
        if (int(all[i].size()) > 10) {
            all[i].resize(10);
        }
    }
    dfs(0);
    int nowsz;
    for (int i = 0; i < q; ++i) {
        cin >> x >> y >> z;
        --x;
        --y;
        while (!now.empty()) {
            now.erase(now.begin());
        }
        if (x == y) {
            nowsz = min(z, int(all[x].size()));
            cout << nowsz << ' ';
            for (int j = 0; j < nowsz; ++j) {
                cout << all[x][j] << ' ';
            }
            cout << '\n';
            continue;
        }
        nowsz = 0;
        pr = lca(x, y);
        if (pr == x) {
            solve(pr, y);
        } else if (pr == y) {
            solve(pr, x);
        } else {
            solve(pr, x);
            solve(pr, y, 1);
        }
        nowsz = int(now.size());
        nowsz = min(nowsz, z);
        cout << nowsz << ' ';
        for (auto j : now) {
            --nowsz;
            if (nowsz < 0) {
                break;
            }
            cout << j << ' ';
        }
        cout << '\n';
    }
    return 0;
}


//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4")

#include <bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

#define pb push_back
#define F first
#define S second
#define lll long long
#define lld long double

using namespace std;
using namespace __gnu_pbds;

template <typename T>
using ordered_set = tree <T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

const int N = 3e5 + 229;
const lll M = 1e9 + 7;
const lll M2 = 1e9 + 9;
const int mod = 998244353;
const int rx[4] = {1, -1, 0, 0};
const int ry[4] = {0, 0, 1, -1};
const lld eps = 1e-7;
const double pi = acos(-1.0);

vector < int > g[N], all[N];

int up[N][20], calc[N][20][11], c[N], timer, tin[N], tout[N], sz[N][20], nowsz, now[100], nov[100];

void dfs(int v, int p = 0) {
    ++timer;
    tin[v] = timer;
    up[v][0] = p;
    int uk1 = 0, uk2 = 0;
    if (v == p) {
        for (auto i : all[v]) {
            calc[v][0][sz[v][0]] = i;
            ++sz[v][0];
        }
    } else if (int(all[v].size()) || int(all[p].size())) {
        while (uk1 < int(all[v].size()) || uk2 < int(all[p].size())) {
            if (sz[v][0] > 10) {
                break;
            }
            if (uk1 < int(all[v].size())
                    && (uk2 == int(all[p].size()) || all[v][uk1] < all[p][uk2])) {
                calc[v][0][uk1 + uk2] = all[v][uk1];
                ++uk1;
            } else {
                calc[v][0][uk1 + uk2] = all[p][uk2];
                ++uk2;
            }
            ++sz[v][0];
        }
    }
    int f = 0;
    for (int i = 1; i < 20; ++i) {
        up[v][i] = up[up[v][i - 1]][i - 1];
        f = 0;
        uk1 = 0;
        uk2 = 0;
        if (up[v][i] == up[v][i - 1]) {
            for (int j = 0; j < sz[v][i - 1]; ++j) {
                calc[v][i][j] = calc[v][i - 1][j];
                ++sz[v][i];
            }
            continue;
        }
        while (uk1 < sz[v][i - 1] || uk2 < sz[up[v][i - 1]][i - 1]) {
            if (sz[v][i] == 10) {
                break;
            }
            if (uk1 < sz[v][i - 1]
                    && (uk2 == sz[up[v][i - 1]][i - 1] || calc[v][i - 1][uk1] <= calc[up[v][i - 1]][i - 1][uk2])) {
                calc[v][i][sz[v][i]] = calc[v][i - 1][uk1];
                ++uk1;
                ++sz[v][i];
            } else {
                if (f < int(all[up[v][i - 1]].size()) && all[up[v][i - 1]][f] == calc[v][i][sz[v][i] - 1]) {
                    ++f;
                } else {
                    calc[v][i][sz[v][i]] = calc[up[v][i - 1]][i - 1][uk2];
                    ++sz[v][i];
                }
                ++uk2;
            }
        }
    }
    for (auto to : g[v]) {
        if (to == p) {
            continue;
        }
        dfs(to, v);
    }
    ++timer;
    tout[v] = timer;
}

bool upper(int a, int b) {
    return (tin[a] <= tin[b] && tout[a] >= tout[b]);
}

int lca(int a, int b) {
    if (upper(a, b)) {
        return a;
    }
    if (upper(b, a)) {
        return b;
    }
    for (int i = 19; i >= 0; --i) {
        if (!upper(up[a][i], b)) {
            a = up[a][i];
        }
    }
    return up[a][0];
}

void Merge(int v, int i) {
    int uk1 = 0, uk2 = 0, mem = 0;
    while (uk1 < nowsz || uk2 < sz[v][i]) {
        if (mem == 10) {
            break;
        }
        if (uk1 < nowsz && (uk2 == sz[v][i]
         || now[uk1] <= calc[v][i][uk2])) {
            nov[mem] = now[uk1];
            ++uk1;
            ++mem;
         } else {
            if (!uk1 || now[uk1 - 1] != calc[v][i][uk2]) {
                nov[mem] = calc[v][i][uk2];
                ++mem;
            }
            ++uk2;
         }
    }
    nowsz = mem;
    for (int i = 0; i < nowsz; ++i) {
        now[i] = nov[i];
    }
}

void solve(int a, int b, bool f = 0) {
    for (int i = 19; i >= 0; --i) {
        if (!upper(up[b][i], a)) {
            Merge(b, i);
            b = up[b][i];
        }
    }
    if (!f) {
        Merge(b, 0);
    } else {
        sz[100001][0] = 0;
        for (auto i : all[b]) {
            calc[100001][0][sz[100001][0]] = i;
            ++sz[100001][0];
        }
        Merge(100001, 0);
    }
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    srand(time(0));
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
#endif
    int n, m, q, x, y, z, pr;
    cin >> n >> m >> q;
    for (int i = 0; i + 1 < n; ++i) {
        cin >> x >> y;
        --x;
        --y;
        g[x].pb(y);
        g[y].pb(x);
    }
    for (int i = 0; i < m; ++i) {
        cin >> x;
        --x;
        all[x].pb(i + 1);
    }
    for (int i = 0; i < n; ++i) {
        sort(all[i].begin(), all[i].end());
        if (int(all[i].size()) > 10) {
            all[i].resize(10);
        }
    }
    dfs(0);
    for (int i = 0; i < q; ++i) {
        cin >> x >> y >> z;
        --x;
        --y;
        if (x == y) {
            nowsz = z;
            nowsz = min(nowsz, int(all[x].size()));
            cout << nowsz << ' ';
            for (int j = 0; j < nowsz; ++j) {
                cout << all[x][j] << ' ';
            }
            cout << '\n';
            continue;
        }
        nowsz = 0;
        pr = lca(x, y);
        if (pr == x) {
            solve(pr, y);
        } else if (pr == y) {
            solve(pr, x);
        } else {
            solve(pr, x);
            solve(pr, y, 1);
        }
        nowsz = min(nowsz, z);
        cout << nowsz << ' ';
        for (int j = 0; j < nowsz; ++j) {
            cout << now[j] << ' ';
        }
        cout << '\n';
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN = 1e5+1;
const int LG = 18;
vector <int> adj[MAXN];
int par[MAXN][LG];
int depth[MAXN];
vector <int> people[MAXN][LG];
vector <int> node_people [MAXN];

vector <int> merg(vector <int> x , vector <int> y){
    x.insert( x.begin(),y.begin() ,y.end() );
    sort(x.begin(),x.end());
    x.erase( unique( x.begin(),x.end() ),x.end() );
    if(x.size()>10)x.resize(10);
    return x;
}
void dfs(int node, int prev ,int deep){
    depth[node] = deep;
    par[node][0] = prev;
    people[node][0] = merg( node_people[node], node_people[ par[node][0] ]);
    for(int i = 1 ; i < LG ; i++ )par[node][i] = par[par[node][i-1]][i-1];
    for(int i = 1 ; i < LG ; i++ )people[node][i] = merg(people[node][i-1] , people[ par[node][i-1] ][i-1]);
    for(int i : adj[node]){
        if(i == prev)continue;
        dfs(i,node,deep+1);
    }
    adj[node].clear();
}
int lca(int u, int v){
    if(depth[u] < depth[v])swap(u,v);
    for(int i = 17 ; i >= 0 ;i--)if(depth[u] - (1<<i) >= depth[v])u = par[u][i];
    if(u == v)return u;
    for(int i = 17 ; i >= 0 ;i--)if(par[u][i] != par[v][i]){
        u = par[u][i];
        v = par[v][i];
    }
    return par[u][0];
}
int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int n , m , q;
    cin >> n  >> m >> q;
    for(int i = 1 ; i < n ; i++){
        int u,v;
        cin >> u >> v;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    for(int i = 1 ; i <= m ; i++){
        int c;
        cin >> c;
        vector <int> temp;
        temp.push_back(i);
        people[c][0] = merg(people[c][0],temp);
        temp.clear();
    }
    for(int i = 1 ; i <= n ; i++)node_people[i] = people[i][0];

    dfs(1,1,0);
    while(q--){
        int v,u,a;
        cin >> v >> u >> a;
        int x = lca(u,v);
        vector <int> ans ;
        int d1 = depth[u] - depth[x];
        int d2 = depth[v] - depth[x];
        if(d1 && d2){
            d1--;
            if(!d1)ans = merg(ans,node_people[u]);
        }
        else if(!d1&&!d2){
            ans = merg(node_people[u],ans);
        }
        for(int i = 17 ; i >= 0 ; i--)if(d1 & (1<<i) ){
            ans = merg(ans,people[u][i]);
            u = par[u][i];
        }
        for(int i = 17 ; i >= 0 ; i--)if(d2 & (1<<i) ){
            ans = merg(ans,people[v][i]);
            v = par[v][i];
        }

        int sz = ans.size();
        cout << min(a,sz) <<" ";
        int cnt = 0;
        for(int i : ans){
            if(cnt == a)break;
            cout << i << " ";
            cnt++;
        }
        ans.clear();
        cout << endl;
    }
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

int n,m,q,a,u,v;
vector <int> adj [100005];
vector <int> node [100005];
set <int> ans;
int par [100005];
int depth [100005];
void dfs(int node ,int prev,int deep){
    par[node]=prev;
    depth[node] = deep;
    for(int i = 0 ; i < adj[node].size() ; i++){
        if(adj[node][i] == prev)continue;
        dfs(adj[node][i],node,deep+1);
    }
}
void add(int x){
    for(int i = 0 ; i < node[x].size(); i++){
        ans.insert(node[x][i]);
    }
}
int main()
{
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    cin >> n >> m >> q;
    for(int i = 0 ; i < n-1 ; i++){
        int u,v;
        cin >> u >> v;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    dfs(1,-1,1);
    par[1]=1;
    for(int i = 1 ; i <= m ;i++){
        int c;
        cin >> c;
        node[c].push_back(i);
    }
    // push upwards
    while(q--){
        cin >> u >> v >> a;
        ans.clear();
        add(u);
        add(v);
        if(depth[u]<depth[v])swap(u,v);
        while(depth[u]>depth[v]){
            u=par[u];
            add(u);
        }
        while(u!=v){
            u=par[u];
            v=par[v];
            add(u);
            add(v);
        }
        cout << (ans.size()>a)*a+(ans.size()<=a)*ans.size()<<" ";
        int i = 0;
        for(int j : ans){
            cout << j << " ";
            i++;
            if(i==a)break;
        }
        cout << endl;
    }

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN = 1e5+1;
const int LG = 18;
vector <int> adj[MAXN];
int par[MAXN][LG];
int depth[MAXN];
vector <int> people[MAXN][LG];
vector <int> node_people [MAXN];

vector <int> merg(vector <int> x , vector <int> y){
    x.insert( x.begin(),y.begin() ,y.end() );
    sort(x.begin(),x.end());
    while(x.size()>10)x.pop_back();
    return x;
}
void dfs(int node, int prev ,int deep){
    depth[node] = deep;
    par[node][0] = prev;
    people[node][0] = merg( node_people[node], node_people[ par[node][0] ]);
    for(int i = 1 ; i < LG ; i++ )par[node][i] = par[par[node][i-1]][i-1];
    for(int i = 1 ; i < LG ; i++ )people[node][i] = merg(people[node][i-1] , people[ par[node][i-1] ][i-1]);
    for(int i : adj[node]){
        if(i == prev)continue;
        dfs(i,node,deep+1);
    }
    adj[node].clear();
}
int lca(int u, int v){
    if(depth[u] < depth[v])swap(u,v);
    for(int i = 17 ; i >= 0 ;i--)if(depth[u] - (1<<i) >= depth[v])u = par[u][i];
    if(u == v)return u;
    for(int i = 17 ; i >= 0 ;i--)if(par[u][i] != par[v][i]){
        u = par[u][i];
        v = par[v][i];
    }
    return par[u][0];
}
int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int n , m , q;
    cin >> n  >> m >> q;
    for(int i = 1 ; i < n ; i++){
        int u,v;
        cin >> u >> v;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    for(int i = 1 ; i <= m ; i++){
        int c;
        cin >> c;
        vector <int> temp;
        temp.push_back(i);
        people[c][0] = merg(people[c][0],temp);
        temp.clear();
    }
    for(int i = 1 ; i <= n ; i++)node_people[i] = people[i][0];

    dfs(1,1,0);
    while(q--){
        int v,u,a;
        cin >> v >> u >> a;
        int x = lca(u,v);
        vector <int> ans ;
        int d1 = depth[u] - depth[x];
        int d2 = depth[v] - depth[x];
        if(d1 && d2){
            d1--;
            if(!d1)ans = merg(ans,node_people[u]);
        }
        else if(!d1&&!d2){
            ans = merg(node_people[u],ans);
        }
        for(int i = 17 ; i >= 0 ; i--)if(d1 & (1<<i) ){
            ans = merg(ans,people[u][i]);
            u = par[u][i];
        }
        for(int i = 17 ; i >= 0 ; i--)if(d2 & (1<<i) ){
            ans = merg(ans,people[v][i]);
            v = par[v][i];
        }

        int sz = ans.size();
        cout << min(a,sz) <<" ";
        int cnt = 0;
        for(int i : ans){
            if(cnt == a)break;
            cout << i << " ";
            cnt++;
        }
        ans.clear();
        cout << endl;
    }
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN = 1e5+1;
const int LG = 18;
vector <int> adj[MAXN];
int par[MAXN][LG];
int depth[MAXN];
set <int> people[MAXN][LG];
set <int> node_people [MAXN];

set <int> merg(set <int> x , set <int> y){
    x.insert( y.begin() ,y.end() );
    while(x.size()>10){
        std::set<int>::iterator it = x.end();
        it--;
        x.erase(it);
    }
    return x;
}
void dfs(int node, int prev ,int deep){
    depth[node] = deep;
    par[node][0] = prev;
    people[node][0] = merg( node_people[node], node_people[ par[node][0] ]);
    for(int i = 1 ; i < LG ; i++ )par[node][i] = par[par[node][i-1]][i-1];
    for(int i = 1 ; i < LG ; i++ )people[node][i] = merg(people[node][i-1] , people[ par[node][i-1] ][i-1]);
    for(int i : adj[node]){
        if(i == prev)continue;
        dfs(i,node,deep+1);
    }
    adj[node].clear();
}
int lca(int u, int v){
    if(depth[u] < depth[v])swap(u,v);
    for(int i = 17 ; i >= 0 ;i--)if(depth[u] - (1<<i) >= depth[v])u = par[u][i];
    if(u == v)return u;
    for(int i = 17 ; i >= 0 ;i--)if(par[u][i] != par[v][i]){
        u = par[u][i];
        v = par[v][i];
    }
    return par[u][0];
}
int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int n , m , q;
    cin >> n  >> m >> q;
    for(int i = 1 ; i < n ; i++){
        int u,v;
        cin >> u >> v;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    for(int i = 1 ; i <= m ; i++){
        int c;
        cin >> c;
        set <int> temp;
        temp.insert(i);
        people[c][0] = merg(people[c][0],temp);
        temp.clear();
    }
    for(int i = 1 ; i <= n ; i++)node_people[i] = people[i][0];

    dfs(1,1,0);
    while(q--){
        int v,u,a;
        cin >> v >> u >> a;
        int x = lca(u,v);
        set <int> ans = merg( node_people[u] ,node_people[v] );
        int d = depth[u] - depth[x];
        for(int i = 17 ; i >= 0 ; i--)if(d & (1<<i) ){
            ans = merg(ans,people[u][i]);
            u = par[u][i];
        }
        d = depth[v] - depth[x];
        for(int i = 17 ; i >= 0 ; i--)if(d & (1<<i) ){
            ans = merg(ans,people[v][i]);
            v = par[v][i];
        }
        int sz = ans.size();
        cout << min(a,sz) <<" ";
        int cnt = 0;
        for(int i : ans){
            if(cnt == a)break;
            cout << i << " ";
            cnt++;
        }
        ans.clear();
        cout << endl;
    }
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int LG = 17;
const int MAX_SIZE = 100005;

vector <int> adj [MAX_SIZE];
int par[MAX_SIZE][LG];
int depth [MAX_SIZE];
vector <int> people[MAX_SIZE][LG];

vector <int> merg (vector <int> x, vector <int> y){
    x.insert(x.end(),y.begin(),y.end());
    sort(x.begin(),x.end());
    while(x.size()>10)x.pop_back();
    return x;
}
set <int> give_set(vector <int> x){
    set <int> ans;
    for(int i = 0 ; i < x.size() ; i++)ans.insert(x[i]);
    return ans;

}
void dfs(int node, int prev,int deep){
    par[node][0] = prev;
    depth[node] = deep;
    for (int i = 1 ; i < 17 ; i++){
        par[node][i] = par[par[node][i-1]][i-1];
    }
    // set binary lifted people list up to certain height for each node
    for(int i = 1 ; i < 17 ; i++){
        // end if we already added this node
        if(par[node][i] == par[node][i-1]){
            people[node][i] = people[node][i-1];
            continue;
        }
        people[node][i] = merg( people[node][i-1], people[ par[node][i-1] ][i-1] );
    }
    for(int i = 0 ; i < adj[node].size() ; i++){
        if(adj[node][i]==prev)continue;
        dfs(adj[node][i],node,deep+1);
    }
}
// returns depth of lca
int lca (int x ,int y){
    if(depth[x] < depth[y])swap(x,y);
    int depth_dif = depth[x] - depth[y];
    // binary lift x to same level as y
    for(int i = 16 ; i >= 0 ; i--){
        if(depth_dif >= (1<<i) ){
            depth_dif -= (1<<i) ;
            x = par[x][i];
        }
    }
    if(x==y)return depth[x];
    // binary lift both to lca
    for(int i = 16 ; i >= 0 ;i--){
        if(par[x][i]!=par[y][i]){
            x = par[x][i];
            y = par[y][i];
        }
    }
    return depth[ par[x][0] ];
}

int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int n,m,q;
	cin >> n >> m >> q;
    for(int i = 0 ; i < n - 1 ; i++){
        int u , v;
        cin >> u >> v;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    for(int i = 1 ; i <= m ; i++){
        int c;
        cin >> c;
        people[c][0].push_back(i);
        if(people[c][0].size()==11){
            sort(people[c][0].begin(),people[c][0].end());
            people[c][0].pop_back();
        }
    }
    for(int i = 1 ; i <= n ; i++)sort(people[i][0].begin(),people[i][0].end());
    dfs(1,0,1);
    for(int i = 0 ; i < q ; i ++){
        int v,u,a;
        cin >> v >> u >> a;
        int lca_height = lca(v,u);
        vector <int> ans = people[u][0];
        // merge x road

        // everything up to this point is legit
        if(u == v)ans = people[u][0];
        if(depth[u]>depth[v])swap(u,v);
        // v is deeper
        int lift_by = 0;
        lift_by += depth[v] - lca_height ;
        for(int i = 16 ; i >=0 ; i--){
            if(lift_by >= 1<<i){
                ans = merg(ans,people[v][i+1]);
                lift_by -= 1<<i;
                v = par[v][i];
            }
        }
        lift_by = depth[u] - lca_height;
        for(int i = 16 ; i >=0 ; i--){
            if(lift_by >= 1<<i){
                ans = merg(people[u][i+1] , ans);
                lift_by -= 1<<i;
                u = par[u][i];
            }
        }
        set <int> anss = give_set(ans);
        if(anss.size()>a){
            cout << a <<" ";
            for(int i :anss){
                cout << i << " ";
                a--;
                if(!a)break;
            }

        }
        else {
            cout << anss.size()<<" ";
            for(int i : anss)cout << i << " ";
        }
        cout<<endl;
    }
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

int n,m,q,a,u,v;
vector <int> adj [100005];
vector <int> node [100005];
vector <int> ans;
int par [100005];
int depth [100005];
void dfs(int node ,int prev,int deep){
    par[node]=prev;
    depth[node] = deep;
    for(int i = 0 ; i < adj[node].size() ; i++){
        if(adj[node][i] == prev)continue;
        dfs(adj[node][i],node,deep+1);
    }
}
void add(int x){
    for(int i = 0 ; i < node[x].size() && a; i++){
        a--;
        ans.push_back(node[x][i]);
    }
}
int main()
{
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    cin >> n >> m >> q;
    for(int i = 0 ; i < n-1 ; i++){
        int u,v;
        cin >> u >> v;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    dfs(1,-1,1);
    par[1]=1;
    for(int i = 1 ; i <= m ;i++){
        int c;
        cin >> c;
        node[c].push_back(i);
    }
    // push upwards
    while(q--){
        cin >> u >> v >> a;
        ans.clear();
        add(u);
        add(v);
        if(depth[u]<depth[v])swap(u,v);
        while(depth[u]>depth[v]){
            u=par[u];
            if(u==v)break;
            add(u);
        }
        while(u!=v){
            u=par[u];
            v=par[v];
            add(u);
            if(u==v)break;
            add(v);
        }
        cout << ans.size()<<" ";
        for(int i = 0 ; i < ans.size() ; i++)cout<<ans[i]<<" ";
        cout << endl;
    }

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int LG = 17;
const int MAX_SIZE = 100005;

vector <int> adj [MAX_SIZE];
int par[MAX_SIZE][LG];
int depth [MAX_SIZE];
vector <int> people[MAX_SIZE][LG];

vector <int> merg (vector <int> x, vector <int> y){
    x.insert(x.end(),y.begin(),y.end());
    sort(x.begin(),x.end());
    while(x.size()>10)x.pop_back();
    return x;
}
set <int> give_set(vector <int> x){
    set <int> ans;
    for(int i = 0 ; i < x.size() ; i++)ans.insert(x[i]);
    return ans;

}
void dfs(int node, int prev,int deep){
    par[node][0] = prev;
    depth[node] = deep;
    for (int i = 1 ; i < 17 ; i++){
        par[node][i] = par[par[node][i-1]][i-1];
    }
    // set binary lifted people list up to certain height for each node
    for(int i = 1 ; i < 17 ; i++){
        // end if we already added this node
        if(par[node][i] == par[node][i-1]){
            people[node][i] = people[node][i-1];
            continue;
        }
        people[node][i] = merg( people[node][i-1], people[ par[node][i-1] ][i-1] );
    }
    for(int i = 0 ; i < adj[node].size() ; i++){
        if(adj[node][i]==prev)continue;
        dfs(adj[node][i],node,deep+1);
    }
}
// returns depth of lca
int lca (int x ,int y){
    if(depth[x] < depth[y])swap(x,y);
    int depth_dif = depth[x] - depth[y];
    // binary lift x to same level as y
    for(int i = 16 ; i >= 0 ; i--){
        if(depth_dif >= (1<<i) ){
            depth_dif -= (1<<i) ;
            x = par[x][i];
        }
    }
    if(x==y)return depth[x];
    // binary lift both to lca
    for(int i = 16 ; i >= 0 ;i--){
        if(par[x][i]!=par[y][i]){
            x = par[x][i];
            y = par[y][i];
        }
    }
    return depth[ par[x][0] ];
}

int main()
{
	//ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int n,m,q;
	cin >> n >> m >> q;
    for(int i = 0 ; i < n - 1 ; i++){
        int u , v;
        cin >> u >> v;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    for(int i = 1 ; i <= m ; i++){
        int c;
        cin >> c;
        people[c][0].push_back(i);
        if(people[c][0].size()==11){
            sort(people[c][0].begin(),people[c][0].end());
            people[c][0].pop_back();
        }
    }
    for(int i = 1 ; i <= n ; i++)sort(people[i][0].begin(),people[i][0].end());
    dfs(1,0,1);
    for(int i = 0 ; i < q ; i ++){
        int v,u,a;
        cin >> v >> u >> a;
        int lca_height = lca(v,u);
        vector <int> ans = people[u][0];
        // merge x road

        // everything up to this point is legit
        if(u == v)ans = people[u][0];
        if(depth[u]>depth[v])swap(u,v);
        // v is deeper
        int lift_by = 0;
        lift_by += depth[v] - lca_height ;
        for(int i = 16 ; i >=0 ; i--){
            if(lift_by >= 1<<i){
                ans = merg(ans,people[v][i+1]);
                lift_by -= 1<<i;
                v = par[v][i];
            }
        }
        lift_by = depth[u] - lca_height;
        for(int i = 16 ; i >=0 ; i--){
            if(lift_by >= 1<<i){
                ans = merg(people[u][i+1] , ans);
                lift_by -= 1<<i;
                u = par[u][i];
            }
        }
        set <int> anss = give_set(ans);
        if(anss.size()>a){
            cout << a <<" ";
            for(int i :anss){
                cout << i << " ";
                a--;
                if(!a)break;
            }

        }
        else {
            cout << anss.size()<<" ";
            for(int i : anss)cout << i << " ";
        }
        cout<<endl;
    }
	return 0;
}