#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 10;
long long n, x[MAXN], y[MAXN];
vector<long long> adj[MAXN];
long long dx[] = {1, -1, 0, 0};
long long dy[] = {0, 0, -1, 1};
void precalc() {}
bool read() {
  if (scanf("%lld", &n) < 1) {
    return false;
  }
  for (long long i = 1; i < n; i++) {
    long long a, b;
    scanf("%lld%lld", &a, &b);
    --a;
    --b;
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  return true;
}
long long op(long long x) {
  if (x == 0) return 1;
  if (x == 1) return 0;
  if (x == 2) return 3;
  return 2;
}
void construct(long long v, long long p, vector<long long> ok, long long jump) {
  long long j = 0;
  for (long long i = 0; i < ((long long)(adj[v]).size()); i++) {
    long long u = adj[v][i];
    if (u != p) {
      if (!ok[j]) j++;
      x[u] = x[v] + jump * dx[j];
      y[u] = y[v] + jump * dy[j];
      vector<long long> aux;
      aux = {1, 1, 1, 1};
      aux[op(j)] = 0;
      j++;
      construct(u, v, aux, jump / 2);
    }
  }
}
void solve() {
  long long c4 = 0, raiz = 0;
  for (long long i = 0; i < n; i++) {
    if (((long long)(adj[i]).size()) > 4) {
      printf("NO\n");
      return;
    }
  }
  puts("YES");
  x[raiz] = 0;
  y[raiz] = 0;
  construct(raiz, -1, {1, 1, 1, 1}, (1LL << 32LL));
  for (long long i = 0; i < n; i++) {
    printf("%lld %lld\n", x[i], y[i]);
  }
}
int32_t main() {
  precalc();
  while (read()) {
    solve();
  }
  return 0;
}
