#include <bits/stdc++.h>
using namespace std;
template <typename T>
void print(T *p, T *q, string Gap = " ", bool flag = false) {
  int d = p < q ? 1 : -1;
  while (p != q) {
    if (flag)
      cout << Gap[0] << *p << Gap[1];
    else
      cout << *p;
    p += d;
    if (p != q && !flag) cout << Gap;
  }
  cout << endl;
}
template <typename T>
void print(const T &a, string bes = "") {
  int len = bes.length();
  if (len >= 2)
    cout << bes[0] << a << bes[1] << endl;
  else
    cout << a << endl;
}
template <typename T>
void debug(T *p, T *q, string Gap = " ", bool flag = false) {}
template <typename T>
void debug(const T &a, string bes = "") {}
void IO_Init() { ios::sync_with_stdio(false); }
long long LLabs(const long long a) { return a >= 0 ? a : -a; }
const double PI = 3.1415926535898;
const double eps = 1e-10;
const int MAXM = 1e5 + 5;
const int MAXN = 4e5 + 5;
const int INF = 0x3f3f3f3f;
const long long mod = 1e9 + 7;
int n, x, y;
int Head[MAXN], tot, son[MAXN];
int pson[MAXN], ans[MAXN];
struct o {
  int to, cost, nxt;
} E[MAXN << 1];
void init_edge() {
  memset(Head, -1, sizeof(Head));
  tot = 0;
}
void add_edge(int u, int v, int cost) {
  E[tot].to = v;
  E[tot].cost = cost;
  E[tot].nxt = Head[u];
  Head[u] = tot++;
}
void dfs_v(int u, int f) {
  ans[u] = 1;
  son[u] = 1;
  pson[u] = 0;
  for (int v = Head[u]; ~v; v = E[v].nxt) {
    o &e = E[v];
    if (e.to == f) continue;
    dfs_v(e.to, u);
    son[u] += son[e.to];
    pson[u] = max(pson[u], pson[e.to]);
    if (son[e.to] - pson[e.to] > n >> 1) {
      ans[u] = 0;
    }
  }
  if (son[u] <= n >> 1) pson[u] = max(pson[u], son[u]);
}
void dfs_b(int u, int f, int val) {
  vector<pair<int, int> > P;
  for (int v = Head[u]; ~v; v = E[v].nxt) {
    o &e = E[v];
    if (e.to == f) continue;
    P.push_back(pair<int, int>(pson[e.to], e.to));
  }
  sort(P.begin(), P.end(), greater<pair<int, int> >());
  for (int v = Head[u]; ~v; v = E[v].nxt) {
    o &e = E[v];
    if (e.to == f) continue;
    int nx_val = val;
    if (n - son[e.to] <= n >> 1) nx_val = max(nx_val, n - son[e.to]);
    if (e.to == P[0].second) {
      if (P.size() > 1) {
        nx_val = max(nx_val, P[1].first);
      }
    } else {
      nx_val = max(nx_val, P[0].first);
    }
    dfs_b(e.to, u, nx_val);
  }
  if (n - son[u] - val > n >> 1) {
    ans[u] = 0;
  }
}
int main() {
  IO_Init();
  while (~scanf("%d", &n)) {
    init_edge();
    for (int i = 1; i < n; i++) {
      scanf("%d%d", &x, &y);
      add_edge(x, y, 1);
      add_edge(y, x, 1);
    }
    dfs_v(1, 0);
    dfs_b(1, 0, 0);
    for (int i = 1; i <= n; i++) {
      printf("%d%c", ans[i], i == n ? '\n' : ' ');
    }
  }
  return 0;
}
