Problem: Dasha decided to have a rest after solving the problem. She had been ready to start her favourite activity — origami, but remembered the puzzle that she could not solve. 

<image>

The tree is a non-oriented connected graph without cycles. In particular, there always are n - 1 edges in a tree with n vertices.

The puzzle is to position the vertices at the points of the Cartesian plane with integral coordinates, so that the segments between the vertices connected by edges are parallel to the coordinate axes. Also, the intersection of segments is allowed only at their ends. Distinct vertices should be placed at different points. 

Help Dasha to find any suitable way to position the tree vertices on the plane.

It is guaranteed that if it is possible to position the tree vertices on the plane without violating the condition which is given above, then you can do it by using points with integral coordinates which don't exceed 1018 in absolute value.

Input

The first line contains single integer n (1 ≤ n ≤ 30) — the number of vertices in the tree. 

Each of next n - 1 lines contains two integers ui, vi (1 ≤ ui, vi ≤ n) that mean that the i-th edge of the tree connects vertices ui and vi.

It is guaranteed that the described graph is a tree.

Output

If the puzzle doesn't have a solution then in the only line print "NO".

Otherwise, the first line should contain "YES". The next n lines should contain the pair of integers xi, yi (|xi|, |yi| ≤ 1018) — the coordinates of the point which corresponds to the i-th vertex of the tree.

If there are several solutions, print any of them. 

Examples

Input

7
1 2
1 3
2 4
2 5
3 6
3 7

Output

YES
0 0
1 0
0 1
2 0
1 -1
-1 1
0 2

Input

6
1 2
2 3
2 4
2 5
2 6


Output

NO


Input

4
1 2
2 3
3 4

Output

YES
3 3
4 3
5 3
6 3

Note

In the first sample one of the possible positions of tree is: <image>

Solution (in JAVA):

Solution:
/** This is a solution to the problem Dasha and Puzzle on codeforces
 * 
 * Given a undirected tree, find an embedding of the tree in a 2D grid, such that 
 * all edges are parallel to the axesno edges and no vertices overlap.
 * 
 * For details, see:
 * http://codeforces.com/problemset/problem/761/E
 */

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.stream.Collectors;

public class DashaAndPuzzle {
	
	private Position[] positions;
	private RootedTree tree;
	private int maxLevel;

	public static void main(String[] args) throws IOException {
		new DashaAndPuzzle().solve(InputType.SYSTEMIN);
	}
	
	private enum InputType {
		FILE, SYSTEMIN
	}

	private void solve(InputType inputType) throws IOException {
		BufferedReader br;
		if (inputType == InputType.SYSTEMIN)
			br = new BufferedReader(new InputStreamReader(System.in));
		else
			br = new BufferedReader(new FileReader("input.txt"));
		
		int n = Integer.parseInt(br.readLine());
		
		String[] lines = new String[n - 1];
		for(int i = 0; i < (n - 1); ++i) {
			lines[i] = br.readLine();
		}
		br.close();
		
		List<RootedTree.InputEdge> inputEdges = Arrays.stream(lines).map(RootedTree.InputEdge::fromLine).collect(Collectors.toList());
		List<RootedTree.InputEdge> reversedEdges = inputEdges.stream().map(RootedTree.InputEdge::getReversedEdge).collect(Collectors.toList());
		inputEdges.addAll(reversedEdges);
		
		br.close();
		
		tree = new RootedTree(n, inputEdges);
		
		if(embeddingIsPossible(tree)) {
			System.out.println("YES");
			positions = new Position[n];
			positions[tree.getRoot()] = new Position(0, 0);
			maxLevel = 0;
			computeEmbeddingsOfChildren(tree.getRoot(), Orientation.UP, 1);
			long divideBy = 1 << (31 - maxLevel);
			Arrays.stream(positions).map(p -> new Position(p.getX() / divideBy, p.getY() / divideBy)).forEach(System.out::println);
		}
		else {
			System.out.println("NO");
		}
	}

	private boolean embeddingIsPossible(RootedTree tree) {
		for(int node = 0; node < tree.getNumNodes(); ++node) {
			if(tree.getOutDegree(node) > 4) return false;
		}
		return true;
	}

