#include <bits/stdc++.h>
using namespace std;
const int N = 400010;
pair<int, int> fi[N], se[N];
struct node {
  int to, next;
};
node edge[N * 2];
int graph[N], c;
int cmp;
int size[N], up[N];
int ok[N];
int n;
void addedge(int i, int u, int v) {
  edge[i].to = v;
  edge[i].next = graph[u];
  graph[u] = i;
}
void dfs1(int u, int pre) {
  int i, v, tmp;
  fi[u] = make_pair(0, -1);
  se[u] = make_pair(0, -1);
  size[u] = 1;
  for (i = graph[u]; i; i = edge[i].next) {
    v = edge[i].to;
    if (v == pre) continue;
    dfs1(v, u);
    size[u] += size[v];
    if (size[v] <= cmp)
      tmp = size[v];
    else
      tmp = fi[v].first;
    if (tmp > fi[u].first) {
      se[u] = fi[u];
      fi[u] = make_pair(tmp, v);
    } else if (tmp > se[u].first) {
      se[u] = make_pair(tmp, v);
    }
  }
}
void work(int u, int pre) {
  if (n - size[u] <= cmp) {
    up[u] = n - size[u];
    return;
  }
  up[u] = up[pre];
  if (fi[pre].second != u) {
    up[u] = max(up[u], fi[pre].first);
  } else
    up[u] = max(up[u], se[pre].first);
}
void dfs2(int u, int pre) {
  int i, v;
  for (i = graph[u]; i; i = edge[i].next) {
    v = edge[i].to;
    if (v == pre) continue;
    work(v, u);
    dfs2(v, u);
  }
}
void dfs3(int u, int pre) {
  int i, v;
  int maxx = 0;
  for (i = graph[u]; i; i = edge[i].next) {
    v = edge[i].to;
    if (v == pre) continue;
    maxx = max(maxx, size[v] - fi[v].first);
    dfs3(v, u);
  }
  maxx = max(n - size[u] - up[u], maxx);
  if (maxx <= cmp) ok[u] = 1;
}
int main() {
  int i, u, v;
  scanf("%d", &n);
  cmp = n / 2;
  for (i = 1; i <= n - 1; i++) {
    scanf("%d%d", &u, &v);
    c++;
    addedge(c, u, v);
    c++;
    addedge(c, v, u);
  }
  dfs1(1, 0);
  dfs2(1, 0);
  dfs3(1, 0);
  for (i = 1; i <= n; i++) {
    printf("%d ", ok[i]);
  }
}
