#include <bits/stdc++.h>
using namespace std;
const int MAXN = 60;
int dx[] = {0, 1, 0, -1}, dy[] = {-1, 0, 1, 0};
long long x[MAXN], y[MAXN];
vector<int> con[MAXN];
bool dfs(int n, int d, int from, int step) {
  if (con[n].size() > 4) return 0;
  vector<int> a, b;
  for (int i = 0; i < con[n].size(); i++)
    if (con[n][i] != from) a.push_back(con[n][i]);
  for (int i = 0; i < 4; i++)
    if (i != d) b.push_back(i);
  long long dis = 1LL << step;
  for (int i = 0; i < a.size(); i++) {
    int t = a[i], d = b[i];
    x[t] = x[n] + dis * dx[d];
    y[t] = y[n] + dis * dy[d];
    if (!dfs(t, (d + 2) % 4, n, step - 1)) return 0;
  }
  return 1;
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i < n; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    con[a].push_back(b);
    con[b].push_back(a);
  }
  if (!dfs(1, -1, 0, 50)) {
    puts("NO");
    return 0;
  }
  puts("YES");
  for (int i = 1; i <= n; i++) printf("%lld %lld\n", x[i], y[i]);
}
