#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
const int N = 5e5;
vector<int> g[N];
int a[N], par[N], ans[N], sz[N];
int cen, n;
void ipgraph(int n, int m);
void dfs(int u, int p) {
  sz[u] = 1;
  for (int v : g[u]) {
    if (v == p) continue;
    dfs(v, u);
    sz[u] += sz[v];
  }
}
void dfs2(int u, int p) {
  sz[u] = 1;
  if (p == cen)
    par[u] = u;
  else
    par[u] = par[p];
  for (int v : g[u]) {
    if (v == p) continue;
    dfs2(v, u);
    sz[u] += sz[v];
  }
}
void go(int u, int p) {
  int hai = 1;
  for (int v : g[u]) {
    if (v == p) continue;
    if (sz[v] > n / 2) hai = 0;
    go(v, u);
  }
  int other = n - sz[u];
  if (other > n / 2) hai = 0;
  if (hai) cen = u;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int i, m;
  cin >> n;
  m = n - 1;
  ipgraph(n, n - 1);
  memset(sz, 0, sizeof(sz));
  par[0] = 0;
  dfs(1, 0);
  go(1, 0);
  dfs2(cen, 0);
  int first, second, idx;
  first = second = idx = -1;
  for (i = 1; i < n + 1; i++) {
    if (par[i] == i) {
      if (sz[i] >= first) {
        idx = i;
        second = first;
        first = sz[i];
      } else if (sz[i] > second)
        second = sz[i];
    }
  }
  for (i = 1; i < n + 1; i++) {
    if (i == cen) {
      ans[i] = 1;
      continue;
    }
    int rep = par[i];
    int mx, other;
    if (rep == idx) {
      mx = max(second, first - sz[i]);
    } else
      mx = first;
    other = n - sz[i] - mx;
    ans[i] = other <= n / 2;
  }
  for (i = 1; i < n + 1; i++) cout << ans[i] << " ";
  return 0;
}
void ipgraph(int n, int m) {
  int i, u, v;
  while (m--) {
    cin >> u >> v;
    u++, v++;
    g[u - 1].push_back(v - 1);
    g[v - 1].push_back(u - 1);
  }
}
