#include <bits/stdc++.h>
using namespace std;
const int MM = 61, MOD = 1e9 + 7;
int N;
pair<long long, long long> ans[MM];
vector<int> adj[MM];
long long binpow(long long x, long long exp) {
  long long ax = 1;
  while (exp > 0) {
    if (exp & 1) ax = (ax * x);
    x = (x * x);
    exp /= 2;
  }
  return ax;
}
void rec(int u, int pa, long long x, long long y, int blk, int dep) {
  ans[u] = {x, y};
  for (int i = 0, cn = 0; i < adj[u].size(); i++) {
    if (adj[u][i] == pa) continue;
    int dir = (blk + (++cn)) % 4, v = adj[u][i];
    if (dir == 0) {
      rec(v, u, x, y + binpow(2, dep), 2, dep - 2);
    } else if (dir == 1) {
      rec(v, u, x + binpow(2, dep), y, 3, dep - 2);
    } else if (dir == 2) {
      rec(v, u, x, y - binpow(2, dep), 0, dep - 2);
    } else {
      rec(v, u, x - binpow(2, dep), y, 1, dep - 2);
    }
  }
}
int main() {
  cin.tie(nullptr)->sync_with_stdio(false);
  cin >> N;
  for (int i = 1, u, v; i < N; i++) {
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
    if (adj[u].size() > 4) {
      cout << "NO"
           << "\n";
      return 0;
    }
  }
  rec(1, 0, 0, 0, -1, 59);
  cout << "YES"
       << "\n";
  for (int i = 1; i <= N; i++) {
    cout << ans[i].first << " " << ans[i].second << "\n";
  }
}
