#include <bits/stdc++.h>
using namespace std;
int cy() {
  int ret = 0, f = 1, n = getchar();
  while (!isdigit(n)) {
    if (n == '-') f = 0;
    n = getchar();
  }
  while (isdigit(n)) {
    ret = (ret << 3) + (ret << 1) + (n ^ 48);
    n = getchar();
  }
  return f ? ret : -ret;
}
const int maxn = 4e5 + 5;
struct edge {
  int to, nxt;
} E[maxn << 1];
int h[maxn], en = 0;
void addedge(int x, int y) {
  E[++en].to = y;
  E[en].nxt = h[x];
  h[x] = en;
}
int sz[maxn], dp[maxn][2], dpp[maxn];
int son[maxn], pos[maxn];
int n;
void dfs(int x, int fa) {
  sz[x] = 1;
  for (int e = h[x]; e; e = E[e].nxt) {
    int y = E[e].to;
    if (y != fa) {
      dfs(y, x);
      sz[x] += sz[y];
      if (sz[y] > sz[son[x]]) son[x] = y;
      int val = 0;
      if (sz[y] <= n / 2)
        val = sz[y];
      else
        val = dp[y][0];
      if (val > dp[x][0])
        pos[x] = y, dp[x][1] = dp[x][0], dp[x][0] = val;
      else if (val > dp[x][1])
        dp[x][1] = val;
    }
  }
}
bool ans[maxn];
void dfs2(int x, int fa) {
  ans[x] = 1;
  if (sz[son[x]] >= n / 2)
    ans[x] = sz[son[x]] - dp[x][0] <= n / 2;
  else if (n - sz[x] >= n / 2)
    ans[x] = n - sz[x] - dpp[x] <= n / 2;
  for (int e = h[x]; e; e = E[e].nxt) {
    int y = E[e].to;
    if (y == fa) continue;
    int val = 0;
    if (n - sz[x] > n / 2)
      val = dpp[x];
    else
      val = n - sz[x];
    dpp[y] = max(dpp[y], val);
    if (y == pos[x])
      dpp[y] = max(dpp[y], dp[x][1]);
    else
      dpp[y] = max(dpp[y], dp[x][0]);
    dfs2(y, x);
  }
}
int main() {
  n = cy();
  for (int i = 1; i < n; i++) {
    int x = cy(), y = cy();
    addedge(x, y);
    addedge(y, x);
  }
  dfs(1, 0);
  dfs2(1, 0);
  for (int i = 1; i <= n; i++) cout << ans[i] << ' ';
  return 0;
}
