#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int N = 5e5 + 10;
vector<int> v[31];
long long par[31], X[31], Y[31], vis[31];
int xxx = 31;
void bfs() {
  queue<tuple<int, int, int>> qu;
  qu.push(make_tuple(1, 0, xxx));
  vis[1] = 1;
  X[1] = Y[1] = 1ll << xxx;
  while (!qu.empty()) {
    tuple<int, int, int> xx = qu.front();
    qu.pop();
    int s = get<0>(xx);
    int dd = get<1>(xx);
    int pp = get<2>(xx);
    int dir = 1;
    for (auto it : v[s]) {
      if (vis[it]) continue;
      vis[it] = 1;
      if (dir == dd) dir++;
      if (dir == 1) {
        X[it] = X[s] + (1ll << (pp - 1));
        Y[it] = Y[s];
        qu.push(make_tuple(it, 2, pp - 1));
        dir++;
      } else if (dir == 2) {
        X[it] = X[s] - (1ll << (pp - 1));
        Y[it] = Y[s];
        qu.push(make_tuple(it, 1, pp - 1));
        dir++;
      } else if (dir == 3) {
        X[it] = X[s];
        Y[it] = Y[s] - (1ll << (pp - 1));
        qu.push(make_tuple(it, 4, pp - 1));
        dir++;
      } else {
        X[it] = X[s];
        Y[it] = Y[s] + (1ll << (pp - 1));
        qu.push(make_tuple(it, 3, pp - 1));
        dir++;
      }
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  int flag = 0;
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    cin >> a >> b;
    v[a].push_back(b);
    v[b].push_back(a);
    if (v[a].size() > 4 || v[b].size() > 4) flag = 1;
  }
  if (flag)
    puts("NO");
  else {
    bfs();
    cout << "YES\n";
    for (int i = 1; i <= n; i++) cout << X[i] << " " << Y[i] << "\n";
  }
  return 0;
}
