{"raw_statement":[{"iden":"statement","content":"Inzane finally found Zane with a lot of money to spare, so they together decided to establish a country of their own.\n\nRuling a country is not an easy job. Thieves and terrorists are always ready to ruin the country's peace. To fight back, Zane and Inzane have enacted a very effective law: from each city it must be possible to reach a police station by traveling at most _d_ kilometers along the roads.\n\n<center>![image](https://espresso.codeforces.com/330fc221445eb02ceb21a0be532425b427934dfc.png)</center>There are _n_ cities in the country, numbered from 1 to _n_, connected only by exactly _n_ - 1 roads. All roads are 1 kilometer long. It is initially possible to travel from a city to any other city using these roads. The country also has _k_ police stations located in some cities. In particular, the city's structure satisfies the requirement enforced by the previously mentioned law. Also note that there can be multiple police stations in one city.\n\nHowever, Zane feels like having as many as _n_ - 1 roads is unnecessary. The country is having financial issues, so it wants to minimize the road maintenance cost by shutting down as many roads as possible.\n\nHelp Zane find the maximum number of roads that can be shut down without breaking the law. Also, help him determine such roads."},{"iden":"input","content":"The first line contains three integers _n_, _k_, and _d_ (2 ≤ _n_ ≤ 3·105, 1 ≤ _k_ ≤ 3·105, 0 ≤ _d_ ≤ _n_ - 1) — the number of cities, the number of police stations, and the distance limitation in kilometers, respectively.\n\nThe second line contains _k_ integers _p_1, _p_2, ..., _p__k_ (1 ≤ _p__i_ ≤ _n_) — each denoting the city each police station is located in.\n\nThe _i_\\-th of the following _n_ - 1 lines contains two integers _u__i_ and _v__i_ (1 ≤ _u__i_, _v__i_ ≤ _n_, _u__i_ ≠ _v__i_) — the cities directly connected by the road with index _i_.\n\nIt is guaranteed that it is possible to travel from one city to any other city using only the roads. Also, it is possible from any city to reach a police station within _d_ kilometers."},{"iden":"output","content":"In the first line, print one integer _s_ that denotes the maximum number of roads that can be shut down.\n\nIn the second line, print _s_ distinct integers, the indices of such roads, in any order.\n\nIf there are multiple answers, print any of them."},{"iden":"examples","content":"Input\n\n6 2 4\n1 6\n1 2\n2 3\n3 4\n4 5\n5 6\n\nOutput\n\n1\n5\n\nInput\n\n6 3 2\n1 5 6\n1 2\n1 3\n1 4\n1 5\n5 6\n\nOutput\n\n2\n4 5"},{"iden":"note","content":"In the first sample, if you shut down road 5, all cities can still reach a police station within _k_ = 4 kilometers.\n\nIn the second sample, although this is the only largest valid set of roads that can be shut down, you can print either _4 5_ or _5 4_ in the second line."}],"translated_statement":[{"iden":"statement","content":"Inzane 最终找到了 Zane，他有很多闲置资金，于是他们决定共同建立一个国家。\n\n治理国家并非易事。小偷和恐怖分子总是随时准备破坏国家的和平。为了应对，Zane 和 Inzane 制定了一项非常有效的法律：从每个城市出发，必须能够通过道路在不超过 #cf_span[d] 公里的距离内到达一个警察局。\n\n该国有 #cf_span[n] 座城市，编号从 #cf_span[1] 到 #cf_span[n]，仅由恰好 #cf_span[n - 1] 条道路连接。所有道路长度均为 #cf_span[1] 公里。最初，通过这些道路可以从任意一座城市到达其他任何城市。该国还有 #cf_span[k] 个警察局，分布在某些城市中。特别地，城市的结构满足前述法律的要求。此外，一个城市中可能存在多个警察局。\n\n然而，Zane 觉得拥有 #cf_span[n - 1] 条道路是不必要的。由于国家财政困难，希望尽可能多地关闭道路以最小化道路维护成本。\n\n请帮助 Zane 找出在不违反法律的前提下，最多可以关闭多少条道路。同时，帮助他确定这些道路。\n\n第一行包含三个整数 #cf_span[n]、#cf_span[k] 和 #cf_span[d]（#cf_span[2 ≤ n ≤ 3·105]，#cf_span[1 ≤ k ≤ 3·105]，#cf_span[0 ≤ d ≤ n - 1]）——分别表示城市数量、警察局数量和距离限制（单位：公里）。\n\n第二行包含 #cf_span[k] 个整数 #cf_span[p1, p2, ..., pk]（#cf_span[1 ≤ pi ≤ n]）——每个整数表示一个警察局所在的城市。\n\n接下来的 #cf_span[n - 1] 行中，第 #cf_span[i] 行包含两个整数 #cf_span[ui] 和 #cf_span[vi]（#cf_span[1 ≤ ui, vi ≤ n]，#cf_span[ui ≠ vi]）——表示由编号为 #cf_span[i] 的道路直接连接的两座城市。\n\n保证仅通过这些道路，可以从任意一座城市到达其他任何城市。同时，从任意城市出发，都能在 #cf_span[d] 公里内到达一个警察局。\n\n第一行输出一个整数 #cf_span[s]，表示最多可以关闭的道路数量。\n\n第二行输出 #cf_span[s] 个互不相同的整数，表示这些可关闭道路的编号，顺序任意。\n\n如果存在多个答案，输出任意一个即可。\n\n在第一个样例中，如果关闭道路 #cf_span[5]，所有城市仍能在 #cf_span[k = 4] 公里内到达警察局。\n\n在第二个样例中，虽然这是唯一一组可关闭的最大合法道路集合，但你可以在第二行输出 _4 5_ 或 _5 4_。"},{"iden":"input","content":"第一行包含三个整数 #cf_span[n]、#cf_span[k] 和 #cf_span[d]（#cf_span[2 ≤ n ≤ 3·105]，#cf_span[1 ≤ k ≤ 3·105]，#cf_span[0 ≤ d ≤ n - 1]）——分别表示城市数量、警察局数量和距离限制（单位：公里）。第二行包含 #cf_span[k] 个整数 #cf_span[p1, p2, ..., pk]（#cf_span[1 ≤ pi ≤ n]）——每个整数表示一个警察局所在的城市。第 #cf_span[i] 行（接下来的 #cf_span[n - 1] 行中）包含两个整数 #cf_span[ui] 和 #cf_span[vi]（#cf_span[1 ≤ ui, vi ≤ n]，#cf_span[ui ≠ vi]）——表示由编号为 #cf_span[i] 的道路直接连接的两座城市。保证仅通过这些道路，可以从任意一座城市到达其他任何城市。同时，从任意城市出发，都能在 #cf_span[d] 公里内到达一个警察局。"},{"iden":"output","content":"第一行输出一个整数 #cf_span[s]，表示最多可以关闭的道路数量。第二行输出 #cf_span[s] 个互不相同的整数，表示这些可关闭道路的编号，顺序任意。如果存在多个答案，输出任意一个即可。"},{"iden":"examples","content":"输入\n6 2 4\n1 6\n1 2\n2 3\n3 4\n4 5\n5 6\n输出\n1\n5\n\n输入\n6 3 2\n1 5 6\n1 2\n1 3\n1 4\n1 5\n5 6\n输出\n2\n4 5 "},{"iden":"note","content":"在第一个样例中，如果关闭道路 #cf_span[5]，所有城市仍能在 #cf_span[k = 4] 公里内到达警察局。在第二个样例中，虽然这是唯一一组可关闭的最大合法道路集合，但你可以在第二行输出 _4 5_ 或 _5 4_。"}],"sample_group":[],"show_order":[],"formal_statement":"**Definitions**  \nLet $ n, k, d \\in \\mathbb{Z} $ with $ 2 \\leq n \\leq 3 \\cdot 10^5 $, $ 1 \\leq k \\leq 3 \\cdot 10^5 $, $ 0 \\leq d \\leq n - 1 $.  \nLet $ P = \\{p_1, p_2, \\dots, p_k\\} \\subseteq \\{1, 2, \\dots, n\\} $ be the set of cities containing at least one police station.  \nLet $ G = (V, E) $ be a tree with $ V = \\{1, 2, \\dots, n\\} $ and $ |E| = n - 1 $, where each edge has length 1.  \nLet $ \\text{dist}(u, v) $ denote the shortest path distance between vertices $ u $ and $ v $ in $ G $.  \n\n**Constraints**  \n1. For every city $ v \\in V $, $ \\min_{p \\in P} \\text{dist}(v, p) \\leq d $.  \n2. The graph $ G $ is a tree (connected, acyclic, $ |E| = n - 1 $).  \n\n**Objective**  \nFind the maximum number of edges $ s $ that can be removed from $ G $ such that in the resulting forest $ G' = (V, E') $ with $ |E'| = n - 1 - s $, the condition  \n$$\n\\forall v \\in V, \\quad \\min_{p \\in P} \\text{dist}_{G'}(v, p) \\leq d\n$$  \nstill holds.  \nAdditionally, output the indices of any such $ s $ edges that can be removed.","simple_statement":null,"has_page_source":false}