#include <bits/stdc++.h>
using namespace std;
vector<int> G[400005];
int subtree[400005], n, root, maximo;
bool ans[400005];
pair<int, int> max1, max2;
int dfs(int v, int p) {
  subtree[v] = 1;
  for (int x : G[v])
    if (x != p) subtree[v] += dfs(x, v);
  return subtree[v];
}
int centroid(int v, int p) {
  for (int x : G[v]) {
    if (x == p) continue;
    if ((long long)subtree[x] * 2 > n) return centroid(x, v);
  }
  return v;
}
void dfs2(int v, int p) {
  if (((long long)n - maximo - subtree[v]) * 2 > n)
    ans[v] = 0;
  else
    ans[v] = 1;
  for (int x : G[v]) {
    if (x != p) dfs2(x, v);
  }
}
void dfs3(int v, int p) {
  ans[v] = 1;
  for (int x : G[v]) {
    if (x != p) dfs3(x, v);
  }
}
int main() {
  int a, b, i;
  scanf("%d", &n);
  for (i = 1; i < n; i++) {
    scanf("%d%d", &a, &b);
    G[a].push_back(b);
    G[b].push_back(a);
  }
  dfs(1, -1);
  int cent = centroid(1, -1);
  ans[cent] = 1;
  dfs(cent, -1);
  for (int x : G[cent]) {
    if (subtree[x] > max1.first) {
      max2 = max1;
      max1 = make_pair(subtree[x], x);
      continue;
    }
    if (subtree[x] > max2.first) max2 = make_pair(subtree[x], x);
  }
  for (int x : G[cent]) {
    root = x;
    if (max1.second == x)
      maximo = max2.first;
    else
      maximo = max1.first;
    if (subtree[x] * 2 == n)
      dfs3(x, cent);
    else
      dfs2(x, cent);
  }
  printf("%d", ans[1]);
  for (i = 2; i <= n; i++) printf(" %d", ans[i]);
  printf("\n");
  return 0;
}
