#include <bits/stdc++.h>
using namespace std;
vector<pair<long long, long long> > unitdir = {
    pair<long long, long long>(0, 1), pair<long long, long long>(1, 0),
    pair<long long, long long>(0, -1), pair<long long, long long>(-1, 0)};
vector<vector<int> > adj;
vector<pair<long long, long long> > cord;
void drawtree(long long xc, long long yc, int node, int parent, int pd,
              long long segsize) {
  int offset = (pd + 1) % 4;
  for (int i = 0; i < adj[node].size(); i++) {
    int ngh = adj[node][i];
    if (ngh == parent) continue;
    long long xn = (unitdir[offset].first) * segsize + xc;
    long long yn = (unitdir[offset].second) * segsize + yc;
    cord[ngh] = pair<long long, long long>(xn, yn);
    drawtree(xn, yn, ngh, node, (offset + 2) % 4, segsize / 2);
    offset = (offset + 1) % 4;
  }
}
int main() {
  std::ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  adj.resize(n + 1);
  cord.resize(n + 1);
  int v1, v2;
  for (int i = 0; i < n - 1; i++) {
    cin >> v1 >> v2;
    adj[v1].push_back(v2);
    adj[v2].push_back(v1);
    if (adj[v1].size() > 4 or adj[v2].size() > 4) {
      cout << "NO";
      return 0;
    }
  }
  cout << "YES"
       << "\n";
  cord[1] = pair<long long, long long>(0, 0);
  drawtree(0, 0, 1, 1, 3, 1 << 30);
  for (int i = 1; i <= n; i++) {
    cout << cord[i].first << " " << cord[i].second << "\n";
  }
}
