#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const long long inf = 0x3f3f3f3f;
vector<int> v[1000];
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
bool vis[1000];
pair<int, int> ans[1000];
void dfs(int u, int dis, int x, int y, int pre) {
  vis[u] = true;
  ans[u] = pair<int, int>{x, y};
  int temp = 0, to;
  for (int i = 0; i < v[u].size(); i++) {
    to = v[u][i];
    if (vis[to]) continue;
    if (temp == pre) temp++;
    dfs(to, dis - 1, x + (1 << dis) * dx[temp], y + (1 << dis) * dy[temp],
        (temp + 2) % 4);
    temp++;
  }
}
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n - 1; i++) {
    int x, y;
    scanf("%d", &x);
    scanf("%d", &y);
    v[x].push_back(y);
    v[y].push_back(x);
  }
  for (int i = 1; i <= n; i++)
    if (v[i].size() > 4) {
      cout << "NO" << endl;
      return 0;
    }
  cout << "YES" << endl;
  dfs(1, 30, 0, 0, -1);
  for (int i = 1; i <= n; i++)
    cout << ans[i].first << " " << ans[i].second << endl;
  return 0;
}
