#include <bits/stdc++.h>
using namespace std;
long long power(long long a, long long n) {
  if (a == 0) return 0;
  if (a == 1 || n == 0) return 1;
  if (n == 1) return a % 1000000007;
  long long t = power(a, n / 2);
  t = t * t % 1000000007;
  if (n & 1) return t * a % 1000000007;
  return t;
}
int popcount(long long a) {
  int c = 0;
  while (a) {
    c++;
    a -= a & -a;
  }
  return c;
}
void factorize(int a) {}
void update(int tree[], int idx, int val, int maxval) {
  for (; idx <= maxval; idx += idx & -idx) {
    tree[idx] += val;
  }
}
int read(int tree[], int idx) {
  long long sum = 0;
  for (; idx > 0; idx -= idx & -idx) {
    sum += tree[idx];
  }
  return sum;
}
struct node2 {
  int id, val;
  node2() {
    static int ctx = 1;
    id = ctx++;
  };
  node2(int a, int b = 0, int c = 0, int d = 0, int e = 0, int f = 0) {
    val = a;
  }
};
struct comp2 {
  bool operator()(int a, int b) { return b < a; }
};
bool cmp2(int a, int b) { return b < a; }
struct node {
  long long x, y;
};
struct comp {
  bool operator()(int a, int b) { return b < a; }
};
bool cmp(int a, int b) { return b < a; }
int n, m, a, b, c, d, k, h, w, x, y, p, q, t, res, ma, mi, T, act = 0, pas = 1,
                                                              cur, flag, now;
int deg[100009];
char s[1];
double e, f, z;
vector<int> v[100009], vec;
node ans[100009];
set<int> sett;
map<int, int> mapp;
void print() {}
void print2() {}
void input() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  for (int i = 1; i < n; i++) {
    cin >> x >> y;
    v[x].push_back(y);
    v[y].push_back(x);
    deg[x]++;
    deg[y]++;
  }
}
int Y[] = {0, 1, 0, -1, 0};
int X[] = {0, 0, 1, 0, -1};
int bgfjsvf[] = {0, 3, 4, 1, 2};
void calc(int id, int par, long long y, long long x, long long dist, int dir) {
  ans[id].x = x;
  ans[id].y = y;
  int block = 1;
  for (auto u : v[id]) {
    if (u == par) continue;
    if (block == dir) block++;
    calc(u, id, y + Y[block] * dist, x + X[block] * dist, dist / 2,
         bgfjsvf[block]);
    block++;
  }
}
void solve() {
  for (int i = 1; i < n + 1; i++)
    if (deg[i] > 4) {
      flag = 1;
      return;
    }
  calc(1, 0, 0, 0, 1e9, 0);
}
void output() {
  if (flag == 1)
    cout << "NO";
  else {
    cout << "YES" << endl;
    for (int i = 1; i < n + 1; i++) cout << ans[i].x << " " << ans[i].y << endl;
  }
}
int main() {
  input();
  solve();
  output();
  return 0;
}
