#include <bits/stdc++.h>
using namespace std;
const int N = 400005;
int n, sz[N], p[N], cur, centroid;
vector<int> adj[N];
void dfs(int u, int par = -1) {
  sz[u] = 1;
  for (int &v : adj[u])
    if (v != par) p[v] = u, dfs(v, u), sz[u] += sz[v];
}
int find_center(int u, int par = -1) {
  for (int &v : adj[u])
    if (v != par && sz[v] > n / 2) return find_center(v, u);
  return u;
}
void dfs1(int u, int par) {
  p[u] = cur;
  for (int &v : adj[u]) {
    if (v != par && v != centroid) dfs1(v, u);
  }
}
int main() {
  cin.tie(0)->sync_with_stdio(false);
  cin >> n;
  for (int i = 1; i < n; ++i) {
    int u, v;
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  dfs(1);
  centroid = find_center(1);
  memset(sz, 0, sizeof sz);
  dfs(centroid);
  int max_sz = 0, se_max_sz = 0;
  for (auto &v : adj[centroid]) {
    cur = v;
    dfs1(v, v);
    if (sz[v] > max_sz)
      se_max_sz = max_sz, max_sz = sz[v];
    else
      se_max_sz = max(se_max_sz, sz[v]);
  }
  for (int i = 1; i <= n; ++i) {
    if (n - sz[p[i]] <= n / 2)
      cout << 1 << ' ';
    else if (n - (sz[i] + (sz[p[i]] == max_sz ? se_max_sz : max_sz)) <= n / 2)
      cout << 1 << ' ';
    else
      cout << 0 << ' ';
  }
}
