#include <bits/stdc++.h>
using namespace std;
const int N = 400010;
struct Node {
  int fi, se;
  void insert(int x) {
    if (x > fi) {
      se = fi;
      fi = x;
    } else if (x > se)
      se = x;
  }
  int get(int x) {
    if (x == fi)
      return se;
    else
      return fi;
  }
} dn[N];
int h[N], ne[N << 1], e[N << 1], idx;
int n, siz[N], fa[N], son[N], up[N];
int calc(int u) { return siz[u] <= n / 2 ? siz[u] : dn[u].fi; }
void dfs1(int u) {
  siz[u] = 1;
  for (int i = h[u]; ~i; i = ne[i]) {
    int v = e[i];
    if (v == fa[u]) continue;
    fa[v] = u;
    dfs1(v);
    siz[u] += siz[v];
    dn[u].insert(calc(v));
  }
}
void dfs2(int u) {
  if (n - siz[u] <= n / 2)
    up[u] = n - siz[u];
  else
    up[u] = max(up[fa[u]], dn[fa[u]].get(calc(u)));
  for (int i = h[u]; ~i; i = ne[i]) {
    int v = e[i];
    if (v == fa[u]) continue;
    dfs2(v);
    if (siz[v] > siz[son[u]]) son[u] = v;
  }
  if (n - siz[u] > siz[son[u]]) son[u] = fa[u];
}
void add(int a, int b) {
  e[idx] = b;
  ne[idx] = h[a];
  h[a] = idx++;
}
int main() {
  memset(h, -1, sizeof h);
  cin >> n;
  for (int i = 1; i < n; ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    add(u, v);
    add(v, u);
  }
  dfs1(1);
  dfs2(1);
  for (int u = 1; u <= n; ++u) {
    int mx, sz;
    int v = son[u];
    if (v == fa[u]) {
      sz = n - siz[u];
      mx = up[u];
    } else {
      sz = siz[v];
      mx = dn[v].fi;
    }
    printf("%d ", sz - mx <= n / 2);
  }
  return 0;
}
