#include <bits/stdc++.h>
using namespace std;
const int M = 4e5 + 7;
inline int rd() {
  int x = 0;
  bool f = 1;
  char c = getchar();
  for (; !isdigit(c); c = getchar())
    if (c == '-') f = 0;
  for (; isdigit(c); c = getchar()) x = x * 10 + c - 48;
  return f ? x : -x;
}
struct vec {
  int g[M], te;
  struct edge {
    int y, nxt;
    edge(int _y = 0, int _nxt = 0) { y = _y, nxt = _nxt; }
  } e[M << 1];
  vec() {
    memset(g, 0, sizeof g);
    te = 0;
  }
  inline void push(int x, int y) {
    e[++te] = edge(y, g[x]);
    g[x] = te;
  }
  inline void push2(int x, int y) {
    push(x, y);
    push(y, x);
  }
  inline int& operator()(int x) { return g[x]; }
  inline edge& operator[](int x) { return e[x]; }
} e;
int n;
int sz[M], ok[M];
int dw[M], up[M];
void merge(int& x, int y) {
  if (y <= n / 2) x = max(x, y);
}
void dfs1(int x, int fa) {
  int p, y;
  dw[x] = -1;
  sz[x] = 1;
  for (p = e(x); p; p = e[p].nxt)
    if ((y = e[p].y) != fa) {
      dfs1(y, x);
      sz[x] += sz[y];
      merge(dw[x], dw[y]);
    }
  merge(dw[x], sz[x]);
}
void dfs2(int x, int fa) {
  int p, y;
  if (n - sz[x] > n / 2) {
    if (n - sz[x] - up[x] <= n / 2) ok[x] = 1;
  } else {
    int mx = -1;
    for (p = e(x); p; p = e[p].nxt)
      if ((y = e[p].y) != fa) {
        if (sz[y] > n / 2) {
          mx = sz[y];
          break;
        }
      }
    if (mx == -1)
      ok[x] = 1;
    else if (mx - dw[y] <= n / 2)
      ok[x] = 1;
  }
  int mx = -1, sc = -1, tp;
  for (p = e(x); p; p = e[p].nxt)
    if ((y = e[p].y) != fa) {
      tp = -1;
      merge(tp, dw[y]);
      if (tp >= mx)
        sc = mx, mx = tp;
      else if (tp > sc)
        sc = tp;
    }
  for (p = e(x); p; p = e[p].nxt)
    if ((y = e[p].y) != fa) {
      up[y] = -1;
      merge(up[y], up[x]);
      merge(up[y], n - sz[y]);
      if (dw[y] == mx)
        merge(up[y], sc);
      else
        merge(up[y], mx);
      dfs2(y, x);
    }
}
int main() {
  int i;
  n = rd();
  for (i = 1; i < n; i++) e.push2(rd(), rd());
  dfs1(1, 0);
  up[1] = n;
  dfs2(1, 0);
  for (i = 1; i <= n; i++) printf("%d ", ok[i]);
  return 0;
}
