#include <bits/stdc++.h>
using namespace std;
const int mxn = 63, dx[] = {0, -1, 0, 1}, dy[] = {-1, 0, 1, 0};
int n, f[mxn];
int h[mxn], nx[mxn], v[mxn], e = 0, k[mxn];
long long x[mxn], y[mxn];
void ade(int x, int y) {
  nx[++e] = h[x];
  h[x] = e;
  v[e] = y;
}
bool dfs(int u, int d) {
  int i, s = 0;
  ;
  if (f[u]) s++;
  int b = k[u] + 3, c;
  for (i = h[u]; i; i = nx[i])
    if (v[i] != f[u]) {
      f[v[i]] = u;
      s++;
      c = k[v[i]] = b % 4;
      b++;
      x[v[i]] = x[u] + dx[c] * (1 << (n - d - 1));
      y[v[i]] = y[u] + dy[c] * (1 << (n - d - 1));
      if (!dfs(v[i], d + 1)) return 0;
    }
  if (s > 4) return 0;
  return 1;
}
int main() {
  int i, u, v, rt;
  scanf("%d", &n);
  for (i = 1; i < n; i++) {
    scanf("%d%d", &u, &v);
    ade(u, v);
    ade(v, u);
  }
  rt = 1;
  if (!dfs(rt, 1)) {
    printf("NO\n");
    return 0;
  }
  printf("YES\n");
  for (i = 1; i <= n; i++) cout << x[i] << " " << y[i] << "\n";
  return 0;
}
