#include <bits/stdc++.h>
using namespace std;
const int N = 4e5 + 5;
int sz[N], u, v, C, n, k, ans[N];
vector<int> V[N];
multiset<int> s;
void dfs(int u, int p) {
  sz[u] = 1;
  for (int i = 0; i < V[u].size(); i++) {
    if (p != V[u][i]) {
      dfs(V[u][i], u);
      sz[u] += sz[V[u][i]];
    }
  }
}
int centroid(int u, int p) {
  for (int i = 0; i < V[u].size(); i++) {
    if (V[u][i] != p && sz[V[u][i]] > n / 2) return centroid(V[u][i], u);
  }
  return u;
}
int find_centroid() {
  dfs(1, 0);
  return centroid(1, 0);
}
void dfs2(int u, int p, int z) {
  if (n - sz[u] > n / 2) {
    if (s.size()) {
      if (n - sz[u] - *(--s.end()) <= n / 2) ans[u] = 1;
    }
    if (n - z <= n / 2) ans[u] = 1;
  } else
    ans[u] = 1;
  for (int i = 0; i < V[u].size(); i++) {
    if (V[u][i] != p) dfs2(V[u][i], u, z);
  }
}
int main() {
  cin >> n;
  for (k = 2; k <= n; k++) {
    cin >> u >> v;
    V[u].push_back(v);
    V[v].push_back(u);
  }
  C = find_centroid();
  dfs(C, 0);
  for (k = 0; k < V[C].size(); k++) {
    s.insert(sz[V[C][k]]);
  }
  ans[C] = 1;
  for (k = 0; k < V[C].size(); k++) {
    s.erase(s.find(sz[V[C][k]]));
    dfs2(V[C][k], C, sz[V[C][k]]);
    s.insert(sz[V[C][k]]);
  }
  for (k = 1; k <= n; k++) cout << ans[k] << " ";
}
