#include <bits/stdc++.h>
using namespace std;
vector<vector<pair<int, int>>> g;
vector<int> ans;
int n, h;
int dfs(int i, int p) {
  int sum = 1;
  pair<int, int>* pr;
  for (auto& v : g[i]) {
    if (v.second == p) {
      pr = &v;
      continue;
    }
    v.first = dfs(v.second, i);
    sum += v.first;
  }
  if (p != -1) {
    pr->first = n - sum;
  }
  return sum;
}
void dfs2(int i, int p) {
  ans[i] = 1;
  for (auto& v : g[i]) {
    if (v.second == p) continue;
    dfs2(v.second, i);
  }
}
void dfs3(int i, int p, int t) {
  pair<int, int>* pr;
  for (auto& v : g[i]) {
    if (v.second == p) {
      pr = &v;
      continue;
    }
    dfs3(v.second, i, t);
  }
  if (pr->first <= h + t) ans[i] = 1;
}
int main() {
  int u, v;
  scanf("%d", &n);
  h = n >> 1;
  if (n < 3) {
    for (int i = 0; i < n; ++i) printf("1 ");
    printf("\n");
    return 0;
  }
  g.assign(n, vector<pair<int, int>>());
  ans.assign(n, 0);
  for (int i = 1; i < n; ++i) {
    scanf("%d %d", &u, &v);
    --u, --v;
    g[v].push_back(make_pair(0, u));
    g[u].push_back(make_pair(0, v));
  }
  dfs(0, -1);
  int mid;
  bool ismid;
  for (mid = 0; mid < n; ++mid) {
    ismid = true;
    for (auto& v : g[mid])
      if (v.first > h) {
        ismid = false;
        break;
      }
    if (ismid) break;
  }
  ans[mid] = 1;
  sort(g[mid].begin(), g[mid].end());
  pair<int, int>* elast = &(*(g[mid].end() - 1));
  for (auto& e : g[mid]) {
    if (n - e.first <= h)
      dfs2(e.second, mid);
    else {
      if (&e == elast) continue;
      dfs3(e.second, mid, elast->first);
    }
  }
  dfs3(elast->second, mid, (elast - 1)->first);
  for (int i = 0; i < n; ++i) printf("%d ", ans[i]);
  printf("\n");
}
