#include <bits/stdc++.h>
using namespace std;
long long x[100009], y[100009];
long long f[100009];
long long dx[4] = {1, -1, 0, 0};
long long dy[4] = {0, 0, 1, -1};
vector<long long> v[100009];
long long op[4] = {1, 0, 3, 2};
void dfs(long long p, long long a, long long b, long long l, long long dd) {
  f[p] = 1;
  x[p] = a;
  y[p] = b;
  long long d = 0;
  for (long long i = 0; i < v[p].size(); i++) {
    if (f[v[p][i]]) continue;
    if (d == dd) d++;
    dfs(v[p][i], a + dx[d] * l, b + dy[d] * l, (l >> 1), op[d]);
    d++;
  }
}
int main() {
  long long n;
  cin >> n;
  for (long long i = 0; i < n - 1; i++) {
    long long a, b;
    cin >> a >> b;
    v[a].push_back(b);
    v[b].push_back(a);
  }
  for (long long i = 0; i < n; i++)
    if (v[i].size() > 4) {
      cout << "NO" << endl;
      return 0;
    }
  dfs(1, 0, 0, (1 << 31), 5);
  cout << "YES" << endl;
  for (long long i = 1; i <= n; i++) cout << x[i] << " " << y[i] << endl;
}
