#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int ans = 0, f = 1;
  char c = getchar();
  for (; !isdigit(c); c = getchar())
    if (c == '-') f = -1;
  for (; isdigit(c); c = getchar()) ans = (ans << 3) + (ans << 1) + (c ^ 48);
  return ans * f;
}
inline void addedge(int, int);
void dfs1(int, int);
void dfs2(int, int);
inline int cmin(int &a, int b) { return a = min(a, b); }
inline int cmax(int &a, int b) { return a = max(a, b); }
int n;
int head[400005], nex[800005], tail[800005], tot;
int ans[400005];
int main() {
  n = read();
  for (int i = 1; i < n; i++) {
    int u = read(), v = read();
    addedge(u, v);
    addedge(v, u);
  }
  dfs1(1, 0);
  dfs2(1, 0);
  for (int i = 1; i <= n; i++) cout << ans[i] << ' ';
  cout << endl;
  return 0;
}
inline void addedge(int u, int v) {
  nex[++tot] = head[u];
  head[u] = tot;
  tail[tot] = v;
}
int sz[400005], mson[400005], son[400005];
int f[400005][2];
void dfs1(int u, int fa) {
  sz[u] = 1;
  for (int e = head[u]; e; e = nex[e]) {
    int v = tail[e];
    if (v == fa) continue;
    dfs1(v, u);
    sz[u] += sz[v];
    int tmp = (sz[v] > n / 2) ? f[v][0] : sz[v];
    if (tmp > f[u][0])
      f[u][1] = f[u][0], f[u][0] = tmp, son[u] = v;
    else if (tmp > f[u][1])
      f[u][1] = tmp;
    if (sz[v] > sz[mson[u]]) mson[u] = v;
  }
}
int g[400005];
void dfs2(int u, int fa) {
  if (sz[mson[u]] > n / 2) {
    if (sz[mson[u]] - f[u][0] <= n / 2) ans[u] = 1;
  } else if (n - sz[u] > n / 2) {
    if (n - sz[u] - g[u] <= n / 2) ans[u] = 1;
  } else
    ans[u] = 1;
  for (int e = head[u]; e; e = nex[e]) {
    int v = tail[e];
    if (v == fa) continue;
    int tmp = (n - sz[v] > n / 2) ? g[u] : n - sz[v];
    g[v] = max(g[u], tmp);
    if (v == son[u])
      g[v] = max(g[v], f[u][1]);
    else
      g[v] = max(g[v], f[u][0]);
    dfs2(v, u);
  }
}
