#include <bits/stdc++.h>
using namespace std;
vector<int> tr[31];
int fr[31], R, D, dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
pair<long long, long long> an[31];
void no() {
  printf("NO\n");
  exit(0);
}
int sz(int v = R, int p = 0) {
  int an = 0;
  for (int i = 0; i < (int)tr[v].size(); ++i)
    if (tr[v][i] != p) an = max(an, sz(tr[v][i], v));
  return an + 1;
}
void fn(long long x = 0, long long y = 0, int v = R, int p = 0, int dp = D,
        int d = -1) {
  an[v] = make_pair(x, y);
  int j = 0;
  for (int i = 0; i < (int)tr[v].size(); ++i)
    if (tr[v][i] != p) {
      if (j == d) ++j;
      fn(x + ((long long)dx[j] << dp), y + ((long long)dy[j] << dp), tr[v][i],
         v, dp - 1, j ^ 2);
      ++j;
    }
}
int main() {
  int n;
  scanf("%d", &n);
  pair<int, int> mx = make_pair(0, 0);
  for (int i = 1; i < (int)n; ++i) {
    int a, b;
    scanf("%d%d", &a, &b);
    tr[a].push_back(b);
    tr[b].push_back(a);
    ++fr[a];
    ++fr[b];
    if (fr[a] > mx.first) mx = make_pair(fr[a], a);
    if (fr[b] > mx.first) mx = make_pair(fr[b], b);
  }
  if (mx.first > 4) no();
  R = mx.second;
  D = sz();
  fn();
  printf("YES\n");
  for (int i = 1; i < (int)n + 1; ++i)
    printf("%lld %lld\n", an[i].first, an[i].second);
}
