#include <bits/stdc++.h>
using namespace std;
int n;
vector<vector<int> > node;
pair<long long, long long> ans[31];
char nxt(char c) {
  if (c == 'l') return 'u';
  if (c == 'u') return 'r';
  if (c == 'r') return 'd';
  if (c == 'd') return 'l';
}
char sha2leb(char c) {
  if (c == 'l') return 'r';
  if (c == 'u') return 'd';
  if (c == 'r') return 'l';
  if (c == 'd') return 'u';
}
void dfs(int v, int p, long long x, long long y, char dir, long long val) {
  ans[v] = {x, y};
  for (auto i : node[v]) {
    if (i == p) continue;
    dir = nxt(dir);
    if (dir == 'u') dfs(i, v, x, y + val, sha2leb(dir), val / 2);
    if (dir == 'd') dfs(i, v, x, y - val, sha2leb(dir), val / 2);
    if (dir == 'r') dfs(i, v, x + val, y, sha2leb(dir), val / 2);
    if (dir == 'l') dfs(i, v, x - val, y, sha2leb(dir), val / 2);
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  node = vector<vector<int> >(n + 1);
  for (auto i = 0; i < (long long)(n - 1); i++) {
    int a, b;
    cin >> a >> b;
    node[a].push_back(b);
    node[b].push_back(a);
  }
  for (auto i = 1; i <= (long long)(n); i++)
    if (((int)((node[i]).size())) > 4) return cout << "NO", 0;
  cout << "YES\n";
  dfs(1, 0, 0, 0, 'u', 1e17);
  for (auto i = 1; i <= (long long)(n); i++)
    cout << ans[i].first << " " << ans[i].second << '\n';
  return 0;
}
