#include <bits/stdc++.h>
using namespace std;
const int MAX = 500005;
const int mod = 1e9 + 7;
inline int getint() {
  int n;
  scanf("%d", &n);
  return n;
}
bool ok[MAX];
int sz[MAX], mx[MAX], mxid[MAX], nex[MAX], nexid[MAX];
vector<int> G[MAX];
int n;
void dfs1(int u, int fa) {
  sz[u] = 1;
  for (auto v : G[u]) {
    if (v == fa) continue;
    dfs1(v, u);
    sz[u] += sz[v];
    int num = (sz[v] > n / 2 ? mx[v] : sz[v]);
    if (num > nex[u]) {
      nex[u] = num;
      nexid[u] = v;
      if (nex[u] > mx[u]) {
        swap(mx[u], nex[u]);
        swap(mxid[u], nexid[u]);
      }
    }
    if (sz[v] > n / 2 && sz[v] - mx[v] > n / 2) ok[u] = 0;
  }
}
void dfs2(int u, int fa) {
  if (n - sz[u] > n / 2) {
    if (mxid[fa] == u)
      ok[u] = (n - sz[u] - nex[fa] > n / 2 ? 0 : ok[u]);
    else
      ok[u] = (n - sz[u] - mx[fa] > n / 2 ? 0 : ok[u]);
  }
  if (mxid[fa] == u) {
    int num = n - sz[u] > n / 2 ? nex[fa] : n - sz[u];
    if (num > nex[u]) {
      nex[u] = num;
      nexid[u] = fa;
    }
  } else {
    int num = n - sz[u] > n / 2 ? mx[fa] : n - sz[u];
    if (num > nex[u]) {
      nex[u] = num;
      nexid[u] = fa;
    }
  }
  if (nex[u] > mx[u]) {
    swap(nex[u], mx[u]);
    swap(nexid[u], mxid[u]);
  }
  for (auto v : G[u]) {
    if (v == fa) continue;
    dfs2(v, u);
  }
}
int main() {
  n = getint();
  for (int i = 1; i <= n; i++) ok[i] = 1;
  for (int i = 1; i < n; i++) {
    int u = getint();
    int v = getint();
    G[u].push_back(v);
    G[v].push_back(u);
  }
  dfs1(1, 0);
  dfs2(1, 0);
  for (int i = 1; i <= n; i++) printf("%d ", ok[i] ? 1 : 0);
  puts("");
  return 0;
}
