#include <bits/stdc++.h>
using namespace std;
const int MAXN = 400 * 1000 + 10;
vector<int> vec[MAXN];
bool mark[MAXN];
bool ok[MAXN];
int sz[MAXN], dwn[MAXN], up[MAXN];
int n, m;
void dfs(int v) {
  sz[v] = 1;
  mark[v] = true;
  for (int i = 0; i < (int)vec[v].size(); i++) {
    int u = vec[v][i];
    if (!mark[u]) {
      dfs(u);
      sz[v] += sz[u];
      dwn[v] = max(dwn[u], dwn[v]);
      if (sz[u] <= n / 2) dwn[v] = max(dwn[v], sz[u]);
      if (sz[u] - dwn[u] > n / 2) ok[v] = false;
    }
  }
}
void dfs2(int v) {
  if (n - sz[v] - up[v] > n / 2) ok[v] = false;
  if (n - sz[v] <= n / 2) up[v] = n - sz[v];
  mark[v] = true;
  int k = up[v];
  for (int i = 0; i < (int)vec[v].size(); i++) {
    int u = vec[v][i];
    if (!mark[u]) {
      up[u] = max(up[u], k);
      k = max(k, dwn[u]);
      if (sz[u] <= n / 2) k = max(k, sz[u]);
    }
  }
  k = up[v];
  for (int i = (int)vec[v].size() - 1; i >= 0; i--) {
    int u = vec[v][i];
    if (!mark[u]) {
      up[u] = max(up[u], k);
      k = max(k, dwn[u]);
      if (sz[u] <= n / 2) k = max(k, sz[u]);
      dfs2(u);
    }
  }
}
int main() {
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    vec[a].push_back(b);
    vec[b].push_back(a);
  }
  memset(ok, true, n);
  dfs(0);
  memset(mark, false, n);
  dfs2(0);
  for (int i = 0; i < n; i++) cout << ok[i] << " ";
  cout << endl;
}
