#include <bits/stdc++.h>
using namespace std;
const int maxn = 400010;
int n, tot, head[maxn << 1];
int f[maxn], size[maxn], maxsize[maxn];
int dp[maxn][2], pos[maxn], ans[maxn];
struct edge {
  int to, next;
} e[maxn << 1];
void add(int u, int v) {
  e[++tot] = edge{v, head[u]};
  head[u] = tot;
}
void dfs(int u, int fa) {
  size[u] = 1;
  for (int i = head[u]; i; i = e[i].next) {
    int v = e[i].to, vsize;
    if (v != fa) {
      dfs(v, u);
      size[u] += size[v];
      if (size[v] > size[maxsize[u]]) maxsize[u] = v;
      if (size[v] <= n / 2)
        vsize = size[v];
      else
        vsize = dp[v][0];
      if (dp[u][0] < vsize) {
        dp[u][1] = dp[u][0];
        dp[u][0] = vsize;
        pos[u] = v;
      } else if (dp[u][1] < vsize)
        dp[u][1] = vsize;
    }
  }
}
void dfs2(int u, int fa) {
  ans[u] = 1;
  if (size[maxsize[u]] > n / 2)
    ans[u] = (size[maxsize[u]] - dp[maxsize[u]][0] <= n / 2);
  else if (n - size[u] > n / 2)
    ans[u] = (n - size[u] - f[u] <= n / 2);
  for (int i = head[u]; i; i = e[i].next) {
    int v = e[i].to, vsize;
    if (v != fa) {
      if (n - size[u] > n / 2)
        vsize = f[u];
      else
        vsize = n - size[u];
      f[v] = max(f[v], vsize);
      if (pos[u] == v)
        f[v] = max(f[v], dp[u][1]);
      else
        f[v] = max(f[v], dp[u][0]);
      dfs2(v, u);
    }
  }
}
int main() {
  scanf("%d", &n);
  int x, y;
  for (int i = 1; i <= n - 1; i++) {
    scanf("%d %d", &x, &y);
    add(x, y);
    add(y, x);
  }
  dfs(1, 0);
  dfs2(1, 0);
  for (int i = 1; i <= n; i++) printf("%d ", ans[i]);
  printf("\n");
  return 0;
}
