#include <bits/stdc++.h>
using namespace std;
struct pt {
  int x, y;
  pt(int x = 0, int y = 0) : x(x), y(y) {}
  bool operator<(const pt& p) const { return x < p.x || x == p.x && y < p.y; }
  bool operator==(const pt& p) const { return !(*this < p) && !(p < *this); }
  bool operator<=(const pt& p) const { return *this < p || *this == p; }
  bool operator>=(const pt& p) const { return !(*this < p); }
  bool operator>(const pt& p) const { return !(*this <= p); }
  bool operator!=(const pt& p) const { return !(*this == p); }
  pt operator+(const pt& p) const { return pt(x + p.x, y + p.y); }
};
struct rect {
  pt a, b;
  rect(pt a = pt(), pt b = pt()) : a(a), b(b) {}
  rect Union(const rect& r) const {
    pt low = pt(min(r.a.x, a.x), min(r.a.y, a.y));
    pt high = pt(max(r.b.x, b.x), max(r.b.y, b.y));
    return rect(low, high);
  }
};
struct ConnectionInfo {
  vector<pt> coords;
  vector<int> ids;
  rect box;
  int id(int v) const {
    int id = -1;
    for (int i = 0; id == -1 && i < ids.size(); i++)
      if (ids[i] == v) id = i;
    return id;
  }
  void shift(int dx, int dy) {
    box.a = box.a + pt(dx, dy);
    box.b = box.b + pt(dx, dy);
    for (int(i) = (0); (i) < (coords.size()); (i)++)
      coords[i] = coords[i] + pt(dx, dy);
  }
};
const int MAXN = 30;
int n;
vector<int> g[MAXN + 1];
int dx[] = {-1, 0, 1, 0};
int dy[] = {0, 1, 0, -1};
long long X[MAXN + 1];
long long Y[MAXN + 1];
ConnectionInfo go(int v, int p, int f) {
  ConnectionInfo ret;
  ret.box = rect(pt(0, 0), pt(0, 0));
  ret.coords.push_back(pt(0, 0));
  ret.ids.push_back(v);
  int k = 0;
  for (auto& u : g[v]) {
    if (u == p) continue;
    if (f == k) k++;
    ConnectionInfo curr = go(u, v, (k + 2) % 4);
    int id = curr.id(u);
    int dx, dy;
    if (k == 0) {
      dx = ret.box.a.x - curr.box.b.x - 1;
      dy = 0;
    } else if (k == 1) {
      dx = 0;
      dy = ret.box.b.y + 1 - curr.box.a.y;
    } else if (k == 2) {
      dx = ret.box.b.x + 1 - curr.box.a.x;
      dy = 0;
    } else {
      dx = 0;
      dy = ret.box.a.y - 1 - curr.box.b.y;
    }
    curr.shift(dx, dy);
    for (auto& u : curr.coords) ret.coords.push_back(u);
    for (auto& u : curr.ids) ret.ids.push_back(u);
    ret.box = ret.box.Union(curr.box);
    k++;
  }
  return ret;
}
int main(int argc, char* argv[]) {
  ios::sync_with_stdio(0);
  cin >> n;
  for (int(i) = (0); (i) < (n - 1); (i)++) {
    int a, b;
    cin >> a >> b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  bool was = false;
  for (int i = 1; i <= n && !was; i++)
    if (g[i].size() >= 5) was = true;
  if (was) {
    cout << "NO" << endl;
    return 0;
  }
  cout << "YES" << endl;
  ConnectionInfo res = go(1, -1, -1);
  for (int(v) = (1); (v) < (n + 1); (v)++) {
    int id = res.id(v);
    cout << res.coords[id].x << " " << res.coords[id].y << endl;
  }
  return 0;
}
