#include "bits/stdc++.h"
using namespace std;
const int MAX = 100100;
vector<int> g[MAX];
bool B[MAX];
vector<pair<int,int>> res;
void no()
{
cout << "NO" << endl;
exit(0);
}
int dfs(int x, int p)
{
int a = -1;
int b = -1;
if (B[x]) a = x;
for(int i = 0; i < g[x].size(); ++i)
{
int to = g[x][i];
if (to == p) continue;
int v = dfs(to, x);
if (v != -1)
{
if (b != -1) no();
b = a;
a = v;
}
}
if (a != -1 && b != -1)
{
res.push_back(make_pair(a, b));
return -1;
}
if (a != -1) return a;
return -1;
}
int main()
{
int n, k;
scanf("%d%d", &n, &k);
for (int i = 0; i < k; ++i)
{
int x;
scanf("%d", &x);
x--;
B[x] = true;
}
for (int i = 0; i < n-1; ++i)
{
int x, y;
scanf("%d%d", &x, &y);
x--;
y--;
g[x].push_back(y);
g[y].push_back(x);
}
if (dfs(n-1, -1) != -1) no();
printf("YES\n");
for (int i = 0; i < res.size(); ++i)
{
printf("%d %d\n", res[i].first + 1, res[i].second + 1);
}
}