#include <bits/stdc++.h>
using namespace std;
long long int power[35];
vector<int> adj[35];
bool visited[35];
vector<pair<int, pair<long long int, long long int> > > v;
void dfs(int i, pair<long long int, long long int> p, long long int count,
         int k) {
  if (!visited[i]) {
    visited[i] = true;
    v.push_back({i, p});
    long long int x, y;
    k = (k + 1) % 4;
    for (int j = 0; j < adj[i].size(); j++) {
      if (!visited[adj[i][j]]) {
        if (k == 0) {
          x = p.first + power[count];
          y = p.second;
          dfs(adj[i][j], {x, y}, count - 1, 3 - k);
          k = (k + 1) % 4;
        } else if (k == 3) {
          x = p.first - power[count];
          y = p.second;
          dfs(adj[i][j], {x, y}, count - 1, 3 - k);
          k = (k + 1) % 4;
        } else if (k == 2) {
          y = p.second + power[count];
          x = p.first;
          dfs(adj[i][j], {x, y}, count - 1, 3 - k);
          k = (k + 1) % 4;
        } else if (k == 1) {
          y = p.second - power[count];
          x = p.first;
          dfs(adj[i][j], {x, y}, count - 1, 3 - k);
          k = (k + 1) % 4;
        }
      }
    }
  }
}
int main() {
  int n, x, y;
  bool done = false;
  power[0] = 1;
  for (int i = 1; i <= 32; i++) power[i] = 2 * power[i - 1];
  cin >> n;
  for (int i = 1; i <= n; i++) visited[i] = false;
  for (int i = 1; i < n; i++) {
    cin >> x >> y;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  for (int i = 1; i <= n; i++)
    if (adj[i].size() > 4) {
      cout << "NO";
      done = true;
      break;
    }
  if (!done) {
    cout << "YES\n";
    dfs(1, {0, 0}, n, 0);
    sort(v.begin(), v.end());
    for (auto x : v) {
      cout << x.second.first << " " << x.second.second << "\n";
    }
  }
}
