#include <bits/stdc++.h>
using namespace std;
const int MaxN = 4e5 + 10;
int Fa[MaxN], Size[MaxN];
bool Jud[MaxN];
int Fro_one[MaxN], Fro_two[MaxN];
int Next[MaxN << 1], Head[MaxN], End[MaxN << 1], Cur;
int Total, u, v, w, Root;
inline void File() {
  freopen(".in", "r", stdin);
  freopen(".out", "w", stdout);
}
inline void Add_Edge(int From, int To) {
  Next[++Cur] = Head[From];
  Head[From] = Cur;
  End[Cur] = To;
}
inline void DFS_one(int New, int Pre) {
  Size[New] = 1;
  bool Vis = true;
  for (int i = Head[New]; i; i = Next[i]) {
    if (End[i] == Pre) continue;
    DFS_one(End[i], New);
    Size[New] += Size[End[i]];
    if (Size[End[i]] > (Total / 2)) Vis = false;
  }
  if (Total - Size[New] > (Total / 2)) Vis = false;
  Jud[New] = Vis;
  if (Jud[New]) {
    Root = New;
  }
}
inline void Update_one(int New, int Val) {
  New++;
  while (New <= Total + 1) {
    Fro_one[New] += Val;
    New += (New & (-New));
  }
}
inline void Update_two(int New, int Val) {
  New++;
  while (New <= Total + 1) {
    Fro_two[New] += Val;
    New += (New & (-New));
  }
}
inline int Get_one(int New) {
  New++;
  int Res = 0;
  while (New) {
    Res += Fro_one[New];
    New -= (New & (-New));
  }
  return Res;
}
inline int Get_two(int New) {
  New++;
  int Res = 0;
  while (New) {
    Res += Fro_two[New];
    New -= (New & (-New));
  }
  return Res;
}
inline void Solve(int New, int Pre) {
  Update_one(Size[Pre], -1);
  Update_one(Total - Size[New], 1);
  int Temp = 0;
  if (!Jud[New]) {
    Temp += Get_one(Total / 2);
    Temp -= Get_one((Total - Size[New] * 2 + 1) / 2 - 1);
    Temp += Get_two(Total / 2);
    Temp -= Get_two((Total - Size[New] * 2 + 1) / 2 - 1);
  }
  Update_two(Size[New], 1);
  for (int i = Head[New]; i; i = Next[i]) {
    if (End[i] == Pre) continue;
    Solve(End[i], New);
  }
  Update_one(Size[Pre], 1);
  Update_one(Total - Size[New], -1);
  if (!Jud[New]) {
    Temp -= Get_two(Total / 2);
    Temp += Get_two((Total - Size[New] * 2 + 1) / 2 - 1);
    if (Temp > 0) Jud[New] = true;
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin >> Total;
  for (int i = 1; i <= Total - 1; i++) {
    cin >> u >> v;
    Add_Edge(u, v);
    Add_Edge(v, u);
  }
  DFS_one(1, 0);
  DFS_one(Root, 0);
  for (int i = 1; i <= Total; i++) {
    Update_one(Size[i], 1);
  }
  Solve(Root, 0);
  for (int i = 1; i <= Total; i++) {
    cout << Jud[i] << " ";
  }
  cout << endl;
  return 0;
}
