#include <bits/stdc++.h>
using namespace std;
const long long mx[] = {1, -1, 0, 0}, my[] = {0, 0, 1, -1};
long long X[35], Y[35];
vector<int> v[35];
int Level[35], Ant[35], Dir[35];
void DFS(int np) {
  Level[np] = Level[Ant[np]] - 1;
  int l = v[np].size();
  int d = 0;
  for (int i = 0; i < l; i++) {
    int nh = v[np][i];
    if (nh == Ant[np]) continue;
    Ant[nh] = np;
    if (Dir[np] == 0 && d == 1)
      d++;
    else if (Dir[np] == 1 && d == 0)
      d++;
    else if (Dir[np] == 2 && d == 3)
      d++;
    else if (Dir[np] == 3 && d == 2)
      d++;
    long long x = X[np] + mx[d] * (1ll << Level[np]);
    long long y = Y[np] + my[d] * (1ll << Level[np]);
    Dir[nh] = d;
    X[nh] = x;
    Y[nh] = y;
    d++;
    DFS(nh);
  }
}
int main() {
  int n, x, y;
  scanf("%d", &n);
  for (int i = 1; i < n; i++) {
    scanf("%d %d", &x, &y);
    v[x].push_back(y);
    v[y].push_back(x);
  }
  for (int i = 1; i <= n; i++) {
    if (v[i].size() > 4) {
      printf("NO\n");
      return 0;
    }
  }
  Ant[1] = 0;
  Level[0] = 31;
  X[1] = Y[1] = 0;
  Dir[1] = -1;
  DFS(1);
  printf("YES\n");
  for (int i = 1; i <= n; i++) printf("%I64d %I64d\n", X[i], Y[i]);
}
