#include <bits/stdc++.h>
using namespace std;
const int N = 4e5;
vector<int> g[N + 100];
vector<pair<int, int> > ele;
int subt[N + 100], center, n, ans[N + 100];
void dfs(int v, int par) {
  int mx = 0;
  subt[v] = 1;
  for (auto it : g[v]) {
    if (it != par) {
      dfs(it, v);
      subt[v] += subt[it];
      mx = max(subt[it], mx);
    }
  }
  mx = max(mx, n - subt[v]);
  if (mx <= n / 2) {
    center = v;
  }
}
void dfs2(int v, int par, int sum, int anc) {
  if (sum <= n / 2) {
    ans[v] = 1;
  }
  for (int sz = ele.size(), i = 0; i < sz && i < 2; i++) {
    if (ele[i].second == anc) continue;
    if (n - subt[v] - ele[i].first <= n / 2) {
      ans[v] = 1;
    }
  }
  for (auto it : g[v]) {
    if (it != par) {
      dfs2(it, v, sum, anc);
    }
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i < n; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    g[u].push_back(v);
    g[v].push_back(u);
  }
  dfs(1, 0);
  dfs(center, 0);
  for (auto it : g[center]) {
    ele.push_back(make_pair(subt[it], it));
  }
  sort(ele.begin(), ele.end());
  reverse(ele.begin(), ele.end());
  for (auto it : g[center]) {
    dfs2(it, center, n - subt[it], it);
  }
  ans[center] = 1;
  for (int i = 1; i <= n; i++) {
    printf("%d ", ans[i]);
  }
  printf("\n");
}
