#include <bits/stdc++.h>
using namespace std;
int qtd[400001], _max[400001];
vector<int> graph[400001];
bool ok[400001];
int n;
multiset<int> s;
void coloca(int x) {
  if (x <= n / 2) s.insert(x);
}
void tira(int x) {
  if (x <= n / 2) s.erase(s.find(x));
}
int dfs(int v, int parent) {
  qtd[v] = 1;
  for (int u : graph[v]) {
    if (u == parent) continue;
    qtd[v] += dfs(u, v);
    if (qtd[u] <= n / 2) _max[v] = max(_max[v], qtd[u]);
    _max[v] = max(_max[v], _max[u]);
  }
  if (qtd[v] <= n / 2) _max[v] = max(_max[v], qtd[v]);
  return qtd[v];
}
void dfs2(int v, int parent) {
  if (n - qtd[v] - *--s.end() > n / 2) ok[v] = true;
  for (int u : graph[v])
    if (u != parent) coloca(_max[u]);
  for (int u : graph[v]) {
    if (u == parent) continue;
    if (qtd[u] - _max[u] > n / 2) ok[v] = true;
    coloca(n - qtd[u]);
    tira(_max[u]);
    dfs2(u, v);
    coloca(_max[u]);
    tira(n - qtd[u]);
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    scanf("%d %d", &a, &b);
    graph[a].push_back(b);
    graph[b].push_back(a);
  }
  coloca(0);
  dfs(1, 1);
  dfs2(1, 1);
  for (int i = 1; i <= n; i++) printf("%d ", !ok[i]);
  return 0;
}
