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 PYTHON):

Solution:
import math

n = input()
#print n

r = []
v = {} ## orig


def left(r_from, r_to, v):
    v_from = v[r_from] 
    if (v_from[0]!=0):
        return False
    v_to = v[r_to]
    if (v_to[2]!=0):
        return False
    v_from[0] = r_to
    v_to[2] = r_from
    return True

def up(r_from, r_to, v):
    v_from = v[r_from] 
    if (v_from[1]!=0):
        return False
    v_to = v[r_to]
    if (v_to[3]!=0):
        return False
    v_from[1] = r_to
    v_to[3] = r_from
    return True
    
def right(r_from, r_to, v):
    v_from = v[r_from] 
    if (v_from[2]!=0):
        return False
    v_to = v[r_to]
    if (v_to[0]!=0):
        return False
    v_from[2] = r_to
    v_to[0] = r_from
    return True

def down(r_from, r_to, v):
    v_from = v[r_from] 
    if (v_from[3]!=0):
        return False
    v_to = v[r_to]
    if (v_to[1]!=0):
        return False
    v_from[3] = r_to
    v_to[1] = r_from
    return True

"""
def findVE(r1, v1):
    if r1 == []:
        return 1 ##totally ok

    r_from = r1[0][0]
    r_to = r1[0][1]
    v_begin = v1[r_from] ## get new v from head of r1

    # find v
    if not left(v_begin, r_to):
        if not up(v_begin, r_to):
            if not right(v_begin, r_to):
                if not down(v_begin, r_to):
                    return 0 ## failed

   return findVE(r1[1:], v1)
"""

def buildV(r, v):
    for x in r:
        r_from = x[0]
        r_to = x[1]
        #print r_from, r_to, v.keys()
        
        # find v
        if not left(r_from, r_to, v):
            if not up(r_from, r_to, v):
                if not right(r_from, r_to, v):
                    if not down(r_from, r_to, v):
                        return 0 ## failed

    return 1   # have solution

if(n==1):
    print "YES"
    print 0, 0
    exit()
    
for i in range(n-1):
  r1 = map(int, raw_input().split())
  r += [r1]
#print r

for i in range(n):
    v[i+1] = [0,0,0,0]
#print v

res = buildV(r, v)

if(res==0):
    print "NO"

elif (res==1):
    print "YES"

    #print v
    
    pt = {}
    level = {}

    #init
    init = r[0][0]
    level[init] = 1
    pt[init] = (0,0) 

    #print r
    for i in range(n-1):
        #print i
        ii = r[i][0]
        #print ii
        vp = v[ii]
        #print level
        l = level.get(ii)
        if l==None:
            ii = r[i][1]
            vp = v[ii]
            l = level.get(ii)
        
        offset = 1.0/(l*2)
        pt0 = pt[ii]
        if vp[0] != 0:
            index = vp[0]
            if level.get(index) == None:  # empty
                pt[index] = (pt0[0] -offset, pt0[1])
                level[index] = l*2
        if vp[1] != 0:
            index = vp[1]
            if level.get(index) == None:  # empty
                pt[index] = (pt0[0], pt0[1] + offset)
                level[index] = l*2
        if vp[2] != 0:
            index = vp[2]
            if level.get(index) == None:  # empty
                pt[index] = (pt0[0]+ offset, pt0[1])
                level[index] = l*2
        if vp[3] != 0:
            index = vp[3]
            if level.get(index) == None:  # empty
                pt[index] = (pt0[0], pt0[1] - offset)
                level[index] = l*2

    #print level
    #print pt

    fac = max(level.values())
    for i in range(n):
        print int(math.ceil(pt[i+1][0]*fac)), int(math.ceil(pt[i+1][1]*fac))
        

"""
13
1 2
1 3
1 4
2 5
2 6
2 7
3 8
3 9
3 10
4 11
4 12
4 13

20
1 2
1 3
1 4
1 5
2 6
2 7
2 8
3 9
3 10
3 11
4 12
4 13
4 14
5 15
5 16
5 17
18 17
19 17
20 17

"""