#include <bits/stdc++.h>
const int N = 4e5 + 1;
bool vis[N], ans[N];
int i, j, n, RT, p1, p2, siz[N];
int t, fa[N], nxt[N * 2], en[N * 2];
void Find(int u) {
  int i = fa[u], v, t = 0;
  for (siz[u] = 1; i; i = nxt[i])
    if (!siz[v = en[i]])
      if (Find(v), siz[u] += siz[v], siz[v] > t) t = siz[v];
  if ((t << 1) <= n && (siz[u] << 1) >= n) ans[u] = 1, RT = u;
}
void SIZ(int u) {
  siz[u] = 1;
  for (int i = fa[u], v; i; i = nxt[i])
    if (!siz[v = en[i]]) SIZ(v), siz[u] += siz[v];
}
void Fill(int u, int p) {
  vis[u] = 1;
  for (int i = fa[u]; i; i = nxt[i])
    if (en[i] != p) Fill(en[i], u);
}
int main() {
  scanf("%d", &n);
  for (RT = 1; RT < n; ++RT) {
    scanf("%d%d", &i, &j);
    en[++t] = j, nxt[t] = fa[i], fa[i] = t;
    en[++t] = i, nxt[t] = fa[j], fa[j] = t;
  }
  Find(1), memset(siz + 1, 0, 4 * n);
  for (SIZ(RT), i = fa[RT]; i; i = nxt[i])
    if (siz[j = en[i]] > siz[p1])
      p2 = p1, p1 = j;
    else if (siz[j] > siz[p2])
      p2 = j;
  for (Fill(p1, RT), i = 1; i <= n; putchar(32)) {
    if (!ans[i]) {
      if (vis[i])
        t = siz[p2];
      else
        t = siz[p1];
      if ((n - siz[i] - t << 1) <= n) ans[i] = 1;
      if (vis[i] && (siz[p1] << 1) == n) ans[i] = 1;
    }
    putchar(48 + ans[i++]);
  }
}
