#include <bits/stdc++.h>
using namespace std;
int idxE;
struct EDGE {
  int v, next;
} edge[400005 << 1];
int head[400005];
void add_edge(int u, int v) {
  ++idxE;
  edge[idxE].v = v;
  edge[idxE].next = head[u];
  head[u] = idxE;
}
int n, ans[400005];
int sz[400005], dp1[400005], dp2[400004];
void dfs(int u, int fa) {
  sz[u] = 1;
  for (int i = head[u]; i; i = edge[i].next)
    if (edge[i].v != fa) {
      int v = edge[i].v;
      dfs(v, u);
      sz[u] += sz[v];
      dp1[u] = max(dp1[u], dp1[v]);
    }
  if (sz[u] <= n / 2) dp1[u] = sz[u];
}
void getans(int u, int fa) {
  ans[u] = 1;
  if (sz[u] <= n / 2) {
    if (n - sz[u] - dp2[u] > n / 2) ans[u] = 0;
  } else {
    for (int i = head[u]; i; i = edge[i].next)
      if (edge[i].v != fa) {
        int v = edge[i].v;
        if (sz[v] - dp1[v] > n / 2) ans[u] = 0;
      }
  }
  int ma = -1, mav;
  for (int i = head[u]; i; i = edge[i].next)
    if (edge[i].v != fa) {
      int v = edge[i].v;
      if (dp1[v] > ma) ma = dp1[v], mav = v;
    }
  for (int i = head[u]; i; i = edge[i].next)
    if (edge[i].v != fa) {
      int v = edge[i].v;
      if (v == mav) {
        dp2[v] = dp2[u];
        for (int j = head[u]; j; j = edge[j].next)
          if (edge[j].v != mav && edge[j].v != fa) {
            int vv = edge[j].v;
            dp2[v] = max(dp2[v], dp1[vv]);
          }
      } else
        dp2[v] = max(dp2[u], ma);
      if (n - sz[v] <= n / 2) dp2[v] = n - sz[v];
      getans(v, u);
    }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n - 1; ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    add_edge(u, v), add_edge(v, u);
  }
  dfs(1, -1);
  getans(1, -1);
  for (int i = 1; i <= n; ++i) printf("%d ", ans[i]);
  return 0;
}
