#include <bits/stdc++.h>
using namespace std;
const int MXN = 2e6 + 30;
const int MAXN = 1e3 + 2;
const long long INF = 1e9 + 7;
const long long BINF = 1e15;
const int MOD = 1e9 + 7;
const long double EPS = 1e-15;
const long long dx[] = {0, 0, 1, -1};
const long long dy[] = {1, -1, 0, 0};
long long n;
long long u, v;
long long used[MXN][4];
long long sz;
vector<int> g[MXN];
long long depth[MXN];
long long len;
long long posx[MXN], posy[MXN];
void dfs(long long v, long long p, long long x, long long y, long long sz) {
  depth[v] = depth[p] + 1;
  len = (1LL << (40LL - depth[v]));
  posx[v] = posx[p] + (len * x);
  posy[v] = posy[p] + (len * y);
  if (g[v].size() > 4) {
    cout << "NO";
    exit(0);
  }
  x *= -1, y *= -1;
  for (int i = 0; i < 4; i++) {
    if (x == dx[i] && y == dy[i]) {
      used[v][i] = 1;
    }
  }
  for (auto to : g[v]) {
    if (to != p) {
      while (used[v][sz]) sz++;
      used[v][sz] = 1;
      dfs(to, v, dx[sz], dy[sz], 0);
    }
  }
}
int main() {
  cin >> n;
  for (int i = 1; i < n; i++) {
    cin >> u >> v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  depth[0] = -1;
  dfs(1, 0, 0, 0, 0);
  cout << "YES\n";
  for (int i = 1; i <= n; i++) {
    cout << posx[i] << ' ' << posy[i] << '\n';
  }
  return 0;
}
