#include <bits/stdc++.h>
using namespace std;
vector<long long> v[40];
map<pair<long long, long long>, bool> m;
bool dirc[40][5];
bool vis[40];
long long xx[40], yy[40];
void dfs(long long s, long long dir, long long pow, long long x, long long y) {
  if (dir) {
    dirc[s][dir] = true;
  }
  m[make_pair(x, y)] = true;
  xx[s] = x;
  yy[s] = y;
  vis[s] = true;
  for (int i = 0; i < v[s].size(); i++) {
    long long ve = v[s][i];
    if (vis[ve]) continue;
    for (int j = 1; j <= 4; j++) {
      if (!dirc[s][j]) {
        if (j == 1) {
          dirc[s][j] = true;
          dfs(ve, 2LL, pow / 2LL, x, y - pow);
          break;
        } else if (j == 2) {
          dirc[s][j] = true;
          dfs(ve, 1LL, pow / 2LL, x, y + pow);
          break;
        } else if (j == 3) {
          dirc[s][j] = true;
          dfs(ve, 4LL, pow / 2LL, x + pow, y);
          break;
        }
        if (j == 4) {
          dirc[s][j] = true;
          dfs(ve, 3LL, pow / 2LL, x - pow, y);
          break;
        }
      }
    }
  }
}
int main() {
  long long i, j, k, l, n, x, y;
  long long power = 1;
  for (i = 0; i < 40; i++) {
    power *= 2LL;
  }
  cin >> n;
  for (i = 0; i < n - 1; i++) {
    cin >> x >> y;
    v[x].push_back(y);
    v[y].push_back(x);
  }
  for (i = 1; i <= n; i++) {
    if (v[i].size() > 4) {
      cout << "NO" << endl;
      return 0;
    }
  }
  dfs(1LL, 0LL, power, 0LL, 0LL);
  cout << "YES" << endl;
  for (i = 1; i <= n; i++) {
    cout << xx[i] << " " << yy[i] << endl;
  }
  return 0;
}
