#include <bits/stdc++.h>
using namespace std;
int n, m, a, b, c, d, x, y, p, q, t, ans[400009], res, mi, T, lca[22][400009],
    sub[400009];
vector<int> v[400009];
int ma[2];
void dfs(int id, int par) {
  lca[1][id] = par;
  lca[0][id] = id;
  for (int i = 0; i < v[id].size(); i++) {
    int u = v[id][i];
    if (u == par) continue;
    dfs(u, id);
    sub[id] += sub[u];
  }
  sub[id]++;
}
int centroid(int id, int par) {
  int f = 0, s = 0;
  for (int i = 0; i < v[id].size(); i++) {
    int u = v[id][i];
    if (u == par) continue;
    if (sub[u] > T) {
      f = 1;
      break;
    } else
      s += sub[u];
  }
  if (f == 0 && n - 1 - s <= T) return id;
  for (int i = 0; i < v[id].size(); i++) {
    int u = v[id][i];
    if (u == par) continue;
    f = centroid(u, id);
    if (f) return f;
  }
  return 0;
}
int lim;
void init_lca() {
  lim = log(n) / log(2) + 1;
  for (int i = 2; i <= lim; i++) {
    for (int j = 1; j <= n; j++) {
      lca[i][j] = lca[1][lca[i - 1][lca[i - 1][j]]];
    }
  }
}
void calc(int id, int par, int branch = 0) {
  for (int i = 0; i < v[id].size(); i++) {
    int u = v[id][i];
    if (u == par) continue;
    int branch2 = (branch == 0 ? u : branch);
    if (branch2 != ma[0]) {
      if (n - sub[ma[0]] - sub[u] <= T) ans[u] = 1;
    } else {
      if (n - sub[ma[1]] - sub[u] <= T) ans[u] = 1;
    }
    if (n - sub[branch2] <= T) ans[u] = 1;
    calc(u, id, branch2);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  for (int i = 1; i < n; i++) {
    cin >> x >> y;
    v[x].push_back(y);
    v[y].push_back(x);
  }
  if (n <= 4) {
    for (int i = 1; i <= n; i++) cout << 1 << " ";
    return 0;
  }
  dfs(1, 0);
  T = n / 2;
  c = centroid(1, 0);
  memset(sub, 0, sizeof(sub));
  dfs(c, 0);
  ans[c] = 1;
  for (int i = 0; i < v[c].size(); i++) {
    int u = v[c][i];
    if (sub[u] >= sub[ma[0]]) {
      ma[1] = ma[0];
      ma[0] = u;
    } else if (sub[u] > sub[ma[1]])
      ma[1] = u;
  }
  init_lca();
  calc(c, 0);
  for (int i = 1; i <= n; i++) cout << ans[i] << " ";
  return 0;
}
