#include <bits/stdc++.h>
using namespace std;
const int N = 501000, mod = 1000000007;
int n, f[N][2], head[N], cnt, k, siz[N], ans[N];
struct EGDE {
  int v, next;
} edge[N * 10];
void add_edge(int u, int v) {
  edge[++cnt].v = v;
  edge[cnt].next = head[u];
  head[u] = cnt;
}
void DFS(int u, int fa) {
  siz[u] = 1;
  for (int i = head[u]; i; i = edge[i].next) {
    int v = edge[i].v;
    if (v == fa) continue;
    DFS(v, u);
    siz[u] += siz[v];
    int t = (siz[v] * 2 <= n ? siz[v] : f[v][0]);
    if (t > f[u][0])
      f[u][1] = f[u][0], f[u][0] = t;
    else if (t > f[u][1])
      f[u][1] = t;
  }
}
void solve(int u, int fa, int up) {
  int x = -1;
  for (int i = head[u]; i; i = edge[i].next) {
    int v = edge[i].v;
    if ((v == fa ? n - siz[u] : siz[v]) * 2 > n) {
      x = v;
      break;
    }
  }
  if (x == -1) {
    ans[u] = 1;
  } else if (x == fa) {
    ans[u] = ((n - siz[u] - up) * 2 <= n);
  } else {
    ans[u] = ((siz[x] - f[x][0]) * 2 <= n);
  }
  if ((n - siz[u]) * 2 <= n) up = n - siz[u];
  for (int i = head[u]; i; i = edge[i].next) {
    int v = edge[i].v;
    if (v == fa) continue;
    int t = (siz[v] * 2 <= n ? siz[v] : f[v][0]);
    solve(v, u, max(up, t == f[u][0] ? f[u][1] : f[u][0]));
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n - 1; ++i) {
    int x, y;
    scanf("%d%d", &x, &y);
    add_edge(x, y);
    add_edge(y, x);
  }
  DFS(1, 0);
  solve(1, 0, 0);
  for (int i = 1; i <= n; ++i) printf("%d ", ans[i]);
  return 0;
}
