#include <bits/stdc++.h>
using namespace std;
template <class T>
T sqr(T x) {
  return x * x;
}
const int maxn = 800001;
vector<int> g[maxn];
int lim;
int n, x, y, ans[maxn];
int dp[maxn], sz[maxn];
void dfs(int k, int last = -1) {
  sz[k] = 1;
  dp[k] = 0;
  for (int i = 0; i < g[k].size(); i++) {
    int v = g[k][i];
    if (v == last) continue;
    dfs(v, k);
    sz[k] += sz[v];
    dp[k] = max(dp[k], dp[v]);
  }
  if (sz[k] <= lim) dp[k] = sz[k];
}
void gao(int k, int fsz, int fdp, int last = -1) {
  if (fsz > lim) {
    ans[k] = 0;
    if (fsz - fdp <= lim) ans[k] = 1;
  } else {
    ans[k] = 1;
    for (int i = 0; i < g[k].size(); i++) {
      int v = g[k][i];
      if (v == last) continue;
      if (sz[v] <= lim) continue;
      if (sz[v] - dp[v] > lim) ans[k] = 0;
    }
  }
  set<pair<int, int> > tree;
  for (int i = 0; i < g[k].size(); i++) {
    int v = g[k][i];
    if (v == last) continue;
    tree.insert(pair<int, int>(dp[v], v));
  }
  for (int i = 0; i < g[k].size(); i++) {
    int v = g[k][i];
    if (v == last) continue;
    tree.erase(pair<int, int>(dp[v], v));
    int tmp = fdp;
    if (n - sz[v] <= lim) tmp = max(fdp, n - sz[v]);
    if (!tree.empty()) tmp = max(tmp, (*(tree.rbegin())).first);
    gao(v, n - sz[v], tmp, k);
    tree.insert(pair<int, int>(dp[v], v));
  }
}
int main() {
  scanf("%d", &n);
  lim = n / 2;
  for (int i = 1; i <= n - 1; i++) {
    scanf("%d%d", &x, &y);
    g[x].push_back(y);
    g[y].push_back(x);
  }
  dfs(1);
  gao(1, 0, 0);
  for (int i = 1; i <= n; i++) printf("%d ", ans[i]);
}
