#include <bits/stdc++.h>
using namespace std;
template <class T>
void read(T& num) {
  char CH;
  bool F = false;
  for (CH = getchar(); CH < '0' || CH > '9'; F = CH == '-', CH = getchar())
    ;
  for (num = 0; CH >= '0' && CH <= '9';
       num = num * 10 + CH - '0', CH = getchar())
    ;
  F && (num = -num);
}
int stk[70], tp;
template <class T>
inline void print(T p) {
  if (!p) {
    puts("0");
    return;
  }
  while (p) stk[++tp] = p % 10, p /= 10;
  while (tp) putchar(stk[tp--] + '0');
  putchar('\n');
}
const long long mod = 1e9 + 7;
const double PI = acos(-1.0);
const int inf = 1e9;
const int N = 4e5 + 10;
const int maxn = 1e3 + 20;
const double eps = 1e-12;
int n, siz[N], ans[N], submax[N], max1[N], max2[N];
vector<int> ve[N];
void dfs(int cur, int fa) {
  siz[cur] = 1;
  submax[cur] = 0;
  int len = ve[cur].size();
  for (int i = 0; i < len; i++) {
    int x = ve[cur][i];
    if (x == fa) continue;
    dfs(x, cur);
    siz[cur] += siz[x];
    if (submax[x] > submax[cur]) {
      max2[cur] = max1[cur];
      max1[cur] = x;
      submax[cur] = submax[x];
    } else if (submax[x] > submax[max2[cur]])
      max2[cur] = x;
  }
  if (siz[cur] <= n / 2) submax[cur] = siz[cur];
}
void dfs1(int cur, int fa, int mmax) {
  int len = ve[cur].size(), flag = 1;
  for (int i = 0; i < len; i++) {
    int x = ve[cur][i];
    if (x == fa) {
      int temp = n - siz[cur];
      if (temp > n / 2 && temp - mmax > n / 2) flag = 0;
      continue;
    }
    if (siz[x] > n / 2) {
      if (siz[x] - submax[x] > n / 2) flag = 0;
    }
  }
  ans[cur] = flag;
  for (int i = 0; i < len; i++) {
    int x = ve[cur][i];
    if (x == fa) continue;
    int temp;
    if (n - siz[x] <= n / 2)
      temp = n - siz[x];
    else {
      if (max1[cur] == x)
        temp = max(mmax, submax[max2[cur]]);
      else
        temp = max(mmax, submax[max1[cur]]);
    }
    dfs1(x, cur, temp);
  }
}
int main() {
  read(n);
  int u, v;
  for (int i = 1; i <= n - 1; i++) {
    read(u);
    read(v);
    ve[v].push_back(u);
    ve[u].push_back(v);
  }
  dfs(1, 0);
  dfs1(1, 0, 0);
  for (int i = 1; i <= n; i++) printf("%d ", ans[i]);
  return 0;
}
