#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> tree;
vector<pair<long long, long long>> coord;
void preprocess(void) { return; }
void MODdfs(int node, int parent, int pdir, long long x, long long y,
            int county) {
  int dir[4] = {1, 1, 1, 1};
  if (pdir == 1 || pdir == 0) {
    dir[1 - pdir] = 0;
  } else if (pdir == 2 || pdir == 3) {
    dir[5 - pdir] = 0;
  }
  for (int i = 0; i < (int)tree[node].size(); i++) {
    if (tree[node][i] != parent) {
      long long newx, newy;
      int ndir;
      for (int j = 0; j < 4; j++) {
        if (dir[j]) {
          ndir = j;
          dir[j] = 0;
          break;
        }
      }
      switch (ndir) {
        case 0:
          newx = x + (1 << county), newy = y;
          break;
        case 1:
          newx = x - (1 << county), newy = y;
          break;
        case 2:
          newx = x, newy = y + (1 << county);
          break;
        case 3:
          newx = x, newy = y - (1 << county);
          break;
        default:
          exit(0);
      }
      coord[tree[node][i]] = pair<long long, long long>(newx, newy);
      MODdfs(tree[node][i], node, ndir, newx, newy, county - 1);
    }
  }
}
int main(void) {
  preprocess();
  int t;
  t = 1;
  for (int z = 1; z <= t; z++) {
    int n;
    scanf("%d", &n);
    tree.resize(n);
    coord.resize(n);
    for (int i = 0; i < n - 1; i++) {
      int u, v;
      scanf("%d", &u), scanf("%d", &v);
      u--, v--;
      tree[u].push_back(v), tree[v].push_back(u);
    }
    for (int i = 0; i < n; i++) {
      if (((int)tree[i].size()) > 4) {
        printf("NO\n");
        return 0;
      }
    }
    printf("YES\n");
    coord[0] = pair<long long, long long>(0, 0);
    MODdfs(0, -1, -1, 0, 0, n);
    for (int i = 0; i < n; i++) {
      printf("%lld %lld\n", coord[i].first, coord[i].second);
    }
  }
  return 0;
}
