#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
bool ans[400000];
int sz[400000], n, maxi[400000], dp[400000];
int dfs(int u, int par, vector<int> g[]) {
  sz[u] = 1;
  for (int& i : g[u])
    if (i != par) {
      sz[u] += dfs(i, u, g);
      maxi[u] = max(maxi[u], maxi[i]);
    }
  if (sz[u] <= n / 2) maxi[u] = sz[u];
  return sz[u];
}
void dfs2(int u, int par, vector<int> g[]) {
  if (n - sz[u] <= n / 2) dp[u] = max(dp[u], n - sz[u]);
  int fi = -1, snd = -1;
  for (int& i : g[u]) {
    if (i == par) continue;
    if (maxi[i] > fi) {
      snd = fi;
      fi = maxi[i];
    } else if (maxi[i] > snd) {
      snd = maxi[i];
    }
  }
  for (int& i : g[u]) {
    if (i == par) continue;
    if (maxi[i] == fi)
      dp[i] = max(dp[u], snd);
    else
      dp[i] = max(dp[u], fi);
    dfs2(i, u, g);
  }
}
void dfs3(int u, int par, vector<int> g[]) {
  if (n - sz[u] <= n / 2) {
    int flag = -1;
    for (int& i : g[u])
      if (i != par && sz[i] > n / 2) {
        flag = i;
        break;
      }
    if (flag == -1 || maxi[flag] >= sz[flag] - n / 2)
      ans[u] = true;
    else
      ans[u] = false;
  } else {
    if (dp[u] >= n - sz[u] - n / 2)
      ans[u] = true;
    else
      ans[u] = false;
  }
  for (int& i : g[u])
    if (i != par) dfs3(i, u, g);
}
void solve() {
  int u, v;
  cin >> n;
  vector<int> g[n];
  for (int i = 1; i < n; i++) {
    cin >> u >> v;
    u--;
    v--;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  dfs(0, -1, g);
  dfs2(0, -1, g);
  dfs3(0, -1, g);
  for (int i = 0; i < n; i++) cout << ans[i] << " ";
  cout << "\n";
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t = 1;
  while (t--) solve();
}
