#include <bits/stdc++.h>
using ll = long long;
using pii = std::pair<int, int>;
using pll = std::pair<ll, ll>;
int const MAXN = 55;
int N;
std::vector<std::vector<int>> adj;
pll pnt[MAXN];
bool vis[MAXN];
int const dr[4] = {-1, 0, 1, 0};
int const dc[4] = {0, 1, 0, -1};
void rec(int x, pii cur, int idx, int dir) {
  pnt[x] = cur;
  vis[x] = true;
  int d = 0;
  for (int j : adj[x]) {
    if (vis[j]) continue;
    if (d >= 4) std::cout << "ERROR1" << std::endl;
    if (d == dir) ++d;
    int nr = cur.first + dr[d] * (1LL << idx);
    int nc = cur.second + dc[d] * (1LL << idx);
    rec(j, {nr, nc}, idx - 1, (d + 2) % 4);
    ++d;
  }
  if (d >= 5) std::cout << "ERROR2" << std::endl;
}
int main(int argc, char** argv) {
  std::ios_base::sync_with_stdio(false);
  std::cin >> N;
  adj.resize(N + 1);
  int a, b;
  for (int n = 1; n < N; ++n) {
    std::cin >> a >> b;
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  for (int i = 1; i <= N; ++i)
    if (adj[i].size() > 4) {
      std::cout << "NO" << std::endl;
      return 0;
    }
  int far = 0;
  memset(vis, false, sizeof(vis));
  rec(1, {0, 0}, 30, -1);
  std::cout << "YES" << std::endl;
  for (int i = 1; i <= N; ++i)
    std::cout << pnt[i].first << ' ' << pnt[i].second << std::endl;
}
