#include <bits/stdc++.h>
#pragma optimize(3)
using namespace std;
int n;
struct edge {
  int y, nxt;
  edge() {}
  edge(int yy, int nn) { y = yy, nxt = nn; }
} e[400009 * 2];
int head[400009], ecnt;
void addedge(int x, int y) {
  ecnt++;
  e[ecnt] = edge(y, head[x]);
  head[x] = ecnt;
  return;
}
int siz[400009], son[400009], fa[400009], son2[400009], son3[400009],
    spos[400009], mxfa[400009];
void dfs1(int u, int last) {
  fa[u] = last;
  siz[u] = 1;
  for (int i = head[u]; i; i = e[i].nxt) {
    int v = e[i].y;
    if (v != last) {
      dfs1(v, u);
      siz[u] += siz[v];
      if (siz[son[u]] < siz[v]) {
        son[u] = v;
      }
      if (siz[v] <= n / 2) {
        if (siz[v] > son2[u]) {
          son3[u] = son2[u];
          son2[u] = siz[v];
          spos[u] = v;
        } else if (siz[v] > son3[u]) {
          son3[u] = siz[v];
        }
      } else if (son2[v] > son2[u]) {
        son3[u] = son2[u];
        son2[u] = son2[v];
        spos[u] = v;
      } else if (son2[v] > son3[u]) {
        son3[u] = son2[v];
      }
    }
  }
  if (n - siz[u] > siz[son[u]]) {
    son[u] = fa[u];
  }
  return;
}
void dfs2(int u) {
  for (int i = head[u]; i; i = e[i].nxt) {
    int v = e[i].y;
    if (v != fa[u]) {
      if (n - siz[v] <= n / 2) {
        mxfa[v] = max(mxfa[v], n - siz[v]);
      }
      mxfa[v] = max(mxfa[v], mxfa[u]);
      if (spos[u] == v) {
        mxfa[v] = max(mxfa[v], son3[u]);
      } else {
        mxfa[v] = max(mxfa[v], son2[u]);
      }
      dfs2(v);
    }
  }
  return;
}
int main() {
  {
    n = 0;
    char ch;
    int f = 0;
    do {
      ch = getchar();
      if (ch == '-') {
        f = 1;
      }
    } while (ch < '0' || ch > '9');
    while ('0' <= ch && ch <= '9') {
      n = (n << 1) + (n << 3) + ch - 48;
      ch = getchar();
    }
    if (f) n = -n;
  }
  int x, y;
  for (int i = 1; i < n; i++) {
    {
      x = 0;
      char ch;
      int f = 0;
      do {
        ch = getchar();
        if (ch == '-') {
          f = 1;
        }
      } while (ch < '0' || ch > '9');
      while ('0' <= ch && ch <= '9') {
        x = (x << 1) + (x << 3) + ch - 48;
        ch = getchar();
      }
      if (f) x = -x;
    }
    {
      y = 0;
      char ch;
      int f = 0;
      do {
        ch = getchar();
        if (ch == '-') {
          f = 1;
        }
      } while (ch < '0' || ch > '9');
      while ('0' <= ch && ch <= '9') {
        y = (y << 1) + (y << 3) + ch - 48;
        ch = getchar();
      }
      if (f) y = -y;
    }
    addedge(x, y);
    addedge(y, x);
  }
  dfs1(1, 0);
  dfs2(1);
  for (int i = 1; i <= n; i++) {
    int flag;
    if (son[i] == fa[i]) {
      flag = (n - siz[i] - mxfa[i] <= n / 2);
    } else {
      flag = (siz[son[i]] - son2[i] <= n / 2);
    }
    printf("%d ", flag);
  }
  puts("");
  return 0;
}
