#include <bits/stdc++.h>
using namespace std;
int const N = 400010;
int const M = 1001000;
int n, m;
struct edges {
  int u, next;
} e[M];
int p[N], idx;
void addedge(int u, int v) { e[idx].u = v, e[idx].next = p[u], p[u] = idx++; }
void init() {
  idx = 0;
  memset(p, (0xff), sizeof p);
}
int key[N];
int sz[N];
int dep[N];
void dfs(int u, int d, int pre = -1) {
  sz[u] = 1;
  dep[u] = d;
  for (int i = p[u]; ~i; i = e[i].next) {
    int v = e[i].u;
    if (v != pre) {
      dfs(v, d + 1, u);
      sz[u] += sz[v];
    }
  }
  for (int i = p[u]; ~i; i = e[i].next) {
    int v = e[i].u;
    if (v != pre) {
      if (sz[v] + sz[v] > n) key[u] = v;
    }
  }
  if (pre != -1 && sz[u] + sz[u] < n) key[u] = pre;
}
int dp[N];
int dpu[N];
void dfs1(int u, int pre = -1) {
  for (int i = p[u]; ~i; i = e[i].next) {
    int v = e[i].u;
    if (v != pre) {
      dfs1(v, u);
      dp[u] = max(dp[u], dp[v]);
    }
  }
  if (sz[u] + sz[u] <= n) dp[u] = sz[u];
}
void dfs2(int u, int pre = -1) {
  int m1 = dpu[u], m2 = 0;
  for (int i = p[u]; ~i; i = e[i].next) {
    int v = e[i].u;
    if (v != pre) {
      dp[u] = max(dp[u], dp[v]);
      if (dp[v] >= m1) {
        m2 = m1;
        m1 = dp[v];
      } else if (dp[v] >= m2) {
        m2 = dp[v];
      }
    }
  }
  for (int i = p[u]; ~i; i = e[i].next) {
    int v = e[i].u;
    if (v != pre) {
      int rem = n - sz[v];
      if (rem + rem <= n)
        dpu[v] = rem;
      else {
        if (dp[v] == m1)
          dpu[v] = max(dpu[v], m2);
        else
          dpu[v] = max(dpu[v], m1);
      }
      dfs2(v, u);
    }
  }
}
int main() {
  scanf("%d", &n);
  init();
  for (int i = 0; i < (n - 1); ++i) {
    int a, b;
    scanf("%d%d", &a, &b);
    addedge(a, b);
    addedge(b, a);
  }
  dfs(1, 0);
  dfs1(1);
  dfs2(1);
  for (int i = 1; i <= (n); ++i) {
    if (key[i] == 0)
      printf("1 ");
    else {
      bool ok = 0;
      int u = key[i];
      if (dep[u] > dep[i]) {
        int rem = sz[u] - dp[u];
        if (rem + rem <= n) ok = 1;
      } else {
        int t = dpu[i];
        int rem = n - sz[i];
        if ((rem - t) * 2 <= n) ok = 1;
      }
      if (ok)
        printf("1 ");
      else
        printf("0 ");
    }
  }
  puts("");
  return 0;
}
