#include <bits/stdc++.h>
using namespace std;
const long double eqs = 1e-6;
const long long max_ = 1e6 + 7;
const int mod = 998244353;
const int inf = 1e9 + 7;
const long long INF = 2e18 + 7;
inline int read() {
  int s = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    s = s * 10 + ch - '0';
    ch = getchar();
  }
  return s * f;
}
inline void write(int x) {
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  if (x > 9) write(x / 10);
  putchar(x % 10 + '0');
}
vector<int> xian[max_];
int N, siz[max_], MSid[max_], f[max_], N2, g[max_], fid[max_], father[max_];
void dfs(int now, int fa) {
  father[now] = fa;
  siz[now] = 1;
  for (int to : xian[now]) {
    if (to == fa) continue;
    dfs(to, now);
    siz[now] += siz[to];
    if (f[to] <= N2 && f[to] > f[now]) {
      f[now] = f[to];
      fid[now] = to;
    }
    if (siz[to] <= N2 && siz[to] > f[now]) {
      f[now] = siz[to];
      fid[now] = to;
    }
    if (siz[MSid[now]] < siz[to]) {
      MSid[now] = to;
    }
  }
}
void dfs2(int now, int fa) {
  if (fa) {
    if (N - siz[now] <= N2)
      g[now] = N - siz[now];
    else {
      if (g[fa] <= N2) g[now] = ((g[now]) > (g[fa]) ? (g[now]) : (g[fa]));
      if (fid[fa] == now) {
        for (int to : xian[fa]) {
          if (to == now || to == father[fa]) continue;
          if (f[to] <= N2 && f[to] > g[now]) {
            g[now] = f[to];
          }
          if (siz[to] <= N2 && siz[to] > g[now]) {
            g[now] = siz[to];
          }
        }
      } else
        g[now] = ((g[now]) > (f[fa]) ? (g[now]) : (f[fa]));
    }
  }
  for (int to : xian[now]) {
    if (to == fa) continue;
    dfs2(to, now);
  }
}
inline void ini() {
  N = read();
  N2 = N / 2;
  register int A, B, i, j;
  for (i = 2; i <= N; ++i) {
    A = read();
    B = read();
    xian[A].push_back(B);
    xian[B].push_back(A);
  }
  dfs(1, 0);
  dfs2(1, 0);
  for (i = 1; i <= N; i++) {
    if (siz[MSid[i]] <= N2 && N - siz[i] <= N2) {
      printf("1 ");
    } else {
      if (N - siz[i] > N2) {
        if (N - siz[i] - g[i] <= N2) {
          printf("1 ");
        } else
          printf("0 ");
      } else {
        if (siz[MSid[i]] - f[MSid[i]] <= N2)
          printf("1 ");
        else
          printf("0 ");
      }
    }
  }
}
signed main() {
  ini();
  return 0;
}
