#include <bits/stdc++.h>
using namespace std;
int n, size[400008], max1, max2, centr = -1, preswing, ans[400008] = {0};
class Graph {
  vector<vector<int> > llist;
  long long V, E;

 public:
  Graph(long long V, long long E) {
    llist.assign(V, vector<int>(0, 0));
    this->V = V;
    this->E = E;
    for (int i = 0; i < E; i++) {
      int a, b;
      cin >> a >> b;
      a--;
      b--;
      llist[a].push_back(b);
      llist[b].push_back(a);
    }
    Dfs();
  }
  void Dfs();
  void CalcSize(int, vector<int> &);
  void findcent(int, vector<int> &);
  void DFSV(int vertx, vector<int> &visited);
};
void Graph::Dfs() {
  vector<int> visited(V, 0);
  for (int i = 0; i < V; i++) {
    if (!visited[i]) findcent(i, visited);
  }
  visited.assign(V, 0);
  CalcSize(centr, visited);
  visited.assign(V, 0);
  ans[centr] = 1;
  DFSV(centr, visited);
  int res = 0;
  for (int i = 0; i < V; i++) cout << ans[i] << ' ';
  cout << endl;
  return;
}
bool cmp(int i, int j) { return size[i] > size[j]; }
void Graph::CalcSize(int vertx, vector<int> &visited) {
  visited[vertx] = 1;
  size[vertx] = 1;
  vector<int> childsz;
  for (vector<int>::iterator it = llist[vertx].begin();
       it != llist[vertx].end(); it++) {
    if (!visited[*it]) {
      findcent(*it, visited);
      size[vertx] += size[*it];
      if (vertx == centr) childsz.push_back(*it);
    }
  }
  if (vertx == centr) {
    sort(childsz.begin(), childsz.end(), cmp);
    max1 = -1;
    max2 = -1;
    if (childsz.size() > 0) max1 = childsz[0];
    if (childsz.size() > 1) max2 = childsz[1];
  }
}
void Graph::findcent(int vertx, vector<int> &visited) {
  visited[vertx] = 1;
  int fl = 0;
  size[vertx] = 1;
  for (vector<int>::iterator it = llist[vertx].begin();
       it != llist[vertx].end(); it++) {
    if (!visited[*it]) {
      findcent(*it, visited);
      size[vertx] += size[*it];
      if (size[*it] > V / 2) fl = 1;
    }
  }
  if (fl == 0 && centr == -1 && V - size[vertx] <= V / 2) centr = vertx;
}
void Graph::DFSV(int vertx, vector<int> &visited) {
  visited[vertx] = 1;
  if (vertx != centr) {
    int cut = 0, siz = V - size[vertx];
    if (V - size[preswing] <= V / 2) cut = V - size[preswing];
    if (max1 != preswing) {
      cut = max(cut, size[max1]);
    } else {
      if (max2 != -1) cut = max(cut, size[max2]);
    }
    if (siz - cut <= V / 2) ans[vertx] = 1;
  }
  for (vector<int>::iterator it = llist[vertx].begin();
       it != llist[vertx].end(); it++) {
    if (!visited[*it]) {
      if (vertx == centr) {
        preswing = *it;
      }
      DFSV(*it, visited);
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  Graph g(n, n - 1);
  return 0;
};
