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:
import java.util.Scanner;
import java.io.*;
import java.util.*;
import java.math.*;
import java.lang.*;
import static java.lang.Math.*;
 
public class Check2
{
	static class InputReader
	{
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;
		private SpaceCharFilter filter;
		
		public InputReader(InputStream stream)
		{
			this.stream = stream;
		}
		
		public int read()
		{
			if (numChars==-1) 
				throw new InputMismatchException();
			
			if (curChar >= numChars)
			{
				curChar = 0;
				try 
				{
					numChars = stream.read(buf);
				}
				catch (IOException e)
				{
					throw new InputMismatchException();
				}
				
				if(numChars <= 0)				
					return -1;
			}
			return buf[curChar++];
		}
	 
		public String nextLine()
		{
			BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
			String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
		}
		public int nextInt()
		{
			int c = read();
			
			while(isSpaceChar(c)) 
				c = read();
			
			int sgn = 1;
			
			if (c == '-') 
			{
				sgn = -1;
				c = read();
			}
			
			int res = 0;
			do 
			{
				if(c<'0'||c>'9') 
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			}
			while (!isSpaceChar(c)); 
			
			return res * sgn;
		}
		
		public long nextLong() 
		{
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') 
			{
				sgn = -1;
				c = read();
			}
			long res = 0;
			
			do 
			{
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			}
			while (!isSpaceChar(c));
				return res * sgn;
		}
		
		public double nextDouble() 
		{
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') 
			{
				sgn = -1;
				c = read();
			}
			double res = 0;
			while (!isSpaceChar(c) && c != '.') 
			{
				if (c == 'e' || c == 'E')
					return res * Math.pow(10, nextInt());
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			}
			if (c == '.') 
			{
				c = read();
				double m = 1;
				while (!isSpaceChar(c)) 
				{
					if (c == 'e' || c == 'E')
						return res * Math.pow(10, nextInt());
					if (c < '0' || c > '9')
						throw new InputMismatchException();
					m /= 10;
					res += (c - '0') * m;
					c = read();
				}
			}
			return res * sgn;
		}
		
		public String readString() 
		{
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do 
			{
				res.appendCodePoint(c);
				c = read();
			} 
			while (!isSpaceChar(c));
			
			return res.toString();
		}
	 
		public boolean isSpaceChar(int c) 
		{
			if (filter != null)
				return filter.isSpaceChar(c);
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}
	 
		public String next() 
		{
			return readString();
		}
		
		public interface SpaceCharFilter 
		{
			public boolean isSpaceChar(int ch);
		}
	}
	
	static long gcd(long a,long b)
	{
		if(b==0)
			return a;
		
		return gcd(b,a%b);
	}
	
	static class pair implements Comparable<pair>
	{
		int i;
		int pos;
		
		long val;
		
		public pair(int i,int pos, long val)
		{
			this.i=i;
			this.pos=pos;
			this.val=val;
		}
		
		public int compareTo(pair pa)
		{
			return Integer.compare(pos,pa.pos);
		}
	}
	
	public static void main(String args[]) throws Exception
	{
		InputReader sc=new InputReader(System.in);		
		PrintWriter w=new PrintWriter(System.out);
		
		int n=sc.nextInt();
		
		ArrayList<Integer> list[]=new ArrayList[n+1];
		
		for(int i=1;i<=n;i++)
			list[i]=new ArrayList<Integer>();
		
		int visit[]=new int[n+1];
		
		long x[]=new long[n+1];
		long y[]=new long[n+1];
		
		long dist[]=new long[n+1];
		dist[1]=1L<<58;
		int arr[]=new int[n+1];
		
		int dir[][]=new int[n+1][5]; /*   1
										3	4
										  2		*/
		for(int i=0;i<n-1;i++)
		{
			int a=sc.nextInt();
			int b=sc.nextInt();
			
			list[a].add(b);
			list[b].add(a);
			
			arr[a]++;
			arr[b]++;
		}
		
		int flag=0;
		
		for(int in:arr)
		{
			if(in>4)
				flag=1;
		}
		
		if(flag==1)
			w.println("NO");
		else
		{
			w.println("YES");
			ArrayList<Integer> queue=new ArrayList<Integer>();
			queue.add(1);
			x[1]=0;
			y[1]=0;
			
			while(queue.size()!=0)
			{
				int head=queue.remove(0);
				
				if(visit[head]!=0)
					continue;
				
				visit[head]++;
				
				for(int in:list[head])
				{
					if(visit[in]!=0)
						continue;
					
					int j=0;
					for(j=1;j<5;j++)
					{
						if(dir[head][j]==0)
							break;
					}
					//w.println(in+" "+j);
					dir[head][j]++;
					
					if(j==1)
					{
						dir[in][2]++;
						dist[in]=dist[head]/4;
						y[in]=y[head]+dist[head];
						x[in]=x[head];
					}
					else if(j==2)
					{
						dir[in][1]++;
						dist[in]=dist[head]/4;
						y[in]=y[head]-dist[head];
						x[in]=x[head];
					}
					else if(j==3)
					{
						dir[in][4]++;
						dist[in]=dist[head]/4;
						x[in]=x[head]+dist[head];
						y[in]=y[head];
					}
					else
					{
						dir[in][3]++;
						dist[in]=dist[head]/4;
						x[in]=x[head]-dist[head];
						y[in]=y[head];
					}
					queue.add(in);
				}
			}
			
			
			for(int i=1;i<=n;i++)
				w.println(x[i]+" "+y[i]);
		}
		w.close();	
	}
}