#include <bits/stdc++.h>
using namespace std;
vector<int> edge[400000 + 10];
int siz[400000 + 10], dp[400000 + 10][2], dp1[400000 + 10], dp2[400000 + 10],
    res[400000 + 10];
int n;
bool ans[400000 + 10];
int g[400000 + 10];
void upmax(int &x, int &y, int val) {
  if (val > x) {
    y = x;
    x = val;
  } else if (val > y) {
    y = val;
  }
}
void dfs(int rt, int first) {
  siz[rt] = 1;
  for (auto i : edge[rt]) {
    if (i == first) continue;
    dfs(i, rt);
    siz[rt] += siz[i];
    if (siz[i] > n / 2) g[rt] = i;
    if (siz[i] > n / 2)
      upmax(dp[rt][0], dp[rt][1], dp[i][0]);
    else
      upmax(dp[rt][0], dp[rt][1], siz[i]);
  }
  if (n - siz[rt] > n / 2) g[rt] = -1;
}
void dfs1(int rt, int first) {
  if (n - siz[rt] <= n / 2) {
    res[rt] = n - siz[rt];
  } else if (dp[first][0] == siz[rt]) {
    res[rt] = max(res[first], dp[first][1]);
  } else {
    res[rt] = max(res[first], dp[first][0]);
  }
  for (auto i : edge[rt]) {
    if (i == first) continue;
    dfs1(i, rt);
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = (1); i < (n); i++) {
    int u, v;
    cin >> u >> v;
    edge[u].push_back(v);
    edge[v].push_back(u);
  }
  dfs(1, 0);
  dfs1(1, 0);
  for (int i = (1); i < (n + 1); i++) {
    if (g[i] == 0 || (g[i] != -1 && siz[g[i]] - dp[g[i]][0] <= n / 2) ||
        (g[i] == -1 && n - siz[i] - res[i] <= n / 2)) {
      ans[i] = true;
    }
  }
  for (int i = (1); i < (n + 1); i++) cout << ans[i] << " ";
  return 0;
}
