#include <bits/stdc++.h>
struct vertex {
  long long x, y;
  int adj[4], k;
} vv[30];
void dfs(int p, int v, long long x, long long y, long long a, int d) {
  int i;
  vv[v].x = x;
  vv[v].y = y;
  d = (d + 2) % 4;
  for (i = 0; i < vv[v].k; i++)
    if (vv[v].adj[i] != p) {
      long long x_ = x, y_ = y;
      d = (d + 1) % 4;
      if (d == 0)
        x_ += a;
      else if (d == 1)
        y_ += a;
      else if (d == 2)
        x_ -= a;
      else
        y_ -= a;
      dfs(v, vv[v].adj[i], x_, y_, a / 2, d);
    }
}
int main() {
  int n, i, yes;
  scanf("%d", &n);
  yes = 1;
  for (i = 0; i < n; i++) vv[i].k = 0;
  for (i = 1; i < n; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    u--, v--;
    if (vv[u].k == 4 || vv[v].k == 4) {
      yes = 0;
      break;
    }
    vv[u].adj[vv[u].k++] = v;
    vv[v].adj[vv[v].k++] = u;
  }
  printf("%s\n", yes ? "YES" : "NO");
  if (yes) {
    dfs(-1, 0, 0, 0, 1LL << n, 0);
    for (i = 0; i < n; i++) printf("%lld %lld\n", vv[i].x, vv[i].y);
  }
  return 0;
}
