1041_E. Tree Reconstruction
Monocarp has drawn a tree (an undirected connected acyclic graph) and then has given each vertex an index. All indices are distinct numbers from 1 to n. For every edge e of this tree, Monocarp has written two numbers: the maximum indices of the vertices of the two components formed if the edge e (and only this edge) is erased from the tree.

Monocarp has given you a list of n - 1 pairs of numbers. He wants you to provide an example of a tree that will produce the said list if this tree exists. If such tree does not exist, say so.

Input

The first line contains one integer n (2 ≤ n ≤ 1 000) — the number of vertices in the tree.

Each of the next n-1 lines contains two integers a_i and b_i each (1 ≤ a_i < b_i ≤ n) — the maximal indices of vertices in the components formed if the i-th edge is removed.

Output

If there is no such tree that can produce the given list of pairs, print "NO" (without quotes).

Otherwise print "YES" (without quotes) in the first line and the edges of the tree in the next n - 1 lines. Each of the last n - 1 lines should contain two integers x_i and y_i (1 ≤ x_i, y_i ≤ n) — vertices connected by an edge.

Note: The numeration of edges doesn't matter for this task. Your solution will be considered correct if your tree produces the same pairs as given in the input file (possibly reordered). That means that you can print the edges of the tree you reconstructed in any order.

Examples

Input

4
3 4
1 4
3 4


Output

YES
1 3
3 2
2 4


Input

3
1 3
1 3


Output

NO


Input

3
1 2
2 3


Output

NO

Note

Possible tree from the first example. Dotted lines show edges you need to remove to get appropriate pairs. 

<image>
```python
# 

def solve():
    n = int(input())
    d = {}
    
    for _ in range(n-1):
        u, v = map(int, input().split())
        min_ = min(u, v)
        max_ = max(u, v)
        
        if max_ != n:
            return False, None
        
        if min_ not in d:
            d[min_] = 0
        d[min_] += 1
    
    if sum(list(d.values())) + 1 != n:
        return False, None
        
    edge = [] 
    used = {i:False for i in range(1, n+1)}
    
    for k in sorted(list(d.keys())):
        used[k] = True
        mid     = [n]
        
        for i in range(k-1, 0, -1): # k-1->1
            
            if len(mid) == d[k]:
                break
                
            if used[i] == False:
                used[i] = True
                mid.append(i)
                
        if len(mid) < d[k]:
            return False, None
        
        mid.append(k)
        
        for  u, v in zip(mid[:-1], mid[1:]):
            edge.append([u, v])
    
    return True, edge        
            
ans, arr = solve()

if ans == False:
    print('NO')
else:
    print('YES')
    for u, v in arr:
        print(str(u)+' '+str(v))

#4
#3 4
#1 4
#3 4    
    
```