#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int maxn = 400000;
int n;
vector<int> G[maxn + 5];
int dp[maxn + 5], up[maxn + 5];
int ok[maxn + 5], cutd[maxn + 5], cutu[maxn + 5];
void dfs(int x, int fa) {
  int siz = G[x].size(), ret = 0;
  dp[x] = 1;
  cutd[x] = 0;
  ok[x] = 1;
  for (int(i) = 0; (i) < (siz); (i)++) {
    int y = G[x][i];
    if (y == fa) continue;
    dfs(y, x);
    dp[x] += dp[y];
    if (dp[y] > n / 2) {
      if (dp[y] - cutd[y] > n / 2) ok[x] = -1;
    }
    cutd[x] = max(cutd[x], cutd[y]);
    if (dp[y] <= n / 2) cutd[x] = max(cutd[x], dp[y]);
  }
  up[x] = n - dp[x];
  if (up[x] > n / 2) ok[x] = 0;
}
int pre[maxn + 5], suf[maxn + 5], pos[maxn + 5], np;
void dfs2(int x, int fa) {
  int siz = G[x].size(), np = 0;
  for (int(i) = 0; (i) < (siz); (i)++) {
    int y = G[x][i];
    if (y == fa) continue;
    pos[++np] = y;
  }
  pre[x] = 0;
  for (int(i) = 1; (i) <= (np); (i)++) {
    int y = pos[i];
    int ret = cutd[y];
    if (dp[y] <= n / 2) ret = max(ret, dp[y]);
    pre[i] = max(pre[i - 1], ret);
  }
  suf[np + 1] = 0;
  for (int i = np; i >= 1; i--) {
    int y = pos[i];
    int ret = cutd[y];
    if (dp[y] <= n / 2) ret = max(ret, dp[y]);
    suf[i] = max(suf[i + 1], ret);
  }
  for (int(i) = 1; (i) <= (np); (i)++) {
    int y = pos[i];
    int tmp = max(pre[i - 1], suf[i + 1]);
    tmp = max(tmp, cutu[x]);
    if (up[y] <= n / 2) tmp = max(tmp, up[y]);
    cutu[y] = tmp;
    if (!ok[y] && up[y] - cutu[y] <= n / 2) ok[y] = 1;
  }
  for (int(i) = 0; (i) < (siz); (i)++) {
    int y = G[x][i];
    if (y == fa) continue;
    dfs2(y, x);
  }
}
int main() {
  std::ios::sync_with_stdio(false);
  int x, y;
  while (cin >> n) {
    for (int(i) = 1; (i) <= (n); (i)++) G[i].clear();
    for (int(i) = 0; (i) < (n - 1); (i)++) {
      cin >> x >> y;
      G[x].push_back(y);
      G[y].push_back(x);
    }
    dfs(1, -1);
    cutu[1] = 0;
    dfs2(1, -1);
    for (int(i) = 1; (i) <= (n); (i)++) {
      putchar(ok[i] == 1 ? '1' : '0');
      putchar(i == n ? '\n' : ' ');
    }
  }
  return 0;
}
