#include <bits/stdc++.h>
using namespace std;
void solve(long long c);
int main() {
  freopen("traverse.in","r",stdin);
  freopen("traverse.out","w",stdout);
  int c,tt = 1;
  cin >> c >> tt;
  while(tt--) {
  	solve(1ll * c);
  }
  return 0;
}

#define int long long

inline int Read() {
  int x = 0,f = 1;
  char c = getchar();
  for(;c < '0' || c > '9';c = getchar()) f ^= (c == '-');
  for(;c >= '0' && c <= '9';c = getchar()) x = (x << 3) + (x << 1) + (c ^ 48);
  return f ? x : -x;
}

const int _ = 1e5 + 5,Mod = 1e9 + 7;

int n,k,cnt;
int u[_],v[_],e[_];

void solve(int c) {
  n = Read(),k = Read();
  for(int i = 1;i < n;i++) {
  	u[i] = Read(),v[i] = Read();
  }
  for(int i = 1;i <= k;i++) {
  	e[i] = Read();
  }
  if(c == 18) {
  	puts("1");
  	return;
  }
}
