#include <iostream>
#include <cstdio>
#include <cstring>
#include <map>
#include <queue>
#include <vector>
#include <stack>
#include <string>

using namespace std;
typedef pair<int,int> Pair;
map<Pair,int> rode;
int vis[300000+5];
int main()
{    int n,k,d;
      cin>>n>>k>>d;
      queue<int> G;
      vector<int> GC[300000+5];
      int dis[300000+5];
      memset(dis,0,sizeof(dis));
      memset(vis,0,sizeof(vis));
      int a;
      int gg=k;
       while(k--)
       {
            scanf("%d",&a);
            //cout<<a<<"VVVVVVVVVVVVVVVX";
            G.push(a);
            dis[a]=0;
            vis[a]=1;
       }
       int c=n-1;
       int x,s;
       int t=0;
       while(c--)
       {    t++;
           scanf("%d%d",&x,&s);
           Pair A;
           A=make_pair(x,s);
           rode[A]=t;
           A=make_pair(s,x);
           rode[A]=t;
           GC[x].push_back(s);
           GC[s].push_back(x);
       }
       while(G.size()!=0)
       {
           int f=G.front();
           //cout<<f<<"hhhhhhhhhhhhhhhhhhhh";
           G.pop();
           for(int i=0;i<GC[f].size();i++)
           {
               if(vis[GC[f][i]]==0)
                   {
                    dis[GC[f][i]]=dis[f]+1;
                   vis[GC[f][i]]=1;
                   G.push(GC[f][i]);
                   //cout<<f<<"CCCCCCCCCCCCCCCCC"<<endl;
               }
           }
       }
       //for(int k=1;k<=n;k++)
        //cout<<dis[k]<<' ';
       vector<int> de;
       for(int i=0;i<n;i++)
       {    int first=1;
           for(int ic=0;ic<GC[i].size();ic++)
           {   Pair F;
                 F=make_pair(i,GC[i][ic]);
               if(dis[i]==dis[GC[i][ic]]&&rode[F]!=0)
                {Pair F;
                 F=make_pair(i,GC[i][ic]);
                  de.push_back(rode[F]);
                  rode[F]=0;
                  //cout<<"DDDDDDDDDDDDD";
                  F=make_pair(GC[i][ic],i);
                  rode[F]=0;
                }
                else if(dis[i]==dis[GC[i][ic]]+1&&first==0&&rode[F]!=0)
                {Pair F;
                 F=make_pair(i,GC[i][ic]);
                  de.push_back(rode[F]);
                  rode[F]=0;
                  //cout<<"SSSSSSSSSSSSSS";
                  F=make_pair(GC[i][ic],i);
                  rode[F]=0;
                }
                if(dis[i]==dis[GC[i][ic]]+1)
                    first=0;

           }
       }
       cout<<gg-1<<endl;
       for(int i=0;i<de.size();i++)
        cout<<de[i]<<' ';
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <map>
#include <queue>
#include <vector>
#include <stack>
#include <string>

using namespace std;
typedef pair<int,int> Pair;
map<Pair,int> rode;
int vis[300000+5];
int main()
{    int n,k,d;
      cin>>n>>k>>d;
      queue<int> G;
      vector<int> GC[300000+5];
      int dis[300000+5];
      memset(dis,0,sizeof(dis));
      memset(vis,0,sizeof(vis));
      int a;
       while(k--)
       {
            scanf("%d",&a);
            //cout<<a<<"VVVVVVVVVVVVVVVX";
            G.push(a);
            dis[a]=0;
            vis[a]=1;
       }
       int c=n-1;
       int x,s;
       int t=0;
       while(c--)
       {    t++;
           scanf("%d%d",&x,&s);
           Pair A;
           A=make_pair(x,s);
           rode[A]=t;
           A=make_pair(s,x);
           rode[A]=t;
           GC[x].push_back(s);
           GC[s].push_back(x);
       }
       while(G.size()!=0)
       {
           int f=G.front();
           //cout<<f<<"hhhhhhhhhhhhhhhhhhhh";
           G.pop();
           for(int i=0;i<GC[f].size();i++)
           {
               if(vis[GC[f][i]]==0)
                   {
                    dis[GC[f][i]]=dis[f]+1;
                   vis[GC[f][i]]=1;
                   G.push(GC[f][i]);
                   //cout<<f<<"CCCCCCCCCCCCCCCCC"<<endl;
               }
           }
       }
       //for(int k=1;k<=n;k++)
        //cout<<dis[k]<<' ';
       vector<int> de;
       for(int i=0;i<n;i++)
       {    int first=1;
           for(int ic=0;ic<GC[i].size();ic++)
           {   Pair F;
                 F=make_pair(i,GC[i][ic]);
               if(dis[i]==dis[GC[i][ic]]&&rode[F]!=0)
                {Pair F;
                 F=make_pair(i,GC[i][ic]);
                  de.push_back(rode[F]);
                  rode[F]=0;
                  //cout<<"DDDDDDDDDDDDD";
                  F=make_pair(GC[i][ic],i);
                  rode[F]=0;
                }
                else if(dis[i]==dis[GC[i][ic]]+1&&first==0&&rode[F]!=0)
                {Pair F;
                 F=make_pair(i,GC[i][ic]);
                  de.push_back(rode[F]);
                  rode[F]=0;
                  //cout<<"SSSSSSSSSSSSSS";
                  F=make_pair(GC[i][ic],i);
                  rode[F]=0;
                }
                if(dis[i]==dis[GC[i][ic]]+1)
                    first=0;

           }
       }
       cout<<de.size()<<endl;
       for(int i=0;i<de.size();i++)
        cout<<de[i]<<' ';
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define endl           '\n'
#define LL             long long
#define ULL            unsigned long long
#define all(x)         x.begin(), x.end()

const int INF = (int) 1e7;
const int N = (int) 3e5 + 5;

int n, k, d, res;
int dis[N], belong[N], used[N];
vector < pair <int, int> > g[N];

int dfs(int u, int p = -1) {
    if (dis[u] != INF and ~p) {
        return dis[u] + 1;
    }
    for (auto i : g[u]) {
        int v = i.first;
        int id = i.second;
        if (v == p) continue;
        int ret = dfs(v, u);
        if (dis[u] > ret) {
            dis[u] = ret;
            belong[u] = id;
        }
    }
    return dis[u] + 1;
}

int main() {
    freopen("input_E.txt", "r", stdin);
    fill(dis, dis + N, INF);
    scanf("%d%d%d", &n, &k, &d);
    for (int i = 0, x; i < k; i++) {
        scanf("%d", &x);
        belong[x] = 0, dis[x] = 0;
    }
    for (int i = 1; i < n; i++) {
        int u, v;
        scanf("%d%d", &u, &v);
        g[u].push_back({v, i});
        g[v].push_back({u, i});
    }
    for (int i = 1; i <= n; i++) {
        if (dis[i]) dfs(i);
    }
    for (int i = 1; i <= n; i++) {
        used[belong[i]] = 1;
    }
    int res = k - 1;
    printf("%d\n", res);
    for (int i = 1; i < n; i++) {
        if (used[i]) continue;
        printf("%d%c", i, res > 1 ? ' ' : '\n');
        res--;
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define endl           '\n'
#define LL             long long
#define ULL            unsigned long long
#define all(x)         x.begin(), x.end()

const LL MOD = 1000000007;
const LL LINF = 0x3f3f3f3f3f3f3f3fLL;
const int INF = 0x3f3f3f3f;
const int N = 3e5 + 5;

int n, k, d, res;
vector < pair <int, int> > g[N];
int p[N], isp[N], used[N], belong[N];

void dfs(int u, int par = -1, int curr_d = 0) {
    for (auto i : g[u]) {
        int v = i.first;
        int id = i.second;
        if (v == par or belong[v] or isp[v]) continue;
        belong[v] = u, used[id] = 1;
        if (curr_d + 2 <= d) dfs(v, u, curr_d + 1);
    }
}

int main() {
    scanf("%d%d%d", &n, &k, &d);
    for (int i = 0; i < k; i++) {
        scanf("%d", p + i);
        isp[p[i]] = true;
    }
    for (int i = 1; i < n; i++) {
        int u, v;
        scanf("%d%d", &u, &v);
        g[u].push_back({v, i});
        g[v].push_back({u, i});
    }
    for (int i = 0; i < k; i++) dfs(p[i]);
    for (int i = 1; i < n; i++) {
        if (!used[i]) res++;
    }
    printf("%d\n", res);
    for (int i = 1; i < n; i++) {
        if (!used[i]) {
            printf("%d%c", i, res > 1 ? ' ' : '\n');
            res--;
        }
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define endl           '\n'
#define LL             long long
#define ULL            unsigned long long
#define all(x)         x.begin(), x.end()

const int INF = (int) 1e7;
const int N = (int) 3e5 + 5;

int n, m, k, d, res;
int dis[N], belong[N], used[N];
vector < pair <int, int> > g[N];

int dfs(int u, int p = -1, int _d = d) {
    if (dis[u] != INF and ~p) {
        return dis[u] + 1;
    }
    if (!(--_d)) return INF;
    for (auto i : g[u]) {
        int v = i.first;
        int id = i.second;
        if (v == p) continue;
        int ret = dfs(v, u, d);
        if (dis[u] > ret) {
            dis[u] = ret;
            belong[u] = id;
        }
    }
    return dis[u] + 1;
}

int main() {
    fill(dis, dis + N, INF);
    scanf("%d%d%d", &n, &k, &d);
    for (int i = 0, x; i < k; i++) {
        scanf("%d", &x);
        if (dis[x] == INF) m++;
        belong[x] = 0, dis[x] = 0;
    }
    for (int i = 1; i < n; i++) {
        int u, v;
        scanf("%d%d", &u, &v);
        g[u].push_back({v, i});
        g[v].push_back({u, i});
    }
    for (int i = 1; i <= n; i++) {
        if (dis[i]) dfs(i);
    }
    for (int i = 1; i <= n; i++) {
        used[belong[i]] = 1;
    }
    int res = m - 1;
    printf("%d\n", res);
    for (int i = 1; i < n; i++) {
        if (used[i]) continue;
        printf("%d%c", i, res > 1 ? ' ' : '\n');
        res--;
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define endl           '\n'
#define LL             long long
#define ULL            unsigned long long
#define all(x)         x.begin(), x.end()

const int INF = (int) 1e7;
const int N = (int) 3e5 + 5;

int n, m, k, d, res;
int dis[N], belong[N], used[N];
vector < pair <int, int> > g[N];

int dfs(int u, int p = -1, int _d = d) {
    if (dis[u] != INF and ~p) {
        return dis[u] + 1;
    }
    if (!(--_d)) return INF;
    for (auto i : g[u]) {
        int v = i.first;
        int id = i.second;
        if (v == p) continue;
        int ret = dfs(v, u, _d);
        if (dis[u] > ret) {
            dis[u] = ret;
            belong[u] = id;
        }
    }
    return dis[u] + 1;
}

int main() {
    fill(dis, dis + N, INF);
    scanf("%d%d%d", &n, &k, &d);
    for (int i = 0, x; i < k; i++) {
        scanf("%d", &x);
        if (dis[x] == INF) m++;
        belong[x] = 0, dis[x] = 0;
    }
    for (int i = 1; i < n; i++) {
        int u, v;
        scanf("%d%d", &u, &v);
        g[u].push_back({v, i});
        g[v].push_back({u, i});
    }
    for (int i = 1; i <= n; i++) {
        if (dis[i]) dfs(i);
    }
    for (int i = 1; i <= n; i++) {
        used[belong[i]] = 1;
    }
    int res = m - 1;
    printf("%d\n", res);
    for (int i = 1; i < n; i++) {
        if (used[i]) continue;
        printf("%d%c", i, res > 1 ? ' ' : '\n');
        res--;
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define endl           '\n'
#define LL             long long
#define ULL            unsigned long long
#define all(x)         x.begin(), x.end()

const int INF = (int) 1e7;
const int N = (int) 3e5 + 5;

int n, m, k, d, res;
int dis[N], belong[N], used[N];
vector < pair <int, int> > g[N];

int dfs(int u, int p = -1, int _d = d) {
    if (~p) _d--;
    if (dis[u] != INF and ~p) {
        return dis[u] + 1;
    }
    if (!_d) return INF;
    for (auto i : g[u]) {
        int v = i.first;
        int id = i.second;
        if (v == p) continue;
        int ret = dfs(v, u, _d);
        if (dis[u] > ret) {
            dis[u] = ret;
            belong[u] = id;
        }
    }
    return dis[u] + 1;
}

int main() {
    fill(dis, dis + N, INF);
    scanf("%d%d%d", &n, &k, &d);
    for (int i = 0, x; i < k; i++) {
        scanf("%d", &x);
        if (dis[x] == INF) m++;
        belong[x] = 0, dis[x] = 0;
    }
    for (int i = 1; i < n; i++) {
        int u, v;
        scanf("%d%d", &u, &v);
        g[u].push_back({v, i});
        g[v].push_back({u, i});
    }
    for (int i = 1; i <= n; i++) {
        if (dis[i]) dfs(i);
    }
    for (int i = 1; i <= n; i++) {
        used[belong[i]] = 1;
    }
    int res = m - 1;
    printf("%d\n", res);
    for (int i = 1; i < n; i++) {
        if (used[i]) continue;
        printf("%d%c", i, res > 1 ? ' ' : '\n');
        res--;
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define endl           '\n'
#define LL             long long
#define ULL            unsigned long long
#define all(x)         x.begin(), x.end()

const int INF = (int) 1e7;
const int N = (int) 3e5 + 5;

int n, m, k, d, res;
int dis[N], belong[N], used[N];
vector < pair <int, int> > g[N];

int dfs(int u, int p = -1, int _d = d) {
    if (dis[u] != INF and ~p) {
        return dis[u] + 1;
    }
    if (!_d) return INF;
    for (auto i : g[u]) {
        int v = i.first;
        int id = i.second;
        if (v == p) continue;
        int ret = dfs(v, u);
        if (dis[u] > ret) {
            dis[u] = ret;
            belong[u] = id;
        }
    }
    return dis[u] + 1;
}

int main() {
    fill(dis, dis + N, INF);
    scanf("%d%d%d", &n, &k, &d);
    for (int i = 0, x; i < k; i++) {
        scanf("%d", &x);
        if (dis[x] == INF) m++;
        belong[x] = 0, dis[x] = 0;
    }
    for (int i = 1; i < n; i++) {
        int u, v;
        scanf("%d%d", &u, &v);
        g[u].push_back({v, i});
        g[v].push_back({u, i});
    }
    for (int i = 1; i <= n; i++) {
        if (dis[i]) dfs(i);
    }
    for (int i = 1; i <= n; i++) {
        used[belong[i]] = 1;
    }
    int res = m - 1;
    printf("%d\n", res);
    for (int i = 1; i < n; i++) {
        if (used[i]) continue;
        printf("%d%c", i, res > 1 ? ' ' : '\n');
        res--;
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define endl           '\n'
#define LL             long long
#define ULL            unsigned long long
#define all(x)         x.begin(), x.end()

const int INF = (int) 1e7;
const int N = (int) 3e5 + 5;

int n, m, k, d, res;
int road[N], used[N];
queue < pair <int, int> > q;
vector < pair <int, int> > g[N];

void bfs() {
    while (!q.empty()) {
        int u = q.front().first;
        int p = q.front().second;
        q.pop();
        if (used[u]) continue;
        used[u] = true;
        for (auto i : g[u]) {
            int v = i.first, r = i.second;
            if (v == p) continue;
            if (used[v]) road[r] = 1;
            else q.push({v, u});
        }
    }
}

int main() {
    scanf("%d%d%d", &n, &k, &d);
    for (int i = 0, x; i < k; i++) {
        scanf("%d", &x);
        q.push({x, -1});
    }
    for (int i = 1; i < n; i++) {
        int u, v;
        scanf("%d%d", &u, &v);
        g[u].push_back({v, i});
        g[v].push_back({u, i});
    }
    bfs();
    for (int i = 1; i < n; i++) res += road[i];
    printf("%d\n", res);
    for (int i = 1; i < n; i++) {
        if (!road[i]) continue;
        res--;
        printf("%d%c", i, res ? ' ' : '\n');
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define endl           '\n'
#define LL             long long
#define ULL            unsigned long long
#define all(x)         x.begin(), x.end()

const int INF = (int) 1e7;
const int N = (int) 3e5 + 5;

int n, k, d, res;
int dis[N], belong[N], used[N];
vector < pair <int, int> > g[N];

int dfs(int u, int p = -1) {
    if (dis[u] != INF and ~p) {
        return dis[u] + 1;
    }
    for (auto i : g[u]) {
        int v = i.first;
        int id = i.second;
        if (v == p) continue;
        int ret = dfs(v, u);
        if (dis[u] > ret) {
            dis[u] = ret;
            belong[u] = id;
        }
    }
    return dis[u] + 1;
}

int main() {
    fill(dis, dis + N, INF);
    scanf("%d%d%d", &n, &k, &d);
    for (int i = 0, x; i < k; i++) {
        scanf("%d", &x);
        belong[x] = 0, dis[x] = 0;
    }
    for (int i = 1; i < n; i++) {
        int u, v;
        scanf("%d%d", &u, &v);
        g[u].push_back({v, i});
        g[v].push_back({u, i});
    }
    for (int i = 1; i <= n; i++) {
        if (dis[i]) dfs(i);
    }
    for (int i = 1; i <= n; i++) {
        used[belong[i]] = 1;
    }
    int res = k - 1;
    printf("%d\n", res);
    for (int i = 1; i < n; i++) {
        if (used[i]) continue;
        printf("%d%c", i, res > 1 ? ' ' : '\n');
        res--;
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define endl           '\n'
#define LL             long long
#define ULL            unsigned long long
#define all(x)         x.begin(), x.end()

const int INF = (int) 1e7;
const int N = (int) 3e5 + 5;

int n, m, k, d, res;
int dis[N], belong[N], used[N];
vector < pair <int, int> > g[N];

int dfs(int u, int p = -1, int _d = d) {
    if (dis[u] != INF and ~p) {
        return dis[u] + 1;
    }
    if (!(--_d)) return INF;
    for (auto i : g[u]) {
        int v = i.first;
        int id = i.second;
        if (v == p) continue;
        int ret = dfs(v, u);
        if (dis[u] > ret) {
            dis[u] = ret;
            belong[u] = id;
        }
    }
    return dis[u] + 1;
}

int main() {
    fill(dis, dis + N, INF);
    scanf("%d%d%d", &n, &k, &d);
    for (int i = 0, x; i < k; i++) {
        scanf("%d", &x);
        if (dis[x] == INF) m++;
        belong[x] = 0, dis[x] = 0;
    }
    for (int i = 1; i < n; i++) {
        int u, v;
        scanf("%d%d", &u, &v);
        g[u].push_back({v, i});
        g[v].push_back({u, i});
    }
    for (int i = 1; i <= n; i++) {
        if (dis[i]) dfs(i);
    }
    for (int i = 1; i <= n; i++) {
        used[belong[i]] = 1;
    }
    int res = m - 1;
    printf("%d\n", res);
    for (int i = 1; i < n; i++) {
        if (used[i]) continue;
        printf("%d%c", i, res > 1 ? ' ' : '\n');
        res--;
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define endl           '\n'
#define LL             long long
#define ULL            unsigned long long
#define all(x)         x.begin(), x.end()

const int INF = (int) 1e7;
const int N = (int) 3e5 + 5;

int n, m, k, d, res;
int road[N], used[N];
queue < pair <int, int> > q;
vector < pair <int, int> > g[N];

void bfs() {
    while (!q.empty()) {
        int u = q.front().first;
        int p = q.front().second;
        q.pop();
        for (auto i : g[u]) {
            int v = i.first;
            int r = i.second;
            if (v == p) continue;
            if (used[v]) road[r] = 1;
            else {
                used[v] = true;
                q.push({v, u});
            }
        }
    }
}

int main() {
    scanf("%d%d%d", &n, &k, &d);
    for (int i = 0, x; i < k; i++) {
        scanf("%d", &x);
        used[x] = 1;
        q.push({x, -1});
    }
    for (int i = 1; i < n; i++) {
        int u, v;
        scanf("%d%d", &u, &v);
        g[u].push_back({v, i});
        g[v].push_back({u, i});
    }
    bfs();
    for (int i = 1; i < n; i++) res += road[i];
    printf("%d\n", res);
    for (int i = 1; i < n; i++) {
        if (!road[i]) continue;
        res--;
        printf("%d%c", i, res ? ' ' : '\n');
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define endl           '\n'
#define LL             long long
#define ULL            unsigned long long
#define all(x)         x.begin(), x.end()

const int INF = (int) 1e7;
const int N = (int) 3e5 + 5;

int n, m, k, d, res;
int dis[N], belong[N], used[N];
vector < pair <int, int> > g[N];

int dfs(int u, int p = -1) {
    if (dis[u] != INF and ~p) {
        return dis[u] + 1;
    }
    for (auto i : g[u]) {
        int v = i.first;
        int id = i.second;
        if (v == p) continue;
        int ret = dfs(v, u);
        if (dis[u] > ret) {
            dis[u] = ret;
            belong[u] = id;
        }
    }
    return dis[u] + 1;
}

int main() {
    fill(dis, dis + N, INF);
    scanf("%d%d%d", &n, &k, &d);
    for (int i = 0, x; i < k; i++) {
        scanf("%d", &x);
        if (dis[x] == INF) m++;
        belong[x] = 0, dis[x] = 0;
    }
    for (int i = 1; i < n; i++) {
        int u, v;
        scanf("%d%d", &u, &v);
        g[u].push_back({v, i});
        g[v].push_back({u, i});
    }
    for (int i = 1; i <= n; i++) {
        if (dis[i]) dfs(i);
    }
    for (int i = 1; i <= n; i++) {
        used[belong[i]] = 1;
    }
    int res = m - 1;
    printf("%d\n", res);
    for (int i = 1; i < n; i++) {
        if (used[i]) continue;
        printf("%d%c", i, res > 1 ? ' ' : '\n');
        res--;
    }
    return 0;
}


/*input
5 5 1
1 2 3 4 5
1 2
2 3
3 4
4 5
*/
//IT TAKES EVERYTHING
#include <bits/stdc++.h>
#define endl '\n'
#define fo(i,n) for(i=0;i<n;++i)
#define forr(i,n) for(i=n-1;i>=0;--i)
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;

const int MAXN = 3e5+5;
const int INF = 1e8;
int n, k, d;
int dist[MAXN];
deque<int>police;
vector<int>adj[MAXN];
int x[MAXN], y[MAXN];
bool used[MAXN];

void init(){
	for(int i=0;i<MAXN;++i)
		dist[i] = INF;
}

// bool check(){
// 	for(int i=0;i<n;++i)
// 		if(!used[i])
// 			return true;
// 	return false;
// }

int main(){
	init();
	scanf("%d%d%d",&n,&k,&d);
	int i, pooh;
	fo(i,k){
		cin>>pooh;
		police.push_back(pooh);
		used[pooh] = true;
		dist[pooh] = 0;
	}
	fo(i,n-1){
		scanf("%d%d",x+i,y+i);
		adj[x[i]].push_back(y[i]);
		adj[y[i]].push_back(x[i]);
	}

	while(police.size()>0){
		int top = police.front();
		police.pop_front();
		for(size_t it = 0; it < adj[top].size() ; ++it){
			if(!used[adj[top][it]]){
				used[adj[top][it]] = true;
				dist[adj[top][it]] = min(dist[adj[top][it]],dist[top] + 1);
				police.push_back(adj[top][it]);
			}
		}
	}

	//final answer
	ll ct = 0;
	for(i=0;i<n-1;i++)
		if(dist[x[i]]==dist[y[i]])
			ct++;
	printf("%d\n",ct);
	for(i=0;i<n-1;i++)
		if(dist[x[i]]==dist[y[i]])
			printf("%d ",i+1);
	printf("\n");

	return 0;
}


/*input
5 5 1
1 2 2 3 4
1 2
2 3
3 4
4 5
*/
//IT TAKES EVERYTHING
#include <bits/stdc++.h>
#define endl '\n'
#define fo(i,n) for(i=0;i<n;++i)
#define forr(i,n) for(i=n-1;i>=0;--i)
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;

const int MAXN = 3e5+5;
const int INF = 1e8;
int n, k, d;
int dist[MAXN];
deque<int>police;
vector<int>adj[MAXN];
int x[MAXN], y[MAXN];
bool used[MAXN];

void init(){
	for(int i=0;i<MAXN;++i)
		dist[i] = INF;
}

// bool check(){
// 	for(int i=0;i<n;++i)
// 		if(!used[i])
// 			return true;
// 	return false;
// }

int main(){
	init();
	scanf("%d%d%d",&n,&k,&d);
	int i, pooh;
	fo(i,k){
		cin>>pooh;
		if(used[pooh])
			continue;
		police.push_back(pooh);
		used[pooh] = true;
		dist[pooh] = 0;
	}
	sort(police.begin(),police.end());
	fo(i,n-1){
		scanf("%d%d",x+i,y+i);
		adj[x[i]].push_back(y[i]);
		adj[y[i]].push_back(x[i]);
	}

	while(police.size()>0){
		int top = police.front();
		police.pop_front();
		for(size_t it = 0; it < adj[top].size() ; ++it){
			if(!used[adj[top][it]]){
				used[adj[top][it]] = true;
				dist[adj[top][it]] = min(dist[adj[top][it]],dist[top] + 1);
				police.push_back(adj[top][it]);
			}
		}
	}

	//final answer
	ll ct = 0;
	for(i=0;i<n-1;i++)
		if(dist[x[i]]==dist[y[i]])
			ct++;
	printf("%d\n",ct);
	for(i=0;i<n-1;i++)
		if(dist[x[i]]==dist[y[i]])
			printf("%d ",i+1);
	printf("\n");

	return 0;
}


/*input
5 5 1
1 2 3 4 5
1 2
2 3
3 4
4 5
*/
//IT TAKES EVERYTHING
#include <bits/stdc++.h>
#define endl '\n'
#define fo(i,n) for(i=0;i<n;++i)
#define forr(i,n) for(i=n-1;i>=0;--i)
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;

const int MAXN = 3e5+5;
const int INF = 1e8;
int n, k, d;
int dist[MAXN];
deque<int>police;
vector<int>adj[MAXN];
int x[MAXN], y[MAXN];
bool used[MAXN];

void init(){
	for(int i=0;i<MAXN;++i)
		dist[i] = INF;
}

// bool check(){
// 	for(int i=0;i<n;++i)
// 		if(!used[i])
// 			return true;
// 	return false;
// }

int main(){
	init();
	scanf("%d%d%d",&n,&k,&d);
	int i, pooh;
	fo(i,k){
		cin>>pooh;
		police.push_back(pooh);
		used[pooh] = true;
		dist[pooh] = 0;
	}
	sort(pooh.begin(),pooh.end());
	fo(i,n-1){
		scanf("%d%d",x+i,y+i);
		adj[x[i]].push_back(y[i]);
		adj[y[i]].push_back(x[i]);
	}

	while(police.size()>0){
		int top = police.front();
		police.pop_front();
		for(size_t it = 0; it < adj[top].size() ; ++it){
			if(!used[adj[top][it]]){
				used[adj[top][it]] = true;
				dist[adj[top][it]] = min(dist[adj[top][it]],dist[top] + 1);
				police.push_back(adj[top][it]);
			}
		}
	}

	//final answer
	ll ct = 0;
	for(i=0;i<n-1;i++)
		if(dist[x[i]]==dist[y[i]])
			ct++;
	printf("%d\n",ct);
	for(i=0;i<n-1;i++)
		if(dist[x[i]]==dist[y[i]])
			printf("%d ",i+1);
	printf("\n");

	return 0;
}


/*input
6 2 4
1 6
1 2
2 3
3 4
4 5
5 6
*/
//IT TAKES EVERYTHING
#include <bits/stdc++.h>
#define endl '\n'
#define fo(i,n) for(i=0;i<n;++i)
#define forr(i,n) for(i=n-1;i>=0;--i)
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;

const int MAXN = 3e5+5;
const int INF = 1e8;
int n, k, d;
int dist[MAXN];
deque<int>police;
vector<int>adj[MAXN];
int x[MAXN], y[MAXN];
bool used[MAXN];

void init(){
	for(int i=0;i<MAXN;++i)
		dist[i] = INF;
}

// bool check(){
// 	for(int i=0;i<n;++i)
// 		if(!used[i])
// 			return true;
// 	return false;
// }

int main(){
	init();
	scanf("%d%d%d",&n,&k,&d);
	int i, pooh;
	fo(i,k){
		cin>>pooh;
		police.push_back(pooh);
		used[pooh] = true;
		dist[pooh] = 0;
	}
	fo(i,n-1){
		scanf("%d%d",x+i,y+i);
		adj[x[i]].push_back(y[i]);
		adj[y[i]].push_back(x[i]);
	}

	while(police.size()>0){
		int top = police.front();
		police.pop_front();
		for(size_t it = 0; it < adj[top].size() ; ++it){
			if(!used[adj[top][it]]){
				used[adj[top][it]] = true;
				dist[adj[top][it]] = min(dist[adj[top][it]],dist[top] + 1);
				police.push_back(adj[top][it]);
			}
		}
	}

	//final answer
	ll ct = 0;
	for(i=0;i<n-1;i++)
		if(dist[x[i]]==dist[y[i]])
			ct++;
	printf("%d\n",ct);
	for(i=0;i<n-1;i++)
		if(dist[x[i]]==dist[y[i]])
			printf("%d ",i+1);
	printf("\n");

	return 0;
}


/*input
6 2 4
1 6
1 2
2 3
3 4
4 5
5 6
*/
//IT TAKES EVERYTHING
#include <bits/stdc++.h>
#define endl '\n'
#define fo(i,n) for(i=0;i<n;++i)
#define forr(i,n) for(i=n-1;i>=0;--i)
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;

const int MAXN = 3e5+5;
const int INF = 1e8;
int n, k, d;
int dist[MAXN];
deque<int>police;
vector<int>adj[MAXN];
int x[MAXN], y[MAXN];
bool used[MAXN];

void init(){
	for(int i=0;i<MAXN;++i)
		dist[i] = INF;
}

// bool check(){
// 	for(int i=0;i<n;++i)
// 		if(!used[i])
// 			return true;
// 	return false;
// }

int main(){
	init();
	cin>>n>>k>>d;
	int i, pooh;
	fo(i,k){
		cin>>pooh;
		police.push_back(pooh);
		used[pooh] = true;
		dist[pooh] = 0;
	}
	fo(i,n-1){
		cin>>x[i]>>y[i];
		adj[x[i]].push_back(y[i]);
		adj[y[i]].push_back(x[i]);
	}

	while(police.size()>0){
		int top = police.front();
		police.pop_front();
		for(size_t it = 0; it < adj[top].size() ; ++it){
			if(!used[adj[top][it]]){
				used[adj[top][it]] = true;
				dist[adj[top][it]] = min(dist[adj[top][it]],dist[top] + 1);
				police.push_back(adj[top][it]);
			}
		}
	}

	//final answer
	ll ct = 0;
	for(i=0;i<n-1;i++)
		if(dist[x[i]]==dist[y[i]])
			ct++;
	cout<<ct<<endl;
	for(i=0;i<n-1;i++)
		if(dist[x[i]]==dist[y[i]])
			cout<<i+1<<" ";
	cout<<endl;

	return 0;
}


/*input
5 5 1
1 2 3 4 5
1 2
2 3
3 4
4 5
*/
//IT TAKES EVERYTHING
#include <bits/stdc++.h>
#define endl '\n'
#define fo(i,n) for(i=0;i<n;++i)
#define forr(i,n) for(i=n-1;i>=0;--i)
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;

const int MAXN = 3e5+5;
const int INF = 1e8;
int n, k, d;
int dist[MAXN];
deque<int>police;
vector<int>adj[MAXN];
int x[MAXN], y[MAXN];
bool used[MAXN];

void init(){
	for(int i=0;i<MAXN;++i)
		dist[i] = INF;
}

// bool check(){
// 	for(int i=0;i<n;++i)
// 		if(!used[i])
// 			return true;
// 	return false;
// }

int main(){
	init();
	scanf("%d%d%d",&n,&k,&d);
	int i, pooh;
	fo(i,k){
		cin>>pooh;
		police.push_back(pooh);
		used[pooh] = true;
		dist[pooh] = 0;
	}
	sort(police.begin(),police.end());
	fo(i,n-1){
		scanf("%d%d",x+i,y+i);
		adj[x[i]].push_back(y[i]);
		adj[y[i]].push_back(x[i]);
	}

	while(police.size()>0){
		int top = police.front();
		police.pop_front();
		for(size_t it = 0; it < adj[top].size() ; ++it){
			if(!used[adj[top][it]]){
				used[adj[top][it]] = true;
				dist[adj[top][it]] = min(dist[adj[top][it]],dist[top] + 1);
				police.push_back(adj[top][it]);
			}
		}
	}

	//final answer
	ll ct = 0;
	for(i=0;i<n-1;i++)
		if(dist[x[i]]==dist[y[i]])
			ct++;
	printf("%d\n",ct);
	for(i=0;i<n-1;i++)
		if(dist[x[i]]==dist[y[i]])
			printf("%d ",i+1);
	printf("\n");

	return 0;
}


/*input
11 1 5
6
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
*/
//IT TAKES EVERYTHING
#include <bits/stdc++.h>
#define endl '\n'
#define fo(i,n) for(i=0;i<n;++i)
#define forr(i,n) for(i=n-1;i>=0;--i)
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;

const int MAXN = 3e5+5;
const int INF = 1e8;
int n, k, d;
int dist[MAXN];
deque<int>police;
vector<int>adj[MAXN];
// vector<pair<int,int>>helik;
map<pair<int,int>,bool>helik;
map<pair<int,int>,bool>check;
map<pair<int,int>,bool>::iterator it;
int x[MAXN], y[MAXN];

bool used[MAXN];

void init(){
	for(int i=0;i<MAXN;++i)
		dist[i] = INF;
}

// bool check(){
// 	for(int i=0;i<n;++i)
// 		if(!used[i])
// 			return true;
// 	return false;
// }

int main(){
	init();
	scanf("%d%d%d",&n,&k,&d);
	int i, pooh, hx, hy;
	fo(i,k){
		cin>>pooh;
		if(used[pooh])
			continue;
		police.push_back(pooh);
		used[pooh] = true;
		dist[pooh] = 0;
	}
	// sort(police.begin(),police.end());
	fo(i,n-1){
		scanf("%d%d",&hx,&hy);
		x[i] = min(hx,hy);
		y[i] = max(hx,hy);
		adj[x[i]].push_back(y[i]);
		adj[y[i]].push_back(x[i]);
	}

	while(police.size()>0){
		int top = police.front();
		police.pop_front();
		for(size_t its = 0; its < adj[top].size() ; ++its){
			if(!used[adj[top][its]]){
				used[adj[top][its]] = true;
				dist[adj[top][its]] = min(dist[adj[top][its]],dist[top] + 1);
				police.push_back(adj[top][its]);
			}
			else{
				hx = min(top,adj[top][its]);
				hy = max(top,adj[top][its]);
				pair<int,int>pai = make_pair(hx,hy);
				it = helik.begin();
				it = helik.find(pai);
				if(it==helik.end()){
					helik.insert(make_pair(pai,true));
				}
				else{
					check.insert(make_pair(pai,true));
				}
			}
		}
	}

	vector<int>answer;

	for(i=0;i<n-1;i++){
		pair<int,int>yo = make_pair(x[i],y[i]);
		it = check.begin();
		it = check.find(yo);
		if(it==check.end())
			continue;
		check.erase(it);
		answer.push_back(i+1);
	}

	// cout<<"hefjokef"<<endl;
	cout<<answer.size()<<endl;
	fo(i,answer.size())
		printf("%d ",answer[i]);
	printf("\n");
	return 0;
}


//Author:CookiC
//#include"stdafx.h"
#include<iostream>
#include<vector>
#include<map>
#define INF 0x7FFFFFFF
#define maxn 300010
#define MP make_pair
//#pragma warning(disable : 4996)
using namespace std;

bool QIn(int &x){
	char c;
	while((c=getchar())!=EOF&&!isdigit(c));
	if(c==EOF)
		return false;
	x=0;
	do{
		x*=10;
		x+=c-'0';
	}while((c=getchar())!=EOF&&isdigit(c));
	return true;
}

void QOut(int x){
	char str[13];
	if(x){
		int i;
		for(i=0;x;++i){
			str[i]=x%10+'0';
			x/=10;
		}
		while(i--)
			putchar(str[i]);
	}
	else
		putchar('0');
}

int n,k,d;
int F[maxn],D[maxn],p[maxn];
vector<int> G[maxn];
map<pair<int,int>,int> m;

void Partition(int u,int f){
	for(auto &v:G[u])
		if(v!=f&&D[v]>D[u]+1){
			D[v]=D[u]+1;
			F[v]=F[u];
			Partition(v,u);
		}
}

int ans=0;
vector<int> s;

void Dfs(int u,int f){
	for(auto &v:G[u])
		if(v!=f){
			if(F[u]!=F[v]){
				++ans;
				s.push_back(m[MP(min(u,v),max(u,v))]);
			}
			Dfs(v,u);
		}
}

int main(){
//	freopen("test.in","r",stdin);
//	freopen("test.out","w",stdout);
//	ios::sync_with_stdio(false);

	int i,u,v;
	QIn(n);
	QIn(k);
	QIn(d);
	for(i=1;i<=n;++i)
		D[i]=INF;
	for(i=0;i<k;++i){
		QIn(p[i]);
		F[p[i]]=p[i];
		D[p[i]]=0;
	}
	for(i=1;i<=n-1;++i){
		QIn(u);
		QIn(v);
		if(u>v)
			swap(u,v);
		m[MP(u,v)]=i;
		G[u].push_back(v);
		G[v].push_back(u);
	}
	for(i=0;i<k;++i)
		Partition(p[i],-1);
	Dfs(1,-1);
	QOut(ans);putchar('\n');
	for(auto &e:s){
		QOut(e);
		putchar(' ');
	}
	putchar('\n');
	return 0;
}


//Author:CookiC
//#include"stdafx.h"
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#define INF 0x7FFFFFFF
#define maxn 300010
#define MP make_pair
//#pragma warning(disable : 4996)
using namespace std;

bool QIn(int &x){
	char c;
	while((c=getchar())!=EOF&&!isdigit(c));
	if(c==EOF)
		return false;
	x=0;
	do{
		x*=10;
		x+=c-'0';
	}while((c=getchar())!=EOF&&isdigit(c));
	return true;
}

void QOut(int x){
	char str[13];
	if(x){
		int i;
		for(i=0;x;++i){
			str[i]=x%10+'0';
			x/=10;
		}
		while(i--)
			putchar(str[i]);
	}
	else
		putchar('0');
}

int n,k,d;
int F[maxn],D[maxn],p[maxn];
vector<int> G[maxn];
map<pair<int,int>,int> m;

void Partition(int u,int f){
	if(D[u]>=d)
		return;
	for(auto &v:G[u])
		if(v!=f&&D[v]>D[u]+1){
			D[v]=D[u]+1;
			F[v]=F[u];
			Partition(v,u);
		}
}

int ans=0;
vector<int> s;

void Dfs(int u,int f){
	for(auto &v:G[u])
		if(v!=f){
			if(F[u]!=F[v]){
				++ans;
				s.push_back(m[MP(min(u,v),max(u,v))]);
			}
			Dfs(v,u);
		}
}

int main(){
//	freopen("test.in","r",stdin);
//	freopen("test.out","w",stdout);
//	ios::sync_with_stdio(false);

	int i,u,v;
	QIn(n);
	QIn(k);
	QIn(d);
	for(i=1;i<=n;++i)
		D[i]=INF;
	for(i=0;i<k;++i){
		QIn(p[i]);
		F[p[i]]=p[i];
		D[p[i]]=0;
	}
	for(i=1;i<=n-1;++i){
		QIn(u);
		QIn(v);
		if(u>v)
			swap(u,v);
		m[MP(u,v)]=i;
		G[u].push_back(v);
		G[v].push_back(u);
	}
	random_shuffle(p,p+k);
	for(i=0;i<k;++i)
		Partition(p[i],-1);
	Dfs(1,-1);
	QOut(ans);putchar('\n');
	for(auto &e:s){
		QOut(e);
		putchar(' ');
	}
	putchar('\n');
	return 0;
}


//Author:CookiC
//#include"stdafx.h"
#include<iostream>
#include<vector>
#include<map>
#define INF 0x7FFFFFFF
#define maxn 300010
#define MP make_pair
//#pragma warning(disable : 4996)
using namespace std;

bool QIn(int &x){
	char c;
	while((c=getchar())!=EOF&&!isdigit(c));
	if(c==EOF)
		return false;
	x=0;
	do{
		x*=10;
		x+=c-'0';
	}while((c=getchar())!=EOF&&isdigit(c));
	return true;
}

void QOut(int x){
	char str[13];
	if(x){
		int i;
		for(i=0;x;++i){
			str[i]=x%10+'0';
			x/=10;
		}
		while(i--)
			putchar(str[i]);
	}
	else
		putchar('0');
}

int n,k,d;
int F[maxn],D[maxn],p[maxn];
vector<int> G[maxn];
map<pair<int,int>,int> m;

void Partition(int u,int f){
	if(D[u]>=d)
		return;
	for(auto &v:G[u])
		if(v!=f&&D[v]>D[u]+1){
			D[v]=D[u]+1;
			F[v]=F[u];
			Partition(v,u);
		}
}

int ans=0;
vector<int> s;

void Dfs(int u,int f){
	for(auto &v:G[u])
		if(v!=f){
			if(F[u]!=F[v]){
				++ans;
				s.push_back(m[MP(min(u,v),max(u,v))]);
			}
			Dfs(v,u);
		}
}

int main(){
//	freopen("test.in","r",stdin);
//	freopen("test.out","w",stdout);
//	ios::sync_with_stdio(false);

	int i,u,v;
	QIn(n);
	QIn(k);
	QIn(d);
	for(i=1;i<=n;++i)
		D[i]=INF;
	for(i=0;i<k;++i){
		QIn(p[i]);
		F[p[i]]=p[i];
		D[p[i]]=0;
	}
	for(i=1;i<=n-1;++i){
		QIn(u);
		QIn(v);
		if(u>v)
			swap(u,v);
		m[MP(u,v)]=i;
		G[u].push_back(v);
		G[v].push_back(u);
	}
	random_shuffle(p,p+k);
	for(i=0;i<k;++i)
		Partition(p[i],-1);
	Dfs(1,-1);
	QOut(ans);putchar('\n');
	for(auto &e:s){
		QOut(e);
		putchar(' ');
	}
	putchar('\n');
	return 0;
}


//Author:CookiC
//#include"stdafx.h"
#include<iostream>
#include<vector>
#include<map>
#define INF 0x7FFFFFFF
#define maxn 300010
#define MP make_pair
//#pragma warning(disable : 4996)
using namespace std;

int n,k,d;
int F[maxn],D[maxn],p[maxn];
vector<int> G[maxn];
map<pair<int,int>,int> m;

void Partition(int u,int f){
	for(auto &v:G[u])
		if(v!=f&&D[v]>D[u]+1){
			D[v]=D[u]+1;
			F[v]=F[u];
			Partition(v,u);
		}
}

int ans=0;
vector<int> s;

void Dfs(int u,int f){
	for(auto &v:G[u])
		if(v!=f){
			if(F[u]!=F[v]){
				++ans;
				s.push_back(m[MP(min(u,v),max(u,v))]);
			}
			Dfs(v,u);
		}
}

int main(){
//	freopen("test.in","r",stdin);
//	freopen("test.out","w",stdout);
	ios::sync_with_stdio(false);

	int i,u,v;
	cin>>n>>k>>d;
	for(i=1;i<=n;++i)
		D[i]=INF;
	for(i=0;i<k;++i){
		cin>>p[i];
		F[p[i]]=p[i];
		D[p[i]]=0;
	}
	for(i=1;i<=n-1;++i){
		cin>>u>>v;
		if(u>v)
			swap(u,v);
		m[MP(u,v)]=i;
		G[u].push_back(v);
		G[v].push_back(u);
	}
	for(i=0;i<k;++i)
		Partition(p[i],-1);
	Dfs(1,-1);
	cout<<ans<<endl;
	for(auto &e:s)
		cout<<e<<' ';
	cout<<endl;
	return 0;
}


//Author:CookiC
//#include"stdafx.h"
#include<iostream>
#include<vector>
#include<map>
#define INF 0x7FFFFFFF
#define maxn 300010
#define MP make_pair
//#pragma warning(disable : 4996)
using namespace std;

bool QIn(int &x){
	char c;
	while((c=getchar())!=EOF&&!isdigit(c));
	if(c==EOF)
		return false;
	x=0;
	do{
		x*=10;
		x+=c-'0';
	}while((c=getchar())!=EOF&&isdigit(c));
	return true;
}

void QOut(int x){
	char str[13];
	if(x){
		int i;
		for(i=0;x;++i){
			str[i]=x%10+'0';
			x/=10;
		}
		while(i--)
			putchar(str[i]);
	}
	else
		putchar('0');
}

int n,k,d;
int F[maxn],D[maxn],p[maxn];
vector<int> G[maxn];
map<pair<int,int>,int> m;

void Partition(int u,int f){
	if(D[u]>=d)
		return;
	for(auto &v:G[u])
		if(v!=f&&D[v]>D[u]+1){
			D[v]=D[u]+1;
			F[v]=F[u];
			Partition(v,u);
		}
}

int ans=0;
vector<int> s;

void Dfs(int u,int f){
	for(auto &v:G[u])
		if(v!=f){
			if(F[u]!=F[v]){
				++ans;
				s.push_back(m[MP(min(u,v),max(u,v))]);
			}
			Dfs(v,u);
		}
}

int main(){
//	freopen("test.in","r",stdin);
//	freopen("test.out","w",stdout);
//	ios::sync_with_stdio(false);

	int i,u,v;
	QIn(n);
	QIn(k);
	QIn(d);
	for(i=1;i<=n;++i)
		D[i]=INF;
	for(i=0;i<k;++i){
		QIn(p[i]);
		F[p[i]]=p[i];
		D[p[i]]=0;
	}
	for(i=1;i<=n-1;++i){
		QIn(u);
		QIn(v);
		if(u>v)
			swap(u,v);
		m[MP(u,v)]=i;
		G[u].push_back(v);
		G[v].push_back(u);
	}
	for(i=0;i<k;++i)
		Partition(p[i],-1);
	Dfs(1,-1);
	QOut(ans);putchar('\n');
	for(auto &e:s){
		QOut(e);
		putchar(' ');
	}
	putchar('\n');
	return 0;
}


//Author:CookiC
//#include"stdafx.h"
#include<iostream>
#include<vector>
#include<map>
#define INF 0x7FFFFFFF
#define maxn 300010
#define MP make_pair
//#pragma warning(disable : 4996)
using namespace std;

int n,k,d;
int F[maxn],D[maxn],p[maxn];
vector<int> G[maxn];
map<pair<int,int>,int> m;

void Partition(int u,int f){
	for(auto &v:G[u])
		if(v!=f&&D[v]>D[u]+1){
			D[v]=D[u]+1;
			F[v]=F[u];
			Partition(v,u);
		}
}

int ans=0;
vector<int> s;

void Dfs(int u,int f){
	for(auto &v:G[u])
		if(v!=f){
			if(F[u]!=F[v]){
				++ans;
				s.push_back(m[MP(min(u,v),max(u,v))]);
			}
			Dfs(v,u);
		}
}

int main(){
//	freopen("test.in","r",stdin);
//	freopen("test.out","w",stdout);
	ios::sync_with_stdio(false);

	int i,u,v;
	cin>>n>>k>>d;
	for(i=1;i<=n;++i)
		D[i]=INF;
	for(i=0;i<k;++i){
		cin>>p[i];
		F[p[i]]=p[i];
		D[p[i]]=0;
	}
	for(i=0;i<n-1;++i){
		cin>>u>>v;
		if(u>v)
			swap(u,v);
		m[MP(u,v)]=i;
		G[u].push_back(v);
		G[v].push_back(u);
	}
	for(i=0;i<k;++i)
		Partition(p[i],-1);
	Dfs(1,-1);
	cout<<ans<<endl;
	for(auto &e:s)
		cout<<e<<' ';
	cout<<endl;
	return 0;
}


#include <bits/stdc++.h>

using namespace std;
int n , k , d , p_s[510000] , vis[510000] , erase_road[510000] ;
vector< pair< int , int > > adj[510000] ;

void dfs( int nd , int len )
{
 //   if(len == d)return ;
    for( auto it : adj[nd] )
    {
        if( !vis[ it.first ] )
        {
            vis[ it.first ] = 1 ;
            erase_road[it.second] = 0 ;
            dfs( it.first , len+1 ) ;
        }
    }
}

int main()
{
    int a , b , ans = 0 ;
    scanf("%d" , &n) ;
    scanf("%d" , &k) ;
    scanf("%d" , &d) ;
    for( int i = 1 ; i <= k ; ++i )
    {
        scanf("%d" , &p_s[i]) ;
        vis[ p_s[i] ] = 1 ;
    }

    for( int i = 1 ; i <= n-1 ; ++i )
    {
        scanf("%d%d" , &a , &b) ;
        adj[a].push_back( {b ,i} ) ;
        adj[b].push_back( {a , i} ) ;
        erase_road[i] = 1 ;
    }
    for( int i = 1 ; i <= k ; ++i )dfs( p_s[i] , 0 ) ;

    for( int i = 1 ; i <= n - 1 ; ++i )
    {
        ans+=erase_road[i] ;
    }
    printf("%d\n" , ans) ;
    for( int i = 1 ; i <= n - 1 ; ++i )
        if( erase_road[i] )
            printf("%d " , i ) ;

    return 0;
}


#include <bits/stdc++.h>

using namespace std;
int n , k , d , p_s[510000] , vis[510000] , erase_road[510000] ;
vector< pair< int , int > > adj[510000] ;

void dfs( int nd , int len )
{
    if(len > d)return ;
    for( auto it : adj[nd] )
    {
        if( !vis[ it.first ] )
        {
            vis[ it.first ] = 1 ;
            erase_road[it.second] = 0 ;
            dfs( it.first , len+1 ) ;
        }
    }
}

int main()
{
    int a , b , ans = 0 ;
    scanf("%d" , &n) ;
    scanf("%d" , &k) ;
    scanf("%d" , &d) ;
    for( int i = 1 ; i <= k ; ++i )
    {
        scanf("%d" , &p_s[i]) ;
        vis[ p_s[i] ] = 1 ;
    }

    for( int i = 1 ; i <= n-1 ; ++i )
    {
        scanf("%d%d" , &a , &b) ;
        adj[a].push_back( {b ,i} ) ;
        adj[b].push_back( {a , i} ) ;
        erase_road[i] = 1 ;
    }
    for( int i = 1 ; i <= k ; ++i )dfs( p_s[i] , 0 ) ;

    for( int i = 1 ; i <= n - 1 ; ++i )
    {
        ans+=erase_road[i] ;
    }
    printf("%d\n" , ans) ;
    for( int i = 1 ; i <= n - 1 ; ++i )
        if( erase_road[i] )
            printf("%d " , i ) ;

    return 0;
}


#include <bits/stdc++.h>

using namespace std;
int n , k , d , p_s[510000] , vis[510000] , erase_road[510000] ;
vector< pair< int , int > > adj[510000] ;

void dfs( int nd , int len , int p )
{
 //   if(len == d)return ;
    for( auto it : adj[nd] )
    {
        if( it.first == p )continue ;
        if( !vis[ it.first ] )
        {
            vis[ it.first ] = 1 ;
            erase_road[it.second] = 0 ;
            dfs( it.first , len+1 , nd ) ;
        }
    }
}

int main()
{
    int a , b , ans = 0 ;
    scanf("%d" , &n) ;
    scanf("%d" , &k) ;
    scanf("%d" , &d) ;
    for( int i = 1 ; i <= k ; ++i )
    {
        scanf("%d" , &p_s[i]) ;
        vis[ p_s[i] ] = 1 ;
    }

    for( int i = 1 ; i <= n-1 ; ++i )
    {
        scanf("%d%d" , &a , &b) ;
        adj[a].push_back( {b ,i} ) ;
        adj[b].push_back( {a , i} ) ;
        erase_road[i] = 1 ;
    }
    for( int i = 1 ; i <= k ; ++i )dfs( p_s[i] , 0 , -1 ) ;

    for( int i = 1 ; i <= n - 1 ; ++i )
    {
        ans+=erase_road[i] ;
    }
    printf("%d\n" , ans) ;
    for( int i = 1 ; i <= n - 1 ; ++i )
        if( erase_road[i] )
            printf("%d " , i ) ;

    return 0;
}


#include <bits/stdc++.h>

using namespace std;
int n , k , d , p_s[510000] , vis[510000] , erase_road[510000] ;
vector< pair< int , int > > adj[510000] ;

void dfs( int nd , int len , int p )
{
    if(len == d)return ;
    for( auto it : adj[nd] )
    {
        if( it.first == p )continue ;
        if( vis[it.first] )
            erase_road[it.second] = 1 ;
        else
        {
            vis[ it.first ] = 1 ;
            dfs( it.first , len+1 , nd ) ;
        }
    }
}

int main()
{
    int a , b , ans = 0 ;
    scanf("%d" , &n) ;
    scanf("%d" , &k) ;
    scanf("%d" , &d) ;
    for( int i = 1 ; i <= k ; ++i )
    {
        scanf("%d" , &p_s[i]) ;
        vis[ p_s[i] ] = 1 ;
    }

    for( int i = 1 ; i <= n-1 ; ++i )
    {
        scanf("%d%d" , &a , &b) ;
        adj[a].push_back( {b ,i} ) ;
        adj[b].push_back( {a , i} ) ;
    }
    for( int i = 1 ; i <= k ; ++i )dfs( p_s[i] , 0 , -1 ) ;

    for( int i = 1 ; i <= n - 1 ; ++i )
    {
        ans+=erase_road[i] ;
    }
    printf("%d\n" , ans) ;
    for( int i = 1 ; i <= n - 1 ; ++i )
        if( erase_road[i] )
            printf("%d " , i ) ;

    return 0;
}


#include <bits/stdc++.h>

using namespace std;
int n , k , d , p_s[510000] , vis[510000] , erase_road[510000] ;
vector< pair< int , int > > adj[510000] ;

void dfs( int nd , int len , int p )
{
    if(len == d)return ;
    for( auto it : adj[nd] )
    {
        if( it.first == p )continue ;
        if( !vis[ it.first ] )
        {
            vis[ it.first ] = 1 ;
            erase_road[it.second] = 0 ;
            dfs( it.first , len+1 , nd ) ;
        }
    }
}

int main()
{
    int a , b , ans = 0 ;
    scanf("%d" , &n) ;
    scanf("%d" , &k) ;
    scanf("%d" , &d) ;
    for( int i = 1 ; i <= k ; ++i )
    {
        scanf("%d" , &p_s[i]) ;
        vis[ p_s[i] ] = 1 ;
    }

    for( int i = 1 ; i <= n-1 ; ++i )
    {
        scanf("%d%d" , &a , &b) ;
        adj[a].push_back( {b ,i} ) ;
        adj[b].push_back( {a , i} ) ;
        erase_road[i] = 1 ;
    }
    for( int i = 1 ; i <= k ; ++i )dfs( p_s[i] , 0 , -1 ) ;

    for( int i = 1 ; i <= n - 1 ; ++i )
    {
        ans+=erase_road[i] ;
    }
    printf("%d\n" , ans) ;
    for( int i = 1 ; i <= n - 1 ; ++i )
        if( erase_road[i] )
            printf("%d " , i ) ;

    return 0;
}


#include <bits/stdc++.h>

using namespace std;
int n , k , d , p_s , vis[510000] , erase_road[510000] ;
vector< pair< int , int > > adj[510000] ;
/*
we can't run dfs here because each node should belong

to the nearset p_s

7 2 3
1 2
1 5
5 6
7 5
2 3
3 4
4 5

*/

int main()
{
    queue< pair< int , int > > q ;
    int a , b , ans = 0 ;
    scanf("%d" , &n) ;
    scanf("%d" , &k) ;
    scanf("%d" , &d) ;
    for( int i = 1 ; i <= k ; ++i )
    {
        scanf("%d" , &p_s) ;
        vis[ p_s ] = 1 ;
        q.push( {p_s , 0} ) ;
    }
    for( int i = 1 ; i <= n-1 ; ++i )
    {
        scanf("%d%d" , &a , &b) ;
        adj[a].push_back( {b ,i} ) ;
        adj[b].push_back( {a , i} ) ;
        erase_road[i] = 1 ;
    }

    while( !q.empty() )
    {
        int nd = q.front().first ;
        int D = q.front().second ;
        q.pop() ;
        if( D == d )continue ;
        for( auto it : adj[nd] )
        {
            if( !vis[ it.first ] )
            {
                vis[ it.first ] = 1 ;
                erase_road[it.second] = 0 ;
                q.push( {it.first ,D+1} ) ;
            }
        }
    }

    for( int i = 1 ; i <= n - 1 ; ++i )
        ans+=erase_road[i] ;
    printf("%d\n" , ans) ;
    for( int i = 1 ; i <= n - 1 ; ++i )
        if( erase_road[i] )
            printf("%d " , i ) ;

    return 0;
}


#include <bits/stdc++.h>

using namespace std;
int n , k , d , p_s , vis[510000] , erase_road[510000] ;
vector< pair< int , int > > adj[510000] ;
/*
we can't run dfs here because each node should belong

to the nearset p_s

7 2 3
1 2
1 5
5 6
7 5
2 3
3 4
4 5

*/

int main()
{
    queue< int > q ;
    int a , b , ans = 0 ;
    scanf("%d" , &n) ;
    scanf("%d" , &k) ;
    scanf("%d" , &d) ;
    for( int i = 1 ; i <= k ; ++i )
    {
        scanf("%d" , &p_s) ;
        vis[ p_s ] = 1 ;
        q.push( p_s ) ;
    }
    for( int i = 1 ; i <= n-1 ; ++i )
    {
        scanf("%d%d" , &a , &b) ;
        adj[a].push_back( {b ,i} ) ;
        adj[b].push_back( {a , i} ) ;
        erase_road[i] = 1 ;
    }

    while( !q.empty() )
    {
        int nd = q.front() ;
        q.pop() ;
        for( auto it : adj[nd] )
        {
            if( !vis[ it.first ] )
            {
                vis[ it.first ] = 1 ;
                erase_road[it.second] = 0 ;
                q.push( it.first ) ;
            }
        }
    }

    for( int i = 1 ; i <= n - 1 ; ++i )
        ans+=erase_road[i] ;
    printf("%d\n" , ans) ;
    for( int i = 1 ; i <= n - 1 ; ++i )
        if( erase_road[i] )
            printf("%d " , i ) ;

    return 0;
}


#include <bits/stdc++.h>

using namespace std;
int n , k , d , p_s[510000] , vis[510000] , erase_road[510000] ;
vector< pair< int , int > > adj[510000] ;

void dfs( int nd , int len , int p = -1 )
{
    for( auto it : adj[nd] )
    {
        if( len == d && it.first != p ){
            erase_road[it.second] = 1 ;
            continue ;
        }
        if( !vis[ it.first ] )
        {
            vis[ it.first ] = 1 ;
            erase_road[it.second] = 0 ;
            dfs( it.first , len+1 , nd ) ;
        }
    }
}

int main()
{
    int a , b , ans = 0 ;
    scanf("%d" , &n) ;
    scanf("%d" , &k) ;
    scanf("%d" , &d) ;
    for( int i = 1 ; i <= k ; ++i )
    {
        scanf("%d" , &p_s[i]) ;
        vis[ p_s[i] ] = 1 ;
    }

    for( int i = 1 ; i <= n-1 ; ++i )
    {
        scanf("%d%d" , &a , &b) ;
        adj[a].push_back( {b ,i} ) ;
        adj[b].push_back( {a , i} ) ;
        erase_road[i] = 1 ;
    }
    for( int i = 1 ; i <= k ; ++i )dfs( p_s[i] , 0 ) ;

    for( int i = 1 ; i <= n - 1 ; ++i )
    {
        ans+=erase_road[i] ;
    }
    printf("%d\n" , ans) ;
    for( int i = 1 ; i <= n - 1 ; ++i )
        if( erase_road[i] )
            printf("%d " , i ) ;

    return 0;
}


#include <bits/stdc++.h>

using namespace std;
int n , k , d , p_s[510000] , vis[510000] , erase_road[510000] ;
vector< pair< int , int > > adj[510000] ;

void dfs( int nd , int len )
{
    if(len == d)return ;
    for( auto it : adj[nd] )
    {
        if( !vis[ it.first ] )
        {
            vis[ it.first ] = 1 ;
            erase_road[it.second] = 0 ;
            dfs( it.first , len+1 ) ;
        }
    }
}

int main()
{
    int a , b , ans = 0 ;
    scanf("%d" , &n) ;
    scanf("%d" , &k) ;
    scanf("%d" , &d) ;
    for( int i = 1 ; i <= k ; ++i )
    {
        scanf("%d" , &p_s[i]) ;
        vis[ p_s[i] ] = 1 ;
    }

    for( int i = 1 ; i <= n-1 ; ++i )
    {
        scanf("%d%d" , &a , &b) ;
        adj[a].push_back( {b ,i} ) ;
        adj[b].push_back( {a , i} ) ;
        erase_road[i] = 1 ;
    }
    for( int i = 1 ; i <= k ; ++i )dfs( p_s[i] , 0 ) ;

    for( int i = 1 ; i <= n - 1 ; ++i )
    {
        ans+=erase_road[i] ;
    }
    printf("%d\n" , ans) ;
    for( int i = 1 ; i <= n - 1 ; ++i )
        if( erase_road[i] )
            printf("%d " , i ) ;

    return 0;
}


#include <bits/stdc++.h>
#define ii pair<int,int>
#define F first
#define S second
using namespace std;

const int N=3e5+100;
int n,k,d;
vector<int> a[N];
ii b[N];
vector<int> t[N];
int f[N],pa[N];
bool c[N],ut[N];
int res;

void dfs(int u, int p, int r)
{
    for(int i=0; i<a[u].size(); i++)
    {
        int v=a[u][i];
        if (v==p || c[v]) continue;
        if (f[u]+1<=d)
        {
            f[v]=f[u]+1;
            t[v].push_back(r);
            dfs(v,u,r);
        }
    }
}

int root(int x)
{
    return pa[x]<0? x:pa[x]=root(pa[x]);
}

void union1(int s, int r)
{
    if (pa[s]<pa[r]) swap(s,r);
    pa[r]+=pa[s];
    pa[s]=r;
}

int main()
{
    //freopen(".inp","r",stdin);
    //freopen(".out","w",stdout);
    cin>>n>>k>>d;
    for(int i=1; i<=k; i++)
    {
        int u;
        scanf("%d",&u);
        c[u]=true;
    }
    for(int i=1; i<n; i++)
    {
        int u,v;
        scanf("%d%d",&u,&v);
        a[u].push_back(v);
        a[v].push_back(u);
        b[i]=ii(u,v);
    }
    for(int i=1; i<=n; i++)
        pa[i]=-1;
    for(int i=1; i<=n; i++)
        if (c[i])
        {
            dfs(i,i,i);
            //res++;
        }
    //printf("%d\n",res-1);
    for(int i=1; i<=n; i++)
        if (!c[i])
            if (t[i].size()==1) ut[t[i][0]]=true;
    for(int i=1; i<=n; i++)
        if (!c[i])
        {
            bool done=false;
            for(int j=0; j<t[i].size(); j++)
                if (ut[t[i][j]])
                {
                    done=true;
                    union1(root(i),root(t[i][j]));
                }
            if (!done) union1(root(i),root(t[i][0]));
        }
    for(int i=1; i<n; i++)
        if (root(b[i].F)!=root(b[i].S))
            res++;
    printf("%d\n",res);
    for(int i=1; i<n; i++)
        if (root(b[i].F)!=root(b[i].S))
            printf("%d ",i);
}


#include <bits/stdc++.h>
#define ii pair<int,int>
#define F first
#define S second
using namespace std;

const int N=3e5+100;
int n,k,d;
vector<ii> a[N];
bool kt[N],ch[N];
int res;

void bfs()
{
    queue<int> q;
    q.push(0);
    bool d[N]={};
    while (!q.empty())
    {
        int u=q.front();
        q.pop();
        for(int i=0; i<int(a[u].size()); i++)
        {
            int v=a[u][i].F;
            int id=a[u][i].S;
            if(!d[v])
            {
                ch[id]=true;
                d[v]=true;
                res--;
                q.push(v);
            }
        }
    }
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    //freopen(".inp","r",stdin);
    //freopen(".out","w",stdout);
    cin>>n>>k>>d;
    for(int i=1; i<=k; i++)
    {
        int u;
        cin>>u;
        kt[u]=true;
    }
    for(int i=1; i<n; i++)
    {
        int u,v;
        cin>>u>>v;
        a[u].push_back(ii(v,i));
        a[v].push_back(ii(u,i));
    }
    for(int i=1; i<=n; i++)
        if (kt[i])
            a[0].push_back(ii(i,0));
    res=n-1+a[0].size();
    bfs();
    cout<<res<<endl;
    for(int i=1; i<n; i++)
        if (!ch[i]) cout<<i<<' ';
}


#include <bits/stdc++.h>
#define ii pair<int,int>
#define F first
#define S second
using namespace std;

const int N=3e5+100;
int n,k,d;
vector<int> a[N];
ii b[N];
vector<int> t[N];
int f[N],pa[N];
bool c[N],ut[N];
int res;

void dfs(int u, int p, int r)
{
    for(int i=0; i<a[u].size(); i++)
    {
        int v=a[u][i];
        if (v==p || c[v]) continue;
        if (f[u]+1<=d)
        {
            f[v]=f[u]+1;
            t[v].push_back(r);
            dfs(v,u,r);
        }
    }
}

int root(int x)
{
    return pa[x]<0? x:pa[x]=root(pa[x]);
}

void union1(int s, int r)
{
    if (pa[s]<pa[r]) swap(s,r);
    pa[r]+=pa[s];
    pa[s]=r;
}

int main()
{
    //freopen(".inp","r",stdin);
    //freopen(".out","w",stdout);
    cin>>n>>k>>d;
    for(int i=1; i<=k; i++)
    {
        int u;
        scanf("%d",&u);
        c[u]=true;
    }
    for(int i=1; i<n; i++)
    {
        int u,v;
        scanf("%d%d",&u,&v);
        a[u].push_back(v);
        a[v].push_back(u);
        b[i]=ii(u,v);
    }
    for(int i=1; i<=n; i++)
        pa[i]=-1;
    for(int i=1; i<=n; i++)
        if (c[i])
        {
            dfs(i,i,i);
            //res++;
        }
    //printf("%d\n",res-1);
    for(int i=1; i<=n; i++)
        if (!c[i])
            if (t[i].size()==1) ut[t[i][0]]=true;
    for(int i=1; i<=n; i++)
        if (!c[i])
        {
            bool done=false;
            for(int j=0; j<t[i].size(); j++)
                if (ut[t[i][j]])
                {
                    done=true;
                    union1(root(i),root(t[i][j]));
                    break;
                }
            if (!done) union1(root(i),root(t[i][0]));
        }
    for(int i=1; i<n; i++)
        if (root(b[i].F)!=root(b[i].S))
            res++;
    printf("%d\n",res);
    for(int i=1; i<n; i++)
        if (root(b[i].F)!=root(b[i].S))
            printf("%d ",i);
}


#include <bits/stdc++.h>
#define ii pair<int,int>
#define F first
#define S second
using namespace std;

const int N=3e5+100;
int n,k,d;
vector<int> a[N];
ii b[N];
vector<int> t[N];
int f[N],pa[N];
bool c[N],ut[N];
int res;

void dfs(int u, int p, int r)
{
    for(int i=0; i<a[u].size(); i++)
    {
        int v=a[u][i];
        if (v==p || c[v]) continue;
        if (f[u]+1<=d)
        {
            f[v]=f[u]+1;
            t[v].push_back(r);
            dfs(v,u,r);
        }
    }
}

int root(int x)
{
    return pa[x]<0? x:pa[x]=root(pa[x]);
}

void union1(int s, int r)
{
    if (pa[s]<pa[r]) swap(s,r);
    pa[r]+=pa[s];
    pa[s]=r;
}

int main()
{
    //freopen(".inp","r",stdin);
    //freopen(".out","w",stdout);
    cin>>n>>k>>d;
    for(int i=1; i<=k; i++)
    {
        int u;
        scanf("%d",&u);
        c[u]=true;
    }
    for(int i=1; i<n; i++)
    {
        int u,v;
        scanf("%d%d",&u,&v);
        a[u].push_back(v);
        a[v].push_back(u);
        b[i]=ii(u,v);
    }
    for(int i=1; i<=n; i++)
        pa[i]=-1;
    for(int i=1; i<=n; i++)
        if (c[i])
        {
            dfs(i,i,i);
            res++;
        }
    printf("%d\n",res-1);
    for(int i=1; i<=n; i++)
        if (!c[i])
            if (t[i].size()==1) ut[t[i][0]]=true;
    for(int i=1; i<=n; i++)
        if (!c[i])
        {
            bool done=false;
            for(int j=0; j<t[i].size(); j++)
                if (ut[t[i][j]])
                {
                    done=true;
                    union1(root(i),root(t[i][j]));
                }
            if (!done) union1(root(i),root(t[i][0]));
        }
    for(int i=1; i<n; i++)
        if (root(b[i].F)!=root(b[i].S))
            printf("%d ",i);
}


#include <bits/stdc++.h>
#define ii pair<int,int>
#define F first
#define S second
using namespace std;

const int N=3e5+100;
int n,k,d;
vector<int> a[N];
ii b[N];
vector<int> t[N];
int f[N],pa[N];
bool c[N],ut[N];
int res;

void dfs(int u, int p, int r)
{
    for(int i=0; i<a[u].size(); i++)
    {
        int v=a[u][i];
        if (v==p || c[v]) continue;
        if (f[u]+1<=d)
        {
            f[v]=f[u]+1;
            t[v].push_back(r);
            dfs(v,u,r);
        }
    }
}

int root(int x)
{
    return pa[x]<0? x:pa[x]=root(pa[x]);
}

void union1(int s, int r)
{
    if (pa[s]<pa[r]) swap(s,r);
    pa[r]+=pa[s];
    pa[s]=r;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    //freopen(".inp","r",stdin);
    //freopen(".out","w",stdout);
    cin>>n>>k>>d;
    for(int i=1; i<=k; i++)
    {
        int u;
        cin>>u;
        c[u]=true;
    }
    for(int i=1; i<n; i++)
    {
        int u,v;
        cin>>u>>v;
        a[u].push_back(v);
        a[v].push_back(u);
        b[i]=ii(u,v);
    }
    for(int i=1; i<=n; i++)
        pa[i]=-1;
    for(int i=1; i<=n; i++)
        if (c[i])
        {
            dfs(i,i,i);
            res++;
        }
    cout<<res-1<<endl;
    for(int i=1; i<=n; i++)
        if (!c[i])
            if (t[i].size()==1) ut[t[i][0]]=true;
    for(int i=1; i<=n; i++)
        if (!c[i])
        {
            bool done=false;
            for(int j=0; j<t[i].size(); j++)
                if (ut[t[i][j]])
                {
                    done=true;
                    union1(root(i),root(t[i][j]));
                }
            if (!done) union1(root(i),root(t[i][0]));
        }
    for(int i=1; i<n; i++)
        if (root(b[i].F)!=root(b[i].S))
            cout<<i<<' ';
}


#include <bits/stdc++.h>
#define ii pair<int,int>
#define F first
#define S second
using namespace std;

const int N=3e5+100;
int n,k,d;
vector<ii> a[N];
int f[N];
bool c[N];
bool check[N];
int res;

void dfs(int u, int p)
{
    for(int i=0; i<a[u].size(); i++)
    {
        int v=a[u][i].F;
        int id=a[u][i].S;
        if (v==p || check[id]) continue;
        if (f[u]+1<=d && !c[v])
        {
            f[v]=f[u]+1;
            dfs(v,u);
        }
        else
        {
            res++;
            check[id]=true;
        }
    }
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    //freopen(".inp","r",stdin);
    //freopen(".out","w",stdout);
    cin>>n>>k>>d;
    for(int i=1; i<=k; i++)
    {
        int u;
        cin>>u;
        c[u]=true;
    }
    for(int i=1; i<n; i++)
    {
        int u,v;
        cin>>u>>v;
        a[u].push_back(ii(v,i));
        a[v].push_back(ii(u,i));
    }
    for(int i=1; i<=n; i++)
        if (c[i]) dfs(i,i);
    cout<<res<<endl;
    for(int i=1; i<n; i++)
        if (check[i]) cout<<i<<' ';
}


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

typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef pair<int,ii> iii;
typedef vector<pair<ii,int>> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
typedef map<int,int> mii;
typedef map<char,int> mci;
typedef priority_queue<int> pqi;
typedef priority_queue<ii> pqii;
typedef priority_queue<int,vi,greater<int>> pqmini;
typedef priority_queue<ii,vii,greater<ii>> pqminii;
typedef long long lli;

#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define si(n) scanf("%d",&n)
#define iout(n) printf("%d\n",n)
#define iouts(n) printf("%d ",n);
#define slli(n) scanf("%lld",&n)
#define lliout(n) printf("%lld\n",n)
#define FOR(i,n) for(int i=0;i<n;i++)

#define EPS 10e-9;
#define PI 3.14159265359
#define EULER 2.7182818284
#define MOD 1000000007

//global variables
int n,k,d,rk,cnt=0;
vi police,visited;
vvi tree;
map<ii,int> edge;
vector<iii> spe;
vi spec;
//end global variables

void preprocess(void){
	return;
}

void BFS(int root){
    queue<ii> q;
    q.push(mp(root,0));
    while(!q.empty()){
        int v=q.front().fi;
        int de=q.front().se;
        q.pop();
        visited[v]=1;
        if(de==d){
           /* FOR(i,(int)tree[v].size()){
                int u=tree[v][i];
                if(visited[u]){
                    continue;
                }
            }*/
            visited[v]=-1;
            continue;
        }
        FOR(i,(int)tree[v].size()){
            int u=tree[v][i];
            if(visited[u]){
                if(visited[u]==-1){
                    spec[u]++;
                    if(spe[u].fi<(d-de)){
                        spe[u].fi=d-de;
                        spe[u].se.fi=v;
                    }
                }
                continue;
            }
            if(police[u]==1){
                iouts(edge[mp(min(v,u),max(v,u))]);
                cnt++;
                continue;
            }
            if(de==d-1){
                spe[u].se.se=v;
            }
            q.push(mp(u,de+1));
        }
    }
}

int main(void){
	//freopen("output.txt","w",stdout);
	//freopen("input.txt","r",stdin);
	preprocess();
	int t;
	//si(t);
	t=1;
	for(int z=1;z<=t;z++){
		//printf("Case #%d: ",z);
        si(n),si(k),si(d);
        police.assign(n,0);
        spe.assign(n,mp(-5,mp(-5,-5)));
        spec.assign(n,0);
        rk=0;
        FOR(i,k){
            int p;
            si(p);
            p--;
            if(!police[p]){
                rk++;
            }
            police[p]=1;
        }
        k=rk;
        iout(k-1);
        tree.resize(n);
        FOR(i,n-1){
            int u,v;
            si(u),si(v);
            u--,v--;
            tree[u].pb(v);
            tree[v].pb(u);
            edge[mp(min(u,v),max(u,v))]=i+1;
        }
        visited.assign(n,0);
        FOR(i,n){
            if(visited[i]==1||police[i]==0){
                continue;
            }
            BFS(i);
            police[i]=0;
        }
        FOR(i,n){
            if(visited[i]!=-1){
                continue;
            }
            if(spec[i]<tree[i].size()-1){
                FOR(j,(int)tree[i].size()){
                    int v=tree[i][j];
                    if(spe[i].se.fi==v||spe[i].se.se==v){
                        continue;
                    }
                    iouts(edge[mp(min(i,v),max(i,v))]);
                    cnt++;
                }
            }
            else{
                FOR(j,(int)tree[i].size()){
                    int v=tree[i][j];
                    if(spe[i].se.se==v){
                        continue;
                    }
                    iouts(edge[mp(min(i,v),max(i,v))]);
                    cnt++;
                }
            }
        }
        printf("\n");
        if(cnt!=k-1){
            exit(1);
        }
	}
	return 0;
}


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

typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef pair<int,ii> iii;
typedef vector<pair<ii,int>> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
typedef map<int,int> mii;
typedef map<char,int> mci;
typedef priority_queue<int> pqi;
typedef priority_queue<ii> pqii;
typedef priority_queue<int,vi,greater<int>> pqmini;
typedef priority_queue<ii,vii,greater<ii>> pqminii;
typedef long long lli;

#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define si(n) scanf("%d",&n)
#define iout(n) printf("%d\n",n)
#define iouts(n) printf("%d ",n);
#define slli(n) scanf("%lld",&n)
#define lliout(n) printf("%lld\n",n)
#define FOR(i,n) for(int i=0;i<n;i++)

#define EPS 10e-9;
#define PI 3.14159265359
#define EULER 2.7182818284
#define MOD 1000000007

//global variables
int n,k,d;
vi visited,police;
vvi tree;
map<ii,int> edge;
vi cnt;
vi parent;
int net=0;
vii mx;
//end global variables

void preprocess(void){
	return;
}

void MODbfs(int root){
    queue<ii> q;
    q.push(mp(root,0));
    while(!q.empty()){
        ii to = q.front();
        q.pop();
        int v=to.fi;
        int cd=to.se;
        visited[v]=1;
        police[v]=1;
        if(cd==d){
            visited[v]=-1;
            continue;
        }
        FOR(i,(int)tree[v].size()){
            int u=tree[v][i];
            if(visited[u]!=0){
                if(visited[u]==-1){
                    cnt[u]++;
                    if(mx[u].fi<d-cd){
                        mx[u].fi=d-cd;
                        mx[u].se=v;
                    }
                }
                continue;
            }
            if(police[u]==1){
                iouts(edge[mp(min(u,v),max(u,v))]);
                net++;
                continue;
            }
            parent[u]=v;
            q.push(mp(u,cd+1));
        }
    }
}

int main(void){
	//freopen("output.txt","w",stdout);
	//freopen("input.txt","r",stdin);
	preprocess();
	int t;
	//si(t);
	t=1;
	for(int z=1;z<=t;z++){
		//printf("Case #%d: ",z);
        si(n),si(k),si(d);
        police.assign(n,0);
        tree.resize(n);
        visited.assign(n,0);
        parent.resize(n);
        cnt.assign(n,0);
        mx.assign(n,mp(-5,-5));
        int tk=0;
        FOR(i,k){
            int p;
            si(p);
            p--;
            if(police[p]==0){
                tk++;
            }
            police[p]=1;
        }
        k=tk;
        FOR(i,n-1){
            int u,v;
            si(u),si(v);
            u--,v--;
            tree[u].pb(v);
            tree[v].pb(u);
            edge[mp(min(u,v),max(u,v))]=i+1;
        }
        iout(k-1);
        FOR(i,n){
            if(visited[i]!=0){
                continue;
            }
            if(police[i]==0){
                continue;
            }
            parent[i]=-1;
            MODbfs(i);
        }
        FOR(i,n){
            if(visited[i]!=-1){
                continue;
            }
            int temp=0;
            if(cnt[i]<tree[i].size()-1){
                FOR(j,(int)tree[i].size()){
                    int v=tree[i][j];
                    if(police[v]==0){
                        temp++;
                        continue;
                    }
                    if(v==parent[i]){
                        continue;
                    }
                    if(v==mx[i].se){
                        continue;
                    }
                    iouts(edge[mp(min(i,v),max(i,v))]);
                    net++;
                }
                if(temp!=0){
                    iouts(edge[mp(min(parent[i],i),max(parent[i],i))]);
                }
            }
            else{
                FOR(j,(int)tree[i].size()){
                    int v=tree[i][j];
                    if(v==parent[i]){
                        continue;
                    }
                    iouts(edge[mp(min(i,v),max(i,v))]);
                    net++;
                }
            }
        }
        printf("\n");
        if(net<k-1){
            exit(1);
        }
        else if(net>k-1){
            exit(2);
        }
        else{
            exit(0);
        }
	}
	return 0;
}


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

typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef pair<int,ii> iii;
typedef vector<pair<ii,int>> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
typedef map<int,int> mii;
typedef map<char,int> mci;
typedef priority_queue<int> pqi;
typedef priority_queue<ii> pqii;
typedef priority_queue<int,vi,greater<int>> pqmini;
typedef priority_queue<ii,vii,greater<ii>> pqminii;
typedef long long lli;

#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define si(n) scanf("%d",&n)
#define iout(n) printf("%d\n",n)
#define iouts(n) printf("%d ",n);
#define slli(n) scanf("%lld",&n)
#define lliout(n) printf("%lld\n",n)
#define FOR(i,n) for(int i=0;i<n;i++)

#define EPS 10e-9;
#define PI 3.14159265359
#define EULER 2.7182818284
#define MOD 1000000007

//global variables
int n,k,d;
vi visited,police;
vvi tree;
map<ii,int> edge;
vi cnt,flag;
vi parent;
int net=0;
vii mx;
//end global variables

void preprocess(void){
	return;
}

void MODbfs(int root){
    queue<ii> q;
    q.push(mp(root,0));
    while(!q.empty()){
        ii to = q.front();
        q.pop();
        int v=to.fi;
        int cd=to.se;
        visited[v]=1;
        police[v]=1;
        if(cd==d){
            visited[v]=-1;
            continue;
        }
        FOR(i,(int)tree[v].size()){
            int u=tree[v][i];
            if(visited[u]!=0){
                if(visited[u]==-1){
                    cnt[u]++;
                    if(mx[u].fi<d-cd){
                        mx[u].fi=d-cd;
                        mx[u].se=v;
                    }
                }
                continue;
            }
            if(police[u]==1){
                if(cd==0||flag[v]==1){
                    iouts(edge[mp(min(v,u),max(v,u))]);
                    net++;
                    continue;
                }
                iouts(edge[mp(min(v,parent[v]),max(v,parent[v]))]);
                flag[v]=1;
                net++;
                continue;
            }
            parent[u]=v;
            q.push(mp(u,cd+1));
        }
    }
}

int main(void){
	//freopen("output.txt","w",stdout);
	//freopen("input.txt","r",stdin);
	preprocess();
	int t;
	//si(t);
	t=1;
	for(int z=1;z<=t;z++){
		//printf("Case #%d: ",z);
        si(n),si(k),si(d);
        police.assign(n,0);
        tree.resize(n);
        visited.assign(n,0);
        parent.resize(n);
        cnt.assign(n,0);
        flag.assign(n,0);
        mx.assign(n,mp(-5,-5));
        int tk=0;
        FOR(i,k){
            int p;
            si(p);
            p--;
            if(police[p]==0){
                tk++;
            }
            police[p]=1;
        }
        k=tk;
        FOR(i,n-1){
            int u,v;
            si(u),si(v);
            u--,v--;
            tree[u].pb(v);
            tree[v].pb(u);
            edge[mp(min(u,v),max(u,v))]=i+1;
        }
        iout(k-1);
        FOR(i,n){
            if(visited[i]!=0){
                continue;
            }
            if(police[i]==0){
                continue;
            }
            parent[i]=-1;
            MODbfs(i);
        }
        FOR(i,n){
            if(visited[i]!=-1){
                continue;
            }
            if(cnt[i]<tree[i].size()-1){
                FOR(j,(int)tree[i].size()){
                    int v=tree[i][j];
                    if(police[v]==0){
                        continue;
                    }
                    if(v==mx[i].se){
                        continue;
                    }
                    if(cnt[i]==0&&parent[i]==v){
                        continue;
                    }
                    iouts(edge[mp(min(i,v),max(i,v))]);
                    net++;
                }
            }
            else{
                FOR(j,(int)tree[i].size()){
                    int v=tree[i][j];
                    if(v==parent[i]){
                        continue;
                    }
                    iouts(edge[mp(min(i,v),max(i,v))]);
                    net++;
                }
            }
        }
        printf("\n");
        if(net<k-1){
            exit(1);
        }
        else if(net>k-1){
            exit(2);
        }
        else{
            exit(0);
        }
	}
	return 0;
}


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

typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef pair<int,ii> iii;
typedef vector<pair<ii,int>> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
typedef map<int,int> mii;
typedef map<char,int> mci;
typedef priority_queue<int> pqi;
typedef priority_queue<ii> pqii;
typedef priority_queue<int,vi,greater<int>> pqmini;
typedef priority_queue<ii,vii,greater<ii>> pqminii;
typedef long long lli;

#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define si(n) scanf("%d",&n)
#define iout(n) printf("%d\n",n)
#define iouts(n) printf("%d ",n);
#define slli(n) scanf("%lld",&n)
#define lliout(n) printf("%lld\n",n)
#define FOR(i,n) for(int i=0;i<n;i++)

#define EPS 10e-9;
#define PI 3.14159265359
#define EULER 2.7182818284
#define MOD 1000000007

//global variables
int n,k,d;
vi visited,police;
vvi tree;
map<ii,int> edge;
vi cnt;
vi parent;
int net=0;
vii mx;
//end global variables

void preprocess(void){
	return;
}

void MODbfs(int root){
    queue<ii> q;
    q.push(mp(root,0));
    while(!q.empty()){
        ii to = q.front();
        q.pop();
        int v=to.fi;
        int cd=to.se;
        visited[v]=1;
        police[v]=1;
        if(cd==d){
            visited[v]=-1;
            continue;
        }
        FOR(i,(int)tree[v].size()){
            int u=tree[v][i];
            if(visited[u]!=0){
                if(visited[u]==-1){
                    cnt[u]++;
                    if(mx[u].fi<d-cd){
                        mx[u].fi=d-cd;
                        mx[u].se=v;
                    }
                }
                continue;
            }
            if(police[u]==1){
                iouts(edge[mp(min(u,v),max(u,v))]);
                net++;
                continue;
            }
            parent[u]=v;
            q.push(mp(u,cd+1));
        }
    }
}

int main(void){
	//freopen("output.txt","w",stdout);
	//freopen("input.txt","r",stdin);
	preprocess();
	int t;
	//si(t);
	t=1;
	for(int z=1;z<=t;z++){
		//printf("Case #%d: ",z);
        si(n),si(k),si(d);
        police.assign(n,0);
        tree.resize(n);
        visited.assign(n,0);
        parent.resize(n);
        cnt.assign(n,0);
        mx.assign(n,mp(-5,-5));
        int tk=0;
        FOR(i,k){
            int p;
            si(p);
            p--;
            if(police[p]==0){
                tk++;
            }
            police[p]=1;
        }
        k=tk;
        FOR(i,n-1){
            int u,v;
            si(u),si(v);
            u--,v--;
            tree[u].pb(v);
            tree[v].pb(u);
            edge[mp(min(u,v),max(u,v))]=i+1;
        }
        iout(k-1);
        FOR(i,n){
            if(visited[i]!=0){
                continue;
            }
            if(police[i]==0){
                continue;
            }
            parent[i]=-1;
            MODbfs(i);
        }
        FOR(i,n){
            if(visited[i]!=-1){
                continue;
            }
            if(cnt[i]<tree[i].size()-1){
                FOR(j,(int)tree[i].size()){
                    int v=tree[i][j];
                    if(police[v]==0){
                        continue;
                    }
                    if(v==mx[i].se){
                        continue;
                    }
                    iouts(edge[mp(min(i,v),max(i,v))]);
                    net++;
                }
            }
            else{
                FOR(j,(int)tree[i].size()){
                    int v=tree[i][j];
                    if(v==parent[i]){
                        continue;
                    }
                    iouts(edge[mp(min(i,v),max(i,v))]);
                    net++;
                }
            }
        }
        printf("\n");
        if(net<k-1){
            exit(1);
        }
        else if(net>k-1){
            exit(0);
        }
        else{
            exit(0);
        }
	}
	return 0;
}


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

typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef pair<int,ii> iii;
typedef vector<pair<ii,int>> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
typedef map<int,int> mii;
typedef map<char,int> mci;
typedef priority_queue<int> pqi;
typedef priority_queue<ii> pqii;
typedef priority_queue<int,vi,greater<int>> pqmini;
typedef priority_queue<ii,vii,greater<ii>> pqminii;
typedef long long lli;

#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define si(n) scanf("%d",&n)
#define iout(n) printf("%d\n",n)
#define iouts(n) printf("%d ",n);
#define slli(n) scanf("%lld",&n)
#define lliout(n) printf("%lld\n",n)
#define FOR(i,n) for(int i=0;i<n;i++)

#define EPS 10e-9;
#define PI 3.14159265359
#define EULER 2.7182818284
#define MOD 1000000007

//global variables
int n,k,d;
vi visited,police;
vvi tree;
map<ii,int> edge;
vi cnt;
vi parent;
int net=0;
vii mx;
//end global variables

void preprocess(void){
	return;
}

void MODbfs(int root){
    queue<ii> q;
    q.push(mp(root,0));
    while(!q.empty()){
        ii to = q.front();
        q.pop();
        int v=to.fi;
        int cd=to.se;
        visited[v]=1;
        police[v]=1;
        if(cd==d){
            visited[v]=-1;
            continue;
        }
        FOR(i,(int)tree[v].size()){
            int u=tree[v][i];
            if(visited[u]!=0){
                if(visited[u]==-1){
                    cnt[u]++;
                    if(mx[u].fi<d-cd){
                        mx[u].fi=d-cd;
                        mx[u].se=v;
                    }
                }
                continue;
            }
            if(police[u]==1){
                iouts(edge[mp(min(u,v),max(u,v))]);
                net++;
                continue;
            }
            parent[u]=v;
            q.push(mp(u,cd+1));
        }
    }
}

int main(void){
	//freopen("output.txt","w",stdout);
	//freopen("input.txt","r",stdin);
	preprocess();
	int t;
	//si(t);
	t=1;
	for(int z=1;z<=t;z++){
		//printf("Case #%d: ",z);
        si(n),si(k),si(d);
        police.assign(n,0);
        tree.resize(n);
        visited.assign(n,0);
        parent.resize(n);
        cnt.assign(n,0);
        mx.assign(n,mp(-5,-5));
        int tk=0;
        FOR(i,k){
            int p;
            si(p);
            p--;
            if(police[p]==0){
                tk++;
            }
            police[p]=1;
        }
        k=tk;
        FOR(i,n-1){
            int u,v;
            si(u),si(v);
            u--,v--;
            tree[u].pb(v);
            tree[v].pb(u);
            edge[mp(min(u,v),max(u,v))]=i+1;
        }
        iout(k-1);
        FOR(i,n){
            if(visited[i]!=0){
                continue;
            }
            if(police[i]==0){
                continue;
            }
            parent[i]=-1;
            MODbfs(i);
        }
        FOR(i,n){
            if(visited[i]!=-1){
                continue;
            }
            int temp=0;
            if(cnt[i]<tree[i].size()-1){
                FOR(j,(int)tree[i].size()){
                    int v=tree[i][j];
                    if(police[v]==0){
                        temp++;
                        continue;
                    }
                    if(v==parent[i]){
                        continue;
                    }
                    if(v==mx[i].se){
                        continue;
                    }
                    iouts(edge[mp(min(i,v),max(i,v))]);
                    net++;
                }
                if(temp!=0){
                    iouts(edge[mp(min(parent[i],i),max(parent[i],i))]);
                    net++;
                }
            }
            else{
                FOR(j,(int)tree[i].size()){
                    int v=tree[i][j];
                    if(v==parent[i]){
                        continue;
                    }
                    iouts(edge[mp(min(i,v),max(i,v))]);
                    net++;
                }
            }
        }
        printf("\n");
        if(net<k-1){
            exit(1);
        }
        else if(net>k-1){
            exit(2);
        }
        else{
            exit(0);
        }
	}
	return 0;
}


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

typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef pair<int,ii> iii;
typedef vector<pair<ii,int>> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
typedef map<int,int> mii;
typedef map<char,int> mci;
typedef priority_queue<int> pqi;
typedef priority_queue<ii> pqii;
typedef priority_queue<int,vi,greater<int>> pqmini;
typedef priority_queue<ii,vii,greater<ii>> pqminii;
typedef long long lli;

#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define si(n) scanf("%d",&n)
#define iout(n) printf("%d\n",n)
#define iouts(n) printf("%d ",n);
#define slli(n) scanf("%lld",&n)
#define lliout(n) printf("%lld\n",n)
#define FOR(i,n) for(int i=0;i<n;i++)

#define EPS 10e-9;
#define PI 3.14159265359
#define EULER 2.7182818284
#define MOD 1000000007

//global variables
int n,k,d,rk;
vi police,visited;
vvi tree;
map<ii,int> edge;
//end global variables

void preprocess(void){
	return;
}

void BFS(int root){
    queue<ii> q;
    q.push(mp(root,0));
    while(!q.empty()){
        int v=q.front().fi;
        int de=q.front().se;
        q.pop();
        visited[v]=1;
        if(de==d){
            FOR(i,(int)tree[v].size()){
                int u=tree[v][i];
                if(visited[u]){
                    continue;
                }
                iouts(edge[mp(min(v,u),max(v,u))]);
            }
            continue;
        }
        FOR(i,(int)tree[v].size()){
            int u=tree[v][i];
            if(visited[u]){
                continue;
            }
            if(police[u]==1){
                iouts(edge[mp(min(v,u),max(v,u))]);
                continue;
            }
            q.push(mp(u,de+1));
        }
    }
}

int main(void){
	//freopen("output.txt","w",stdout);
	//freopen("input.txt","r",stdin);
	preprocess();
	int t;
	//si(t);
	t=1;
	for(int z=1;z<=t;z++){
		//printf("Case #%d: ",z);
        si(n),si(k),si(d);
        police.assign(n,0);
        rk=0;
        FOR(i,k){
            int p;
            si(p);
            p--;
            if(!police[p]){
                rk++;
            }
            police[p]=1;
        }
        k=rk;
        iout(k-1);
        tree.resize(n);
        FOR(i,n-1){
            int u,v;
            si(u),si(v);
            u--,v--;
            tree[u].pb(v);
            tree[v].pb(u);
            edge[mp(min(u,v),max(u,v))]=i+1;
        }
        visited.assign(n,0);
        FOR(i,n){
            if(visited[i]==1||police[i]==0){
                continue;
            }
            BFS(i);
        }
        printf("\n");
	}
	return 0;
}


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

typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef pair<int,ii> iii;
typedef vector<pair<ii,int>> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
typedef map<int,int> mii;
typedef map<char,int> mci;
typedef priority_queue<int> pqi;
typedef priority_queue<ii> pqii;
typedef priority_queue<int,vi,greater<int>> pqmini;
typedef priority_queue<ii,vii,greater<ii>> pqminii;
typedef long long lli;

#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define si(n) scanf("%d",&n)
#define iout(n) printf("%d\n",n)
#define iouts(n) printf("%d ",n)
#define slli(n) scanf("%lld",&n)
#define lliout(n) printf("%lld\n",n)
#define FOR(i,n) for(int i=0;i<n;i++)

#define EPS 10e-9;
#define PI 3.14159265359
#define EULER 2.7182818284
#define MOD 1000000007

//global variables
int n,k,d,net=0;
vvi tree;
vi police,parent,dist;
set<int> ans;
map<ii,int> edge;
//end global variables

void preprocess(void){
	return;
}

int main(void){
	//freopen("output.txt","w",stdout);
	//freopen("input.txt","r",stdin);
	preprocess();
	int t;
	//si(t);
	t=1;
	for(int z=1;z<=t;z++){
		//printf("Case #%d: ",z);
        si(n),si(k),si(d);
        tree.resize(n);
        police.assign(n,0);
        parent.resize(n);
        dist.assign(n,-1);
        int tk=0;
        FOR(i,k){
            int p;
            si(p);
            p--;
            if(police[p]==0){
                tk++;
            }
            police[p]=1;
        }
        k=tk;
        FOR(i,n-1){
            int u,v;
            si(u),si(v);
            u--,v--;
            tree[u].pb(v);
            tree[v].pb(u);
            edge[mp(min(u,v),max(u,v))]=i+1;
        }
        queue<int> q;
        FOR(i,n){
            if(police[i]){
                dist[i]=0;
                q.push(i);
            }
        }
        while(!q.empty()){
            int v=q.front();
            q.pop();
            if(dist[v]==d){
                continue;
            }
            FOR(i,(int)tree[v].size()){
                int u=tree[v][i];
                if(dist[u]==-1){
                    dist[u]=dist[v]+1;
                    q.push(u);
                }
                else if(dist[u]>dist[v]+1){
                    dist[u]=dist[v]+1;
                    q.push(u);
                }
            }
        }
        iout(k-1);
        FOR(u,n){
            if(dist[u]==0){
                continue;
            }
            ii best=mp(d+1,-5);
            FOR(i,(int)tree[u].size()){
                int v=tree[u][i];
                if(best.fi>dist[v]+1){
                    best.fi=dist[v]+1;
                    best.se=v;
                }
            }
            ans.insert(edge[mp(min(u,best.se),max(u,best.se))]);
        }
        FOR(i,n-1){
            if(!ans.count(i+1)){
                iouts(i+1);
                net++;
            }
        }
        printf("\n");
        if(net<k-1){
            exit(1);
        }
        else if(net>k-1){
            exit(2);
        }
        else{
            exit(0);
        }
	}
	return 0;
}


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

typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef pair<int,ii> iii;
typedef vector<pair<ii,int>> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
typedef map<int,int> mii;
typedef map<char,int> mci;
typedef priority_queue<int> pqi;
typedef priority_queue<ii> pqii;
typedef priority_queue<int,vi,greater<int>> pqmini;
typedef priority_queue<ii,vii,greater<ii>> pqminii;
typedef long long lli;

#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define si(n) scanf("%d",&n)
#define iout(n) printf("%d\n",n)
#define iouts(n) printf("%d ",n);
#define slli(n) scanf("%lld",&n)
#define lliout(n) printf("%lld\n",n)
#define FOR(i,n) for(int i=0;i<n;i++)

#define EPS 10e-9;
#define PI 3.14159265359
#define EULER 2.7182818284
#define MOD 1000000007

//global variables
int n,k,d,rk,cnt=0;
vi police,visited;
vvi tree;
map<ii,int> edge;
//end global variables

void preprocess(void){
	return;
}

void BFS(int root){
    queue<ii> q;
    q.push(mp(root,0));
    while(!q.empty()){
        int v=q.front().fi;
        int de=q.front().se;
        q.pop();
        visited[v]=1;
        if(de==d){
            FOR(i,(int)tree[v].size()){
                int u=tree[v][i];
                if(visited[u]){
                    continue;
                }
                iouts(edge[mp(min(v,u),max(v,u))]);
                cnt++;
            }
            continue;
        }
        FOR(i,(int)tree[v].size()){
            int u=tree[v][i];
            if(visited[u]){
                continue;
            }
            if(police[u]==1){
                iouts(edge[mp(min(v,u),max(v,u))]);
                cnt++;
                continue;
            }
            q.push(mp(u,de+1));
        }
    }
}

int main(void){
	//freopen("output.txt","w",stdout);
	//freopen("input.txt","r",stdin);
	preprocess();
	int t;
	//si(t);
	t=1;
	for(int z=1;z<=t;z++){
		//printf("Case #%d: ",z);
        si(n),si(k),si(d);
        police.assign(n,0);
        rk=0;
        FOR(i,k){
            int p;
            si(p);
            p--;
            if(!police[p]){
                rk++;
            }
            police[p]=1;
        }
        k=rk;
        iout(k-1);
        tree.resize(n);
        FOR(i,n-1){
            int u,v;
            si(u),si(v);
            u--,v--;
            tree[u].pb(v);
            tree[v].pb(u);
            edge[mp(min(u,v),max(u,v))]=i+1;
        }
        visited.assign(n,0);
        FOR(i,n){
            if(visited[i]==1||police[i]==0){
                continue;
            }
            BFS(i);
        }
        printf("\n");
        if(cnt!=k-1){
            exit(1);
        }
	}
	return 0;
}


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

typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef pair<int,ii> iii;
typedef vector<pair<ii,int>> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
typedef map<int,int> mii;
typedef map<char,int> mci;
typedef priority_queue<int> pqi;
typedef priority_queue<ii> pqii;
typedef priority_queue<int,vi,greater<int>> pqmini;
typedef priority_queue<ii,vii,greater<ii>> pqminii;
typedef long long lli;

#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define si(n) scanf("%d",&n)
#define iout(n) printf("%d\n",n)
#define iouts(n) printf("%d ",n);
#define slli(n) scanf("%lld",&n)
#define lliout(n) printf("%lld\n",n)
#define FOR(i,n) for(int i=0;i<n;i++)

#define EPS 10e-9;
#define PI 3.14159265359
#define EULER 2.7182818284
#define MOD 1000000007

//global variables
int n,k,d;
vi visited,police;
vvi tree;
map<ii,int> edge;
vi cnt;
vi parent;
int net=0;
vii mx;
//end global variables

void preprocess(void){
	return;
}

void MODbfs(int root){
    queue<ii> q;
    q.push(mp(root,0));
    while(!q.empty()){
        ii to = q.front();
        q.pop();
        int v=to.fi;
        int cd=to.se;
        visited[v]=1;
        police[v]=1;
        if(cd==d){
            visited[v]=-1;
            continue;
        }
        FOR(i,(int)tree[v].size()){
            int u=tree[v][i];
            if(visited[u]!=0){
                if(visited[u]==-1){
                    cnt[u]++;
                    if(mx[u].fi<d-cd){
                        mx[u].fi=d-cd;
                        mx[u].se=v;
                    }
                }
                continue;
            }
            if(police[u]==1){
                iouts(edge[mp(min(u,v),max(u,v))]);
                net++;
                continue;
            }
            parent[u]=v;
            q.push(mp(u,cd+1));
        }
    }
}

int main(void){
	//freopen("output.txt","w",stdout);
	//freopen("input.txt","r",stdin);
	preprocess();
	int t;
	//si(t);
	t=1;
	for(int z=1;z<=t;z++){
		//printf("Case #%d: ",z);
        si(n),si(k),si(d);
        police.assign(n,0);
        tree.resize(n);
        visited.assign(n,0);
        parent.resize(n);
        cnt.assign(n,0);
        mx.assign(n,mp(-5,-5));
        int tk=0;
        FOR(i,k){
            int p;
            si(p);
            p--;
            if(police[p]==0){
                tk++;
            }
            police[p]=1;
        }
        k=tk;
        FOR(i,n-1){
            int u,v;
            si(u),si(v);
            u--,v--;
            tree[u].pb(v);
            tree[v].pb(u);
            edge[mp(min(u,v),max(u,v))]=i+1;
        }
        iout(k-1);
        FOR(i,n){
            if(visited[i]!=0){
                continue;
            }
            if(police[i]==0){
                continue;
            }
            parent[i]=-1;
            MODbfs(i);
        }
        FOR(i,n){
            if(visited[i]!=-1){
                continue;
            }
            if(cnt[i]<tree[i].size()-1){
                FOR(j,(int)tree[i].size()){
                    int v=tree[i][j];
                    if(police[v]==0){
                        continue;
                    }
                    if(v==mx[i].se){
                        continue;
                    }
                    iouts(edge[mp(min(i,v),max(i,v))]);
                    net++;
                }
            }
            else{
                FOR(j,(int)tree[i].size()){
                    int v=tree[i][j];
                    if(v==parent[i]){
                        continue;
                    }
                    iouts(edge[mp(min(i,v),max(i,v))]);
                    net++;
                }
            }
        }
        printf("\n");
        if(net<k-1){
            exit(1);
        }
        else if(net>k-1){
            exit(2);
        }
        else{
            exit(0);
        }
	}
	return 0;
}


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

typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef pair<int,ii> iii;
typedef vector<pair<ii,int>> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
typedef map<int,int> mii;
typedef map<char,int> mci;
typedef priority_queue<int> pqi;
typedef priority_queue<ii> pqii;
typedef priority_queue<int,vi,greater<int>> pqmini;
typedef priority_queue<ii,vii,greater<ii>> pqminii;
typedef long long lli;

#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define si(n) scanf("%d",&n)
#define iout(n) printf("%d\n",n)
#define iouts(n) printf("%d ",n);
#define slli(n) scanf("%lld",&n)
#define lliout(n) printf("%lld\n",n)
#define FOR(i,n) for(int i=0;i<n;i++)

#define EPS 10e-9;
#define PI 3.14159265359
#define EULER 2.7182818284
#define MOD 1000000007

//global variables
int n,k,d;
vi visited,police;
vvi tree;
map<ii,int> edge;
vi cnt;
vi parent;
int net=0;
vii mx;
//end global variables

void preprocess(void){
	return;
}

void MODbfs(int root){
    queue<ii> q;
    q.push(mp(root,0));
    while(!q.empty()){
        ii to = q.front();
        q.pop();
        int v=to.fi;
        int cd=to.se;
        visited[v]=1;
        police[v]=1;
        if(cd==d){
            visited[v]=-1;
            continue;
        }
        FOR(i,(int)tree[v].size()){
            int u=tree[v][i];
            if(visited[u]!=0){
                if(visited[u]==-1){
                    cnt[u]++;
                    if(mx[u].fi<d-cd){
                        mx[u].fi=d-cd;
                        mx[u].se=v;
                    }
                }
                continue;
            }
            if(police[u]==1){
                if(cd==0){
                    iouts(edge[mp(min(v,u),max(v,u))]);
                    net++;
                    continue;
                }
                iouts(edge[mp(min(v,parent[v]),max(v,parent[v]))]);
                net++;
                continue;
            }
            parent[u]=v;
            q.push(mp(u,cd+1));
        }
    }
}

int main(void){
	//freopen("output.txt","w",stdout);
	//freopen("input.txt","r",stdin);
	preprocess();
	int t;
	//si(t);
	t=1;
	for(int z=1;z<=t;z++){
		//printf("Case #%d: ",z);
        si(n),si(k),si(d);
        police.assign(n,0);
        tree.resize(n);
        visited.assign(n,0);
        parent.resize(n);
        cnt.assign(n,0);
        mx.assign(n,mp(-5,-5));
        int tk=0;
        FOR(i,k){
            int p;
            si(p);
            p--;
            if(police[p]==0){
                tk++;
            }
            police[p]=1;
        }
        k=tk;
        FOR(i,n-1){
            int u,v;
            si(u),si(v);
            u--,v--;
            tree[u].pb(v);
            tree[v].pb(u);
            edge[mp(min(u,v),max(u,v))]=i+1;
        }
        iout(k-1);
        FOR(i,n){
            if(visited[i]!=0){
                continue;
            }
            if(police[i]==0){
                continue;
            }
            parent[i]=-1;
            MODbfs(i);
        }
        FOR(i,n){
            if(visited[i]!=-1){
                continue;
            }
            if(cnt[i]<tree[i].size()-1){
                FOR(j,(int)tree[i].size()){
                    int v=tree[i][j];
                    if(police[v]==0){
                        continue;
                    }
                    if(v==mx[i].se){
                        continue;
                    }
                    if(cnt[i]==0&&parent[i]==v){
                        continue;
                    }
                    iouts(edge[mp(min(i,v),max(i,v))]);
                    net++;
                }
            }
            else{
                FOR(j,(int)tree[i].size()){
                    int v=tree[i][j];
                    if(v==parent[i]){
                        continue;
                    }
                    iouts(edge[mp(min(i,v),max(i,v))]);
                    net++;
                }
            }
        }
        printf("\n");
        if(net<k-1){
            exit(1);
        }
        else if(net>k-1){
            exit(2);
        }
        else{
            exit(0);
        }
	}
	return 0;
}