#include <bits/stdc++.h>
using namespace std;
vector<long long int> gr[500005];
long long int cnt[500005];
long long int in[500005];
long long int out[500005];
long long int ans[500005];
long long int par[500005];
bool pos[500005];
long long int n;
long long int compVals(long long int a, long long int b) {
  if (a <= (n / 2) && b > (n / 2)) return a;
  if (b <= (n / 2) && a > (n / 2)) return b;
  return max(a, b);
}
void dfs1(long long int u, long long int prev) {
  par[u] = prev;
  cnt[u] = 1;
  in[u] = 0;
  for (long long int v : gr[u]) {
    if (v == prev) continue;
    dfs1(v, u);
    cnt[u] += cnt[v];
    in[u] = compVals(in[u], in[v]);
  }
  in[u] = compVals(in[u], cnt[u]);
}
void dfs2(long long int u, long long int prev) {
  long long int mx = 0, smx = 0;
  for (long long int v : gr[u]) {
    if (v == prev) continue;
    if (in[v] >= mx) {
      smx = mx;
      mx = in[v];
    } else if (in[v] >= smx)
      smx = in[v];
  }
  if (out[u] >= mx) {
    smx = mx;
    mx = out[u];
  } else if (out[u] >= smx)
    smx = out[u];
  for (long long int v : gr[u]) {
    if (v == prev) continue;
    long long int use = mx;
    if (use == in[v]) use = smx;
    out[v] = compVals(use, cnt[1] - cnt[v]);
    dfs2(v, u);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    gr[i].clear();
    in[i] = -1;
    out[i] = -1;
    ans[i] = -1;
    pos[i] = false;
    cnt[i] = -1;
    par[i] = -1;
  }
  for (int i = 1; i <= n - 1; i++) {
    long long int u, v;
    cin >> u >> v;
    gr[u].push_back(v);
    gr[v].push_back(u);
  }
  dfs1(1, -1);
  dfs2(1, -1);
  for (long long int i = 1; i <= n; i++) {
    long long int up = cnt[1] - cnt[i];
    if (up > (n / 2)) {
      if (up - out[i] <= (n / 2))
        pos[i] = true;
      else
        pos[i] = false;
    } else {
      pos[i] = true;
      for (long long int j : gr[i]) {
        if (j == par[i]) continue;
        if (cnt[j] > (n / 2)) {
          if (cnt[j] - in[j] <= (n / 2))
            pos[i] = true;
          else
            pos[i] = false;
          break;
        }
      }
    }
  }
  for (long long int i = 1; i <= n; i++) {
    if (pos[i])
      cout << "1 ";
    else
      cout << "0 ";
  }
  cout << endl;
}
