#include <bits/stdc++.h>
using namespace std;
int n;
int down[400005];
int up[400005];
int size[400005];
int mxson[400005];
int par[400005];
int son[400005];
int down2[400005];
struct edge {
  int des;
  int next;
} e[400005 << 1];
int cnt;
int head[400005];
void ins(int u, int v) {
  ++cnt;
  e[cnt].des = v;
  e[cnt].next = head[u];
  head[u] = cnt;
}
void dfs1(int u, int f) {
  size[u] = 1;
  par[u] = f;
  for (int i = head[u]; i; i = e[i].next) {
    int v = e[i].des;
    if (v == f) continue;
    dfs1(v, u);
    size[u] += size[v];
    if (size[v] > mxson[u]) son[u] = v, mxson[u] = size[v];
    int tmp = size[v] > n / 2 ? down[v] : size[v];
    if (tmp >= down[u])
      down2[u] = down[u], down[u] = tmp;
    else if (tmp >= down2[u])
      down2[u] = tmp;
  }
}
void dfs2(int u, int f) {
  for (int i = head[u]; i; i = e[i].next) {
    int v = e[i].des;
    if (v == f) continue;
    int tmp = size[v] > n / 2 ? down[v] : size[v];
    if (tmp == down[u])
      up[v] = max(up[v], down2[u]);
    else
      up[v] = max(up[v], down[u]);
    up[v] = max(up[v], n - size[u] > n / 2 ? up[u] : n - size[u]);
    dfs2(v, u);
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i < n; ++i) {
    int u;
    int v;
    scanf("%d %d", &u, &v);
    ins(u, v);
    ins(v, u);
  }
  dfs1(1, 0);
  dfs2(1, 0);
  for (int i = 1; i <= n; ++i) {
    int ans = 1;
    if (mxson[i] > n / 2) ans = (mxson[i] - down[son[i]] <= n / 2);
    if (n - size[i] > n / 2) ans = (n - size[i] - up[i] <= n / 2);
    printf("%d%c", ans, i == n ? '\n' : ' ');
  }
  return 0;
}
