#include <bits/stdc++.h>
using namespace std;
const int mxN = 4e5 + 45, mod = 1e9 + 7;
const long long inf = 2e18 + 43;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
int n, sz[mxN], dp[mxN];
bool ans[mxN];
vector<int> adj[mxN];
void calc(int v, int pr = -1) {
  sz[v] = 1;
  for (auto to : adj[v]) {
    if (to != pr) calc(to, v), sz[v] += sz[to];
  }
}
set<pair<int, int> > sub[mxN];
multiset<int> mxsub[mxN];
void calc2(int v, int pr = -1) {
  if (sz[v] <= n / 2) dp[v] = sz[v];
  for (auto to : adj[v]) {
    if (to != pr) {
      calc2(to, v);
      sub[v].insert({to, dp[to]});
      mxsub[v].insert(dp[to]);
      dp[v] = max(dp[v], dp[to]);
    }
  }
}
void dfs(int v, int pr = -1) {
  bool center = 1;
  for (auto to : adj[v]) center &= (sz[to] <= n / 2);
  ans[v] = center;
  center = 1;
  for (auto to : adj[v]) {
    if (sz[to] > n / 2) {
      int nd = sz[to] - n / 2;
      if (sub[v].lower_bound({to, 0})->second < nd) center = 0;
    }
  }
  ans[v] |= center;
  for (auto to : adj[v]) {
    if (to != pr) {
      sz[v] -= sz[to], sz[to] += sz[v];
      int val = sub[v].lower_bound({to, 0})->second;
      sub[v].erase({to, val});
      mxsub[v].erase(mxsub[v].find(val));
      int mx = 1;
      if (sz[v] <= n / 2) mx = sz[v];
      if (!sub[v].empty()) mx = max(mx, *(--mxsub[v].end()));
      sub[to].insert({v, mx});
      mxsub[to].insert(mx);
      dfs(to, v);
      sz[to] -= sz[v], sz[v] += sz[to];
      sub[to].erase({v, mx});
      mxsub[v].insert(val);
      mxsub[to].erase(mxsub[to].find(mx));
      sub[v].insert({to, val});
    }
  }
}
int main() {
  ios ::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  ;
  cin >> n;
  for (int i = 1, u, v; i < n; ++i) {
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  calc(1), calc2(1);
  dfs(1);
  for (int i = 1; i <= n; ++i) cout << ans[i] << ' ';
  return 0;
}
