#include <bits/stdc++.h>
using namespace std;
const long long N = 2e6 + 520;
long long n, deep[N], siz[N], maxson[N], dp[N][2], dpfa[N], son[N];
vector<long long> vt[N];
bool ans[N];
inline long long read() {
  long long f = 1, x = 0;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = (x << 3) + (x << 1) + (c ^ '0');
    c = getchar();
  }
  return f * x;
}
inline void dfs1(long long x, long long fa) {
  siz[x] = 1;
  for (long long i = 0; i < vt[x].size(); i++) {
    long long to = vt[x][i];
    if (to == fa) continue;
    long long v;
    dfs1(to, x);
    siz[x] += siz[to];
    if (siz[to] > siz[maxson[x]]) maxson[x] = to;
    if (siz[to] <= n / 2)
      v = siz[to];
    else
      v = dp[to][0];
    if (v >= dp[x][0])
      dp[x][1] = dp[x][0], dp[x][0] = v, son[x] = to;
    else if (v >= dp[x][1])
      dp[x][1] = v;
  }
  return void();
}
inline void dfs2(long long x, long long fa) {
  ans[x] = 1;
  if (siz[maxson[x]] > n / 2)
    ans[x] = (siz[maxson[x]] - dp[maxson[x]][0] <= n / 2);
  else if (n - siz[x] > n / 2)
    ans[x] = (n - siz[x] - dpfa[x] <= n / 2);
  for (long long i = 0; i < vt[x].size(); i++) {
    long long to = vt[x][i];
    if (to == fa) continue;
    long long v;
    if (n - siz[x] > n / 2)
      v = dpfa[x];
    else
      v = n - siz[x];
    dpfa[to] = max(dpfa[to], v);
    if (son[x] == to)
      dpfa[to] = max(dpfa[to], dp[x][1]);
    else
      dpfa[to] = max(dpfa[to], dp[x][0]);
    dfs2(to, x);
  }
  return void();
}
signed main() {
  n = read();
  for (long long i = 1; i < n; i++) {
    long long x = read(), y = read();
    vt[x].push_back(y);
    vt[y].push_back(x);
  }
  dfs1(1, 0);
  dfs2(1, 0);
  for (long long i = 1; i <= n; i++) cout << ans[i] << ' ';
  return 0;
}
