#include <bits/stdc++.h>
using namespace std;
vector<long long> ed[35];
vector<pair<long long, long long> > cld[35];
long long par[35], tot_cn[35];
long long dir[4][4] = {{0, 1, 2, 3}, {1, 0, 3, 2}, {2, 0, 3, 1}, {3, 2, 1, 0}};
pair<long long, long long> an[35];
long long go_deep(long long nd, long long pr, long long lv) {
  par[nd] = pr;
  long long i, z, x, cn = lv;
  z = ed[nd].size();
  for (i = 0; i <= z - 1; i++) {
    if (ed[nd][i] == pr) continue;
    x = go_deep(ed[nd][i], nd, lv + 1);
    cld[nd].push_back(make_pair(x, ed[nd][i]));
    cn = max(cn, x);
  }
  sort(cld[nd].begin(), cld[nd].end());
  reverse(cld[nd].begin(), cld[nd].end());
  return tot_cn[nd] = cn;
}
void set_ans(long long nd, long long val, long long ori, long long pr) {
  if (ori == 0 || ori == 3) {
    an[nd].first = an[pr].first;
  } else
    an[nd].second = an[pr].second;
  if (ori == 0)
    an[nd].second = an[pr].second - val;
  else if (ori == 3)
    an[nd].second = an[pr].second + val;
  else if (ori == 1)
    an[nd].first = an[pr].first + val;
  else if (ori == 2)
    an[nd].first = an[pr].first - val;
}
long long go_and_do_shit(long long nd, long long val, long long ori,
                         long long pr) {
  long long i, z, x;
  z = cld[nd].size();
  if (val) {
    set_ans(nd, val, ori, pr);
  } else if (z == 0) {
    an[nd].first = an[nd].second = 0;
    return 3;
  }
  for (i = 0; i <= z - 1; i++) {
    long long nvl = val / 3;
    x = go_and_do_shit(cld[nd][i].second, nvl, dir[ori][i], nd);
    if (!val) {
      val = x;
      an[nd].first = 0;
      an[nd].second = an[cld[nd][i].second].second + val / 3;
    }
  }
  return val * 3;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long i, j, x, y, n, m, cnt = 0, k, g, flg, t, a, b;
  cin >> n;
  for (i = 1; i <= n - 1; i++) {
    cin >> x >> y;
    ed[x].push_back(y);
    ed[y].push_back(x);
  }
  for (i = 1; i <= n; i++) {
    if (ed[i].size() > 4) {
      cout << "NO" << endl;
      return 0;
    }
  }
  go_deep(1, 1, 0);
  go_and_do_shit(1, 0, 0, 1);
  cout << "YES" << endl;
  for (i = 1; i <= n; i++) {
    cout << an[i].first << " " << an[i].second << endl;
  }
}
