Problem: Phoenix is trying to take a photo of his n friends with labels 1, 2, ..., n who are lined up in a row in a special order. But before he can take the photo, his friends get distracted by a duck and mess up their order.

Now, Phoenix must restore the order but he doesn't remember completely! He only remembers that the i-th friend from the left had a label between a_i and b_i inclusive. Does there exist a unique way to order his friends based of his memory? 

Input

The first line contains one integer n (1 ≤ n ≤ 2⋅10^5) — the number of friends.

The i-th of the next n lines contain two integers a_i and b_i (1 ≤ a_i ≤ b_i ≤ n) — Phoenix's memory of the i-th position from the left.

It is guaranteed that Phoenix's memory is valid so there is at least one valid ordering.

Output

If Phoenix can reorder his friends in a unique order, print YES followed by n integers — the i-th integer should be the label of the i-th friend from the left.

Otherwise, print NO. Then, print any two distinct valid orderings on the following two lines. If are multiple solutions, print any.

Examples

Input


4
4 4
1 3
2 4
3 4


Output


YES
4 1 2 3 


Input


4
1 3
2 4
3 4
2 3


Output


NO
1 3 4 2 
1 2 4 3 

Solution (in JAVA):

Solution:
/*
stream Butter!
eggyHide eggyVengeance
I need U
xiao rerun when
 */
import static java.lang.Math.max;
import static java.lang.Math.min;
import static java.lang.Math.abs;
import static java.lang.System.out;
import java.util.*;
import java.io.*;
import java.math.*;

public class x1348F
{
    public static void main(String hi[]) throws Exception
    {
        BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(infile.readLine());
        int N = Integer.parseInt(st.nextToken());
        Range[] original = new Range[N];
        Range[] arr = new Range[N];
        for(int i=0; i < N; i++)
        {
            st = new StringTokenizer(infile.readLine());
            int a = Integer.parseInt(st.nextToken());
            int b = Integer.parseInt(st.nextToken());
            arr[i] = new Range(a, b, i);
            original[i] = new Range(a, b, i);
        }
        Arrays.sort(arr);
        int[] res = find(arr, N);
        StringBuilder sb = new StringBuilder();
        for(int x: res)
            sb.append(x+" ");
        SegmentTree segtree = new SegmentTree(1, N);
        ArrayList<Integer> order = new ArrayList<Integer>();
        for(int i=0; i < N; i++)
            order.add(i);
        Collections.sort(order, (x,y) -> {
            return res[y]-res[x];
        });
        segtree.update(res[order.get(0)], original[order.get(0)].left);
        for(int i=1; i < N; i++)
        {
            Node minloc = segtree.query(res[order.get(i)], original[order.get(i)].right);
            if(minloc != null && minloc.a <= res[order.get(i)])
            {
                int x = res[order.get(i)];
                int y = minloc.y;
                int locX = -1, locY = -1;
                for(int a=0; a < N; a++)
                {
                    if(res[a] == x)
                        locX = a;
                    if(res[a] == y)
                        locY = a;
                }
                res[locX] = (res[locX]+res[locY])-(res[locY]=res[locX]);
                System.out.println("NO");
                sb.append("\n");
                for(int xx: res)
                    sb.append(xx+" ");
                System.out.println(sb);
                return;
            }
            segtree.update(res[order.get(i)], original[order.get(i)].left);
        }
        System.out.println("YES");
        System.out.println(sb);
    }
    public static int[] find(Range[] arr, int N)
    {
        int[] res = new int[N];
        TreeSet<Range> active = new TreeSet<Range>((x, y) -> {
            if(x.right == y.right)
                return x.id-y.id;
            return x.right-y.right;
        });
        int pointer = 0;
        for(int v=1; v <= N; v++)
        {
            while(pointer < N && arr[pointer].left <= v)
                active.add(arr[pointer++]);
            Range choice = active.first();
            active.remove(choice);
            res[choice.id] = v;
        }
        return res;
    }
}
class Range implements Comparable<Range>
{
    public int id;
    public int left;
    public int right;

    public Range(int a, int b, int i)
    {
        left = a;
        right = b;
        id = i;
    }
    public int compareTo(Range oth)
    {
        if(left == oth.left)
            return right-oth.right;
        return left-oth.left;
    }
}
class SegmentTree
{
    //iterative implementation = low constant runtime factor
    //range query, non lazy
    final Node[] val;
    final int treeFrom;
    final int length;

    public SegmentTree(int treeFrom, int treeTo)
    {
        this.treeFrom = treeFrom;
        int length = treeTo - treeFrom + 1;
        int l;
        for (l = 0; (1 << l) < length; l++);
        val = new Node[1 << (l + 1)];
        this.length = 1 << l;
    }
    public void update(int index, int delta)
    {
        //replaces value
        int node = index - treeFrom + length;
        val[node] = new Node(delta, index);
        for (node >>= 1; node > 0; node >>= 1)
            val[node] = comb(val[node << 1], val[(node << 1) + 1]);
    }
    public Node query(int from, int to)
    {
        //inclusive bounds
        if (to < from)
            return null; //0 or 1?
        from += length - treeFrom;
        to += length - treeFrom + 1;
        //0 or 1?
        Node res = null;
        for (; from + (from & -from) <= to; from += from & -from)
            res = comb(res, val[from / (from & -from)]);
        for (; to - (to & -to) >= from; to -= to & -to)
            res = comb(res, val[(to - (to & -to)) / (to & -to)]);
        return res;
    }
    public Node comb(Node left, Node right)
    {
        if(left == null)
            return right;
        if(right == null)
            return left;
        if(left.a <= right.a)
            return left;
        return right;
    }
}
class Node
{
    //a <= y <= b
    public int a;
    public int y;

    public Node(int q, int w)
    {
        a = q;
        y = w;
    }
}