#include <bits/stdc++.h>
using namespace std;
int N;
int H;
int card[500000];
int maxpart[500000];
vector<int> adj[500000];
void dfs1(int v, int parent = -1) {
  card[v] = 1;
  for (__typeof((adj[v]).begin()) it = (adj[v]).begin(); it != (adj[v]).end();
       ++it) {
    if (*it == parent) continue;
    dfs1(*it, v);
    card[v] += card[*it];
    maxpart[v] = max(maxpart[v], maxpart[*it]);
    if (card[*it] < H) maxpart[v] = max(maxpart[v], card[*it]);
  }
}
bool centroid[500000];
void dfs2(int v, int parent = -1, int maxpartabove = 0) {
  centroid[v] = true;
  multiset<int> maxparts;
  for (__typeof((adj[v]).begin()) it = (adj[v]).begin(); it != (adj[v]).end();
       ++it) {
    if (*it == parent) continue;
    maxparts.insert(maxpart[*it]);
    if (card[*it] < H) maxparts.insert(card[*it]);
    if (card[*it] - maxpart[*it] >= H) centroid[v] = false;
  }
  if (N - card[v] - maxpartabove >= H) centroid[v] = false;
  for (__typeof((adj[v]).begin()) it = (adj[v]).begin(); it != (adj[v]).end();
       ++it) {
    if (*it == parent) continue;
    maxparts.erase(maxparts.find(maxpart[*it]));
    if (card[*it] < H) maxparts.erase(maxparts.find(card[*it]));
    int tmp = maxpartabove;
    if (N - card[*it] < H) tmp = max(tmp, N - card[*it]);
    if (!maxparts.empty()) tmp = max(tmp, *maxparts.rbegin());
    dfs2(*it, v, tmp);
    maxparts.insert(maxpart[*it]);
    if (card[*it] < H) maxparts.insert(card[*it]);
  }
}
int main() {
  scanf("%d", &N);
  H = (N + 2) / 2;
  for (int i = 0; i < (N - 1); ++i) {
    int a, b;
    scanf("%d%d", &a, &b);
    --a, --b;
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  dfs1(0);
  dfs2(0);
  for (int i = 0; i < (N); ++i) printf("%d ", centroid[i]);
  printf("\n");
}
