#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > gr;
int cnt[400010], root, rt, n;
bool ans[400010];
vector<pair<int, int> > subtr;
void dfscnt(int v, int p) {
  cnt[v] = 1;
  int tmp = 0;
  for (auto i : gr[v]) {
    if (i == p) {
      continue;
    }
    dfscnt(i, v);
    tmp = max(tmp, cnt[i]);
    cnt[v] += cnt[i];
  }
  tmp = max(n - cnt[v], tmp);
  if (tmp <= n / 2) {
    root = v;
  }
  return;
}
void dfs(int v, int p, int subpar) {
  if (cnt[subpar] == n - n / 2) {
    ans[v] = 1;
  }
  for (int i = 0; i < subtr.size(); ++i) {
    if (subtr[i].second == subpar) {
      continue;
    }
    if (n - subtr[i].first - cnt[v] <= n / 2) {
      ans[v] = 1;
    } else {
      break;
    }
  }
  for (auto i : gr[v]) {
    if (i == p) {
      continue;
    }
    dfs(i, v, subpar);
  }
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> n;
  vector<int> vi;
  gr.resize(n, vi);
  for (int i = 0; i < n - 1; ++i) {
    int u, v;
    cin >> u >> v;
    --u, v--;
    gr[u].push_back(v);
    gr[v].push_back(u);
  }
  dfscnt(0, -1);
  ans[root] = 1;
  rt = root;
  dfscnt(rt, -1);
  root = rt;
  for (int i = 0; i < gr[root].size(); ++i) {
    subtr.push_back({cnt[gr[root][i]], gr[root][i]});
  }
  sort(subtr.begin(), subtr.end());
  reverse(subtr.begin(), subtr.end());
  for (int i = 0; i < subtr.size(); ++i) {
    dfs(subtr[i].second, root, subtr[i].second);
  }
  for (int i = 0; i < n; ++i) {
    cout << ans[i] << " ";
  }
}
