#include <bits/stdc++.h>
using namespace std;
const int N = (int)4e5 + 4;
const int inf = (int)1e9 + 7;
const int K = 26;
int h[N], n;
bool ans[N];
int cent;
vector<int> g[N];
void dfs(int v, int p) {
  h[v] = 1;
  int mx = 0;
  for (int &to : g[v]) {
    if (to != p) {
      dfs(to, v);
      h[v] += h[to];
      mx = max(h[to], mx);
    }
  }
  if (mx <= n / 2 && (p == -1 || n - h[v] <= n / 2)) {
    cent = v;
    ans[v] = 1;
  }
}
void go(int v, int p) {
  h[v] = 1;
  for (int &to : g[v]) {
    if (to != p) {
      go(to, v);
      h[v] += h[to];
    }
  }
}
int x = -1, y = -1;
void solve(int v, int p, int w) {
  if (h[w] == n - n / 2) {
    ans[v] = 1;
  }
  if ((w == x ? h[y] : h[x]) + h[v] >= n - n / 2) {
    ans[v] = 1;
  }
  for (int &to : g[v]) {
    if (to != p) {
      solve(to, v, w);
    }
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i < n; ++i) {
    int a, b;
    scanf("%d%d", &a, &b);
    --a, --b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  dfs(0, -1);
  ans[cent] = 1;
  go(cent, -1);
  for (int &v : g[cent]) {
    if (x == -1 || h[v] >= h[x]) {
      y = x, x = v;
    } else {
      if (y == -1 || h[v] >= h[y]) {
        y = v;
      }
    }
  }
  for (int &v : g[cent]) {
    solve(v, cent, v);
  }
  for (int i = 0; i < n; ++i) {
    printf("%d ", ans[i]);
  }
  return 0;
}
