#include <bits/stdc++.h>
using namespace std;
int main() {
  int ml[4] = {-1, 0, 1, 0};
  int mc[4] = {0, 1, 0, -1};
  int n, u, v;
  cin >> n;
  bool visit[40];
  int side[40][40];
  long long x[40], y[40];
  memset(side, 0, sizeof(side));
  memset(visit, 0, sizeof(visit));
  x[1] = y[1] = 0;
  visit[1] = 1;
  for (int i = 0; i < n - 1; i++) {
    cin >> u >> v;
    side[u][v] = side[v][u] = 1;
  }
  int point;
  for (int i = 1; i <= n; i++) {
    point = 0;
    for (int j = 1; j <= n; j++) {
      if (side[i][j]) point++;
      if (point > 4) {
        cout << "NO" << endl;
        return 0;
      }
    }
  }
  int t, now, k, towards;
  queue<int> q;
  q.push(1);
  q.push(30);
  q.push(-200);
  while (!q.empty()) {
    t = q.front();
    q.pop();
    k = q.front();
    q.pop();
    towards = q.front();
    q.pop();
    now = 0;
    for (int j = 1; j <= n; j++) {
      if (abs(now - towards) == 2) now = (now + 1) % 4;
      if (side[t][j] && !visit[j]) {
        x[j] = x[t] + ml[now] * (1 << k);
        y[j] = y[t] + mc[now] * (1 << k);
        q.push(j);
        visit[j] = 1;
        q.push(k - 1);
        q.push(now);
        now++;
      }
    }
  }
  cout << "YES" << endl;
  for (int i = 1; i <= n; i++) cout << x[i] << " " << y[i] << endl;
  return 0;
}
