#include <bits/stdc++.h>
using namespace std;
int n;
vector<int> E[400000 + 5];
int dp[400000 + 5];
int max1[400000 + 5];
int max2[400000 + 5];
int sz[400000 + 5];
void dfs1(int x, int fa) {
  sz[x] = 1;
  dp[x] = 0;
  for (int y : E[x]) {
    if (y != fa) {
      dfs1(y, x);
      sz[x] += sz[y];
      if (dp[y] > dp[x]) {
        dp[x] = dp[y];
        max2[x] = max1[x];
        max1[x] = y;
      } else if (dp[y] > dp[max2[x]])
        max2[x] = y;
    }
  }
  if (sz[x] <= n / 2) dp[x] = sz[x];
}
int ans[400000 + 5];
void dfs2(int x, int fa, int pre) {
  int flag = 1;
  for (int y : E[x]) {
    if (y == fa) {
      if (n - sz[x] > n / 2 && n - sz[x] - pre > n / 2) flag = 0;
    } else if (sz[y] > n / 2) {
      if (sz[y] - dp[y] > n / 2) flag = 0;
    }
  }
  ans[x] = flag;
  for (int y : E[x]) {
    if (y != fa) {
      int tmp;
      if (n - sz[y] <= n / 2)
        tmp = n - sz[y];
      else {
        if (y == max1[x])
          tmp = max(pre, dp[max2[x]]);
        else
          tmp = max(pre, dp[max1[x]]);
      }
      dfs2(y, x, tmp);
    }
  }
}
int main() {
  int u, v;
  scanf("%d", &n);
  for (int i = 1; i < n; i++) {
    scanf("%d %d", &u, &v);
    E[u].push_back(v);
    E[v].push_back(u);
  }
  dfs1(1, 0);
  dfs2(1, 0, 0);
  for (int i = 1; i <= n; i++) printf("%d ", ans[i]);
}
