Alice and Bob are playing a game. They have a tree consisting of n vertices. Initially, Bob has k chips, the i-th chip is located in the vertex a_i (all these vertices are unique). Before the game starts, Alice will place a chip into one of the vertices of the tree.

The game consists of turns. Each turn, the following events happen (sequentially, exactly in the following order):

  1. Alice either moves her chip to an adjacent vertex or doesn't move it; 
  2. for each Bob's chip, he either moves it to an adjacent vertex or doesn't move it. Note that this choice is done independently for each chip. 



The game ends when Alice's chip shares the same vertex with one (or multiple) of Bob's chips. Note that Bob's chips may share the same vertex, even though they are in different vertices at the beginning of the game.

Alice wants to maximize the number of turns, Bob wants to minimize it. If the game ends in the middle of some turn (Alice moves her chip to a vertex that contains one or multiple Bob's chips), this turn is counted.

For each vertex, calculate the number of turns the game will last if Alice places her chip in that vertex.

Input

The first line contains one integer n (2 ≤ n ≤ 2 ⋅ 10^5) — the number of vertices in the tree.

Then n - 1 lines follow, each line contains two integers u_i, v_i (1 ≤ u_i, v_i ≤ n; u_i ≠ v_i) that denote the endpoints of an edge. These edges form a tree.

The next line contains one integer k (1 ≤ k ≤ n - 1) — the number of Bob's chips.

The last line contains k integers a_1, a_2, ..., a_k (1 ≤ a_i ≤ n; a_i ≠ a_j if i ≠ j) — the vertices where the Bob's chips are initially placed.

Output

Print n integers. The i-th of them should be equal to the number of turns the game will last if Alice initially places her chip in the vertex i. If one of Bob's chips is already placed in vertex i, then the answer for vertex i is 0.

Examples

Input


5
2 4
3 1
3 4
3 5
2
4 5


Output


2 1 2 0 0


Input


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


Output


3 0 0 3 1 2 3 0


Input


10
2 5
4 3
7 3
7 2
5 8
3 6
8 10
7 9
7 1
4
10 6 9 1


Output


0 2 2 2 2 0 2 2 0 0
#include<bits/stdc++.h>
using namespace std;
const int maxn=3e5+5;
const int mod=1e9+7;
const int inf=1e9;
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define rep(i,a,n) for (int i=a;i<=n;i++)
#define per(i,a,n) for (int i=n;i>=a;i--)
typedef long long ll;
typedef double db;
typedef vector<int> vi;
typedef pair<int,int> pii;
ll qpow(ll a,ll b){ll ans=1;a%=mod;assert(b>=0);for(;b;b>>=1){if(b&1)ans=ans*a%mod;a=a*a%mod;}return ans;}
ll gcd(ll a,ll b){return b>0?gcd(b,a%b):a;}
int n,m,T;
int a[maxn],d[maxn];

vi g[maxn],dis[maxn],val[maxn];
int pre[maxn],mx[maxn];
bool vis[maxn];
namespace dfz{
	int MX,SZ,root;
	int sz[maxn];
	int mxson[maxn];
	void getRoot(int u,int fa){
		sz[u]=1;mxson[u]=0;
		for(auto v:g[u]){
			if(v==fa||vis[v]) continue;
			getRoot(v,u);
			sz[u]+=sz[v];
			mxson[u]=max(mxson[u],sz[v]);
		}
		mxson[u]=max(mxson[u],SZ-sz[u]);
		if(mxson[u]<MX) {
			root = u;
			MX=mxson[u];
		}
	}
	void dfs(int u,int fa,int dep,int rt){
		dis[u].pb(dep);
		for(auto v:g[u]){
			if(v==fa||vis[v]) continue;
			dfs(v,u,dep+1,rt);
		}
		mx[rt]=max(mx[rt],dep);
	}
	void divide(int rt){
		vis[rt]=1;
		for(auto v:g[rt]){
			if(vis[v]) continue;
			SZ=sz[v];
			root=0;
			MX=inf;
			getRoot(v,v);
			pre[root]=rt;
			divide(root);
		}
		vis[rt]=0;
		dfs(rt,rt,0,rt);
		return;
	}
}

int main() {
	scanf("%d",&n); 
	for(int i=1;i<=n;i++) pre[i]=i;
	for(int u,v,i=1;i<=n-1;i++){
		scanf("%d%d",&u,&v);
		g[u].pb(v);
		g[v].pb(u);
	}
	scanf("%d",&m);
	queue<int>q;
	for(int temp,i=1;i<=m;i++){
		scanf("%d",&temp);
		q.push(temp);
		d[temp]=0;
		vis[temp]=1;
	}
	while(!q.empty()){
		int u=q.front();q.pop();
		for(auto v:g[u]){
			if(vis[v])continue;
			d[v]=d[u]+1;
			vis[v]=1;
			q.push(v);
		}
	}
	for(int i=1;i<=n;i++) vis[i]=0;
	dfz::MX=inf;
	dfz::SZ=n;
	dfz::getRoot(1,1);
	dfz::divide(dfz::root);
	for(int i=1;i<=n;i++) val[i]=vi(mx[i]+1,0);
	for(int i=1;i<=n;i++){
		int u=i;
		for(auto x:dis[i]){
			if(x<d[i]){
				int temp=min(d[i]-1-x, (int)val[u].size() -1);
				val[u][temp]=max(val[u][temp],d[i]);
			}
			u=pre[u];
		}
	}
	for(int i=1;i<=n;i++){
		for(int j=val[i].size()-2;j>=0;j--){
			val[i][j]=max(val[i][j],val[i][j+1]);
		}
	}
	for(int ans,i=1;i<=n;i++){
		int u=i;
		ans=0;
		for(auto x:dis[i]){
			ans=max(ans,val[u][x]);
			u=pre[u];
		}
		if(d[i]==0){
			ans=0;
		}
		printf("%d%c", ans, " \n"[i==n]);
	}
	return 0;
}
/*
13
1 2
2 3
3 4
3 5
3 6
4 7
4 8
5 9
5 10
6 11
6 12
11 13
3
7 9 13
*/