#include <bits/stdc++.h>
using namespace std;
const int N = 8e5 + 5;
int n;
int nxt[N], ver[N], head[N], tot;
int dp[N][2], pos[N];
int sizes[N], maxsizes[N];
int ans[N], dpp[N];
void add(int x, int y) {
  ver[++tot] = y;
  nxt[tot] = head[x];
  head[x] = tot;
}
void dfs(int x, int fa) {
  sizes[x] = 1;
  for (int i = head[x]; i; i = nxt[i]) {
    int y = ver[i];
    if (y == fa) continue;
    dfs(y, x);
    int v;
    sizes[x] += sizes[y];
    if (sizes[y] > sizes[maxsizes[x]]) maxsizes[x] = y;
    if (sizes[y] <= n / 2)
      v = sizes[y];
    else
      v = dp[y][0];
    if (dp[x][0] < v) {
      dp[x][1] = dp[x][0];
      dp[x][0] = v;
      pos[x] = y;
    } else if (dp[x][1] < v)
      dp[x][1] = v;
  }
}
void dfs2(int x, int fa) {
  ans[x] = 1;
  if (sizes[maxsizes[x]] > n / 2)
    ans[x] = (sizes[maxsizes[x]] - dp[maxsizes[x]][0] <= n / 2);
  else if (n - sizes[x] > n / 2)
    ans[x] = (n - sizes[x] - dpp[x] <= n / 2);
  for (int i = head[x]; i; i = nxt[i]) {
    int y = ver[i];
    if (y == fa) continue;
    int v;
    if (n - sizes[x] > n / 2)
      v = dpp[x];
    else
      v = n - sizes[x];
    dpp[y] = max(dpp[y], v);
    if (pos[x] == y)
      dpp[y] = max(dpp[y], dp[x][1]);
    else
      dpp[y] = max(dpp[y], dp[x][0]);
    dfs2(y, x);
  }
}
int main() {
  cin >> n;
  for (int i = 1; i < n; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    add(x, y);
    add(y, x);
  }
  dfs(1, 0);
  dfs2(1, 0);
  for (int i = 1; i <= n; i++) printf("%d ", ans[i]);
  return 0;
}
