#include <bits/stdc++.h>
using namespace std;
const int N = 514514;
struct edge {
  int v, nt;
} e[N << 1];
map<int, int> s[N];
int hd[N], sz[N], f[N], h[N], g[N], as[N];
int n, tot;
void add(int x, int y) {
  e[++tot] = {y, hd[x]};
  hd[x] = tot;
}
int nw(int x, int y) {
  if (x < y) swap(x, y);
  return x > n / 2 ? y : x;
}
void dfs(int x, int fa) {
  sz[x] = 1;
  for (int i = hd[x], to; i; i = e[i].nt) {
    to = e[i].v;
    if (to == fa) continue;
    dfs(to, x);
    sz[x] += sz[to];
    if (f[x] < f[to] && f[to] <= n / 2)
      g[x] = nw(f[x], g[to]), f[x] = f[to];
    else
      g[x] = nw(f[to], g[x]);
    if (sz[to] - f[to] > n / 2) as[x] = 1;
  }
  for (int i = hd[x], to; i; i = e[i].nt) {
    to = e[i].v;
    if (to == fa) continue;
    s[x][to] = f[to] == f[x] ? g[x] : f[x];
  }
  f[x] = nw(f[x], sz[x]);
}
void solve(int x, int fa) {
  for (int i = hd[x], to; i; i = e[i].nt) {
    to = e[i].v;
    if (to == fa) continue;
    h[to] = nw(h[x], nw(s[x][to], n - sz[x]));
    solve(to, x);
    if ((n - sz[to]) > n / 2 && ((n - sz[to] - h[to]) > n / 2)) as[to] = 1;
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1, x, y; i < n; i++) {
    scanf("%d%d", &x, &y);
    add(x, y);
    add(y, x);
  }
  dfs(1, 0);
  solve(1, 0);
  for (int i = 1; i <= n; i++) printf("%d ", as[i] ^ 1);
}