	private void computeEmbeddingsOfChildren(int node, Orientation incomingOrientation, int level) {
		if(level > maxLevel) maxLevel = level;
		Orientation orientation = incomingOrientation.getPrevious();
		for(Integer neighbor : tree.getNeighbors(node)) {
			if(notVisited(neighbor)) {
				long length = 1 << (30 - level);
				Position neighborPosition = Position.computePosition(positions[node], orientation, length);
				positions[neighbor] = neighborPosition;
				computeEmbeddingsOfChildren(neighbor, orientation, level + 1);
				orientation = orientation.getNext();
			}
		}
	}
	
	private boolean notVisited(int node) {
		return positions[node] == null;
	}
	
	private enum Orientation {
		UP, 
		RIGHT, 
		DOWN, 
		LEFT;

		private static Orientation[] vals = values();
		
		public Orientation getNext() {
			return vals[(this.ordinal() + 1) % vals.length];
		}
		
		public Orientation getPrevious() {
			return vals[(this.ordinal() - 1 + vals.length) % vals.length];
		}
	}

	private static class Position {
		private final long x;
		private final long y;
		
		public Position(long x, long y) {
			this.x = x;
			this.y = y;
		}
		
		public long getX() {
			return x;
		}

		public long getY() {
			return y;
		}
		
		public static Position computePosition(Position start, Orientation orientation, long scalar) {
			switch (orientation) {
			case UP:
				return new Position(start.x, start.y + scalar);
			case RIGHT:
				return new Position(start.x + scalar, start.y);
			case DOWN:
				return new Position(start.x, start.y - scalar);
			case LEFT:
				return new Position(start.x - scalar, start.y);
			}
			return null;
		}

		@Override
		public String toString() {
			return x + " " + y;
		}
	}
	
	private static class RootedTree {
		private int numNodes;
		private int[][] adjacencyMatrix;
		
		private static final int ROOT = 0;
		
		public RootedTree(int numNodes, List<InputEdge> edges) {
			this.numNodes = numNodes;
			adjacencyMatrix = new int[numNodes][numNodes];
			for(InputEdge edge : edges) {
				adjacencyMatrix[edge.getStart()][edge.getTarget()] = 1;
			}
		}
		
		public int getNumNodes() {
			return numNodes;
		}

		public int getOutDegree(int node) {
			return Arrays.stream(adjacencyMatrix[node]).sum();
		}
		
		public int getRoot() {
			return ROOT;
		}
		
		public Iterable<Integer> getNeighbors(int node) {
			return new Neighbors(node);
		}
		
		private class Neighbors implements Iterable<Integer> {
			private int node;
			
			public Neighbors(int node) {
				this.node = node;
			}
			
			@Override
			public Iterator<Integer> iterator() {
				return new NeighborIterator();
			}
			
			private class NeighborIterator implements Iterator<Integer> {
				private int curEdge;
				private int nextEdge;
				private boolean hasNext;
				
				NeighborIterator() {
					curEdge = -1;
					computeNext();
				}
				
				private void computeNext() {
					nextEdge = curEdge + 1;
					while((nextEdge < numNodes) && (adjacencyMatrix[node][nextEdge] == 0)) {
						nextEdge++;
					}
					if(nextEdge >= numNodes) {
						hasNext = false;
					} else {
						hasNext = true;
					}
				}

				@Override
				public boolean hasNext() {
					return hasNext;
				}

				@Override
				public Integer next() {
					curEdge = nextEdge;
					computeNext();
					return curEdge;
				}
			}
		}
		
		public static class InputEdge {
			private final int start;
			private final int target;
			
			public static InputEdge fromLine(String line) {
				String[] strs = line.split(" ");
				int node1 = Integer.parseInt(strs[0]) - 1;
				int node2 = Integer.parseInt(strs[1]) - 1;
				return new InputEdge(node1, node2);
			}
			
			public InputEdge getReversedEdge() {
				return new InputEdge(target, start);
			}
			
			public InputEdge(int start, int target) {
				this.start = start;
				this.target = target;
			}

			public int getStart() {
				return start;
			}
			
			public int getTarget() {
				return target;
			}
		}
	}
}