#include <bits/stdc++.h>
int n;
long long ans[35][2];
int e[65][2], p[35], deg[35];
int root;
void adde(int sn, int fn, int id) {
  e[id][0] = fn;
  e[id][1] = p[sn];
  p[sn] = id;
}
void dfs(int sn, int fa, int dep, int from, long long x, long long y) {
  int i, fn, dir = -1;
  long long xx, yy;
  ans[sn][0] = x;
  ans[sn][1] = y;
  for (i = p[sn]; i; i = e[i][1]) {
    if ((fn = e[i][0]) == fa) continue;
    xx = x;
    yy = y;
    do {
      dir++;
    } while (dir == from);
    if (dir == 0)
      xx += 1LL << dep;
    else if (dir == 1)
      xx -= 1LL << dep;
    else if (dir == 2)
      yy += 1LL << dep;
    else
      yy -= 1LL << dep;
    dfs(fn, sn, dep - 2, dir ^ 1, xx, yy);
  }
}
int main() {
  int i, sn, fn;
  scanf("%d", &n);
  for (i = 1; i < n; i++) {
    scanf("%d%d", &sn, &fn);
    adde(sn, fn, i << 1);
    adde(fn, sn, i << 1 | 1);
    deg[sn]++;
    deg[fn]++;
  }
  for (i = 1; i <= n; i++)
    if (deg[i] > 4)
      goto FAILED;
    else if (deg[i] == 4)
      root = i;
  if (!root) root = 1;
  dfs(root, 0, 58, -1, 0, 0);
  printf("YES\n");
  for (i = 1; i <= n; i++) printf("%I64d %I64d\n", ans[i][0], ans[i][1]);
  return 0;
FAILED:
  printf("NO");
  return 0;
}
