#include <bits/stdc++.h>
using namespace std;
void load() {}
const int N = 100;
vector<int> ed[N];
pair<long long, long long> mem[N];
int dit[N][5], d[N];
void dfs(int u, int p, long long x, long long y) {
  mem[u] = make_pair(x, y);
  for (int v : ed[u]) {
    if (v == p) continue;
    d[v] = d[u] + 1;
    for (int i = 0; i < 4; ++i)
      if (dit[u][i] == 0) {
        dit[u][i] = 1;
        long long h = x, c = y;
        if (i == 0) dit[v][2] = 1, h -= (1 << (30 - d[u]));
        if (i == 1) dit[v][3] = 1, c += (1 << (30 - d[u]));
        if (i == 2) dit[v][0] = 1, h += (1 << (30 - d[u]));
        if (i == 3) dit[v][1] = 1, c -= (1 << (30 - d[u]));
        dfs(v, u, h, c);
        break;
      }
  }
}
void trungtt() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i < n; ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    ed[u].push_back(v);
    ed[v].push_back(u);
  }
  for (int i = 1; i <= n; ++i)
    if (ed[i].size() > 4) {
      printf("NO\n");
      return;
    }
  printf("YES\n");
  dfs(1, 0, 0, 0);
  for (int i = 1; i <= n; ++i)
    cout << mem[i].first << " " << mem[i].second << endl;
  return;
}
int main() {
  load();
  trungtt();
  return 0;
}
