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:
import java.io.*;
import java.util.*;

public class F {
	public static void main (String[] args) { new F(); }

	public F() {
		FastScanner fs = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		System.err.println("");

		int n = fs.nextInt();
		Range[] ranges = new Range[n];
		for(int i = 0; i < n; i++) {
			ranges[i] = new Range(fs.nextInt()-1, fs.nextInt()-1, i);
		}
		Arrays.sort(ranges);
		
		TreeSet<Integer> avail = new TreeSet<>();
		for(int i = 0; i < n; i++) avail.add(i);
		
		for(Range r : ranges) {
			Integer it = avail.ceiling(r.L);
			if(it == null) throw null;
			
			r.initOrder = it;
			avail.remove(it);
		}
		
		ArrayList<Integer>[] remEvent = new ArrayList[n];
		for(int i = 0; i < n; i++) remEvent[i] = new ArrayList<>();
		
		Arrays.sort(ranges, (x, y) -> Integer.compare(x.initOrder, y.initOrder));
		for(Range r : ranges) {
			if(r.R + 1 < n) {
				remEvent[r.R + 1].add(r.initOrder);
			}
		}
		
		ST st = new ST(0, n-1);
		
		int ptr = 0;
		int p1 = -1, p2 = -1;
		
		for(int i = 0; i < n; i++) {
			for(int x : remEvent[i]) {
				st.pointUpdate(x, oo);
			}
			int x = ranges[ptr].initOrder;
			if(x != i) continue;
			
//			System.out.println(" on " + ranges[ptr].L + " " + ranges[ptr].R + " and we have " + ranges[ptr].initOrder + " ID " + ranges[ptr].id);
			
			int min = st.rangeQuery(ranges[ptr].L, ranges[ptr].R);
			if(min != oo) {
				
				p1 = min;
				p2 = ranges[ptr].id;
				break;
				
			}
			
			st.pointUpdate(x, x);
			ptr++;
			if(ptr == n) break;
		}
		
		int[] array = new int[n];
		for(Range r : ranges) {
			array[r.id] = r.initOrder + 1;
		}
		
		if(p1 < 0) {
			out.println("YES");
			for(int x : array) out.print(x + " ");
			out.println();
		}
		else {
			
			for(int i = 0; i < n; i++) {
				if(ranges[i].initOrder == p1) {
					p1 = ranges[i].id;
					break;
				}
			}
			
			out.println("NO");
			for(int x : array) out.print(x + " ");
			out.println();
			
			int t = array[p1];
			array[p1] = array[p2];
			array[p2] = t;
			
			for(int x : array) out.print(x + " ");
			out.println();
		}
		
		out.close();
	}
	
	int oo = (int)1e8;
	class ST {
		int L, R;
		ST left, right;
		int min;
		ST(int a, int b) {
			L = a; R = b;
			if(a == b) {
				min = oo;
				return;
			}
			int mid = (a+b)/2;
			left = new ST(a, mid);
			right = new ST(mid+1, b);
			update();
		}
		void pointUpdate(int idx, int val) {
			if(L == R) {
				min = val;
				return;
			}
			if(idx <= left.R) left.pointUpdate(idx, val);
			else right.pointUpdate(idx, val);
			
			update();
		}
		int rangeQuery(int ll, int rr) {
			if(rr < L || R < ll) return oo;
			if(ll <= L && R <= rr) {
				return min;
			}
			return Math.min(left.rangeQuery(ll, rr), right.rangeQuery(ll, rr));
		}
		void update() {
			min = Math.min(left.min, right.min);
		}
	}
	
	class Range implements Comparable<Range> {
		int L, R, id, initOrder;
		Range(int a, int b, int i) {
			id = i;
			L = a; R = b;
		}
		public int compareTo(Range r) {
			int c = Integer.compare(R, r.R);
			if(c == 0) c = Integer.compare(L, r.L);
			return c;
		}
	}

	class FastScanner {
		public int BS = 1<<16;
		public char NC = (char)0;
		byte[] buf = new byte[BS];
		int bId = 0, size = 0;
		char c = NC;
		double num = 1;
		BufferedInputStream in;

		public FastScanner() {
			in = new BufferedInputStream(System.in, BS);
		}

		public FastScanner(String s) {
			try {
				in = new BufferedInputStream(new FileInputStream(new File(s)), BS);
			}
			catch (Exception e) {
				in = new BufferedInputStream(System.in, BS);
			}
		}

		public char nextChar(){
			while(bId==size) {
				try {
					size = in.read(buf);
				}catch(Exception e) {
					return NC;
				}                
				if(size==-1)return NC;
				bId=0;
			}
			return (char)buf[bId++];
		}

		public int nextInt() {
			return (int)nextLong();
		}

		public long nextLong() {
			num=1;
			boolean neg = false;
			if(c==NC)c=nextChar();
			for(;(c<'0' || c>'9'); c = nextChar()) {
				if(c=='-')neg=true;
			}
			long res = 0;
			for(; c>='0' && c <='9'; c=nextChar()) {
				res = (res<<3)+(res<<1)+c-'0';
				num*=10;
			}
			return neg?-res:res;
		}

		public double nextDouble() {
			double cur = nextLong();
			return c!='.' ? cur:cur+nextLong()/num;
		}

		public String next() {
			StringBuilder res = new StringBuilder();
			while(c<=32)c=nextChar();
			while(c>32) {
				res.append(c);
				c=nextChar();
			}
			return res.toString();
		}

		public String nextLine() {
			StringBuilder res = new StringBuilder();
			while(c<=32)c=nextChar();
			while(c!='\n') {
				res.append(c);
				c=nextChar();
			}
			return res.toString();
		}

		public boolean hasNext() {
			if(c>32)return true;
			while(true) {
				c=nextChar();
				if(c==NC)return false;
				else if(c>32)return true;
			}
		}
		
		public int[] nextIntArray(int n) {
			int[] res = new int[n];
			for(int i = 0; i < n; i++) res[i] = nextInt();
			return res;
		}
		
	}

}