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.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Comparator;
import java.util.StringTokenizer;
import java.util.TreeSet;


public class f_638 {

	public static void main(String[] args) throws Exception {
		// TODO Auto-generated method stub

		FastScanner in = new FastScanner(System.in);
		OutputStream outputStream = System.out;
		PrintWriter out = new PrintWriter(outputStream);
		
		int T = 1;
		Solver A = new Solver(in, out); 
		
		for(int aa = 0; aa < T; aa++) {
			A.answer(aa + 1);
		}
		
		
		out.close();
	}
	
	static class Solver {
		FastScanner in;
		PrintWriter out;
		
		int n, a [][], val [], tree [];
		pair p [], sort [];

		public Solver(FastScanner in, PrintWriter out) {
			this.in = in;
			this.out = out;
		}
		
		public void answer(int aa) throws Exception {
			n = in.nextInt();
			a = new int [n][2];
			p = new pair [n];
			
			val = new int [n];
			tree = new int [4*n];
			
			for(int i = 0; i < n; i++) {
				a[i][0] = in.nextInt() - 1;
				a[i][1] = in.nextInt() - 1;
				p[i] = new pair(a[i][0], a[i][1], i);
			}
			
			Arrays.sort(p, new sortFirst());
			sort = new pair [n];
			int assign [] = new int [n];
			
			TreeSet<pair> min = new TreeSet<>();
			int l = 0;
			for(int i = n-1; i >= 0; i--) {
				while(l < n && p[l].e == i) {
					min.add(p[l]);
					l++;
				}
				pair best = min.pollFirst();
				sort[i] = best;
				assign[best.id] = i;
				val[i] = best.s; 
			}
			
			init();
			boolean works = true;
			for(int i = 0; i < n-1; i++) {
				if(i+1 > sort[i].e) continue;
				int small = query(i+1, sort[i].e);
				if(val[small] <= i) {
					works = false;
					swap(i, small);
					break;
				}
			}
			
			if(works) {
				out.println("YES");
				for(int i = 0; i < n; i++) {
					out.print((assign[i]+1) + " ");
				}
			} else {
				out.println("NO");
				for(int i = 0; i < n; i++) {
					out.print((assign[i]+1) + " ");
				} 
				out.println();
				for(int i = 0; i < n; i++) {
					assign[sort[i].id] = i;
				}
				for(int i = 0; i < n; i++) {
					out.print((assign[i]+1) + " ");
				} 
			}
			
		}
		
		private void init() {
			build(1, 0, n-1);
		}
		
		public void build(int c, int l, int r) {
			if(l == r) {
				tree[c] = l;
			} else {
				int mid = (l+r)/2;
				build(2*c, l, mid);
				build(2*c+1, mid+1, r);
				tree[c] = val[tree[2*c]] < val[tree[2*c+1]] ? tree[2*c] : tree[2*c+1];
			}
		}
		
		public int query(int s, int e) {
			return smallest(1, 0, n-1, s, e);
		}
		
		public int smallest(int c, int l, int r, int s, int e) {
			if(s > r || e < l) return s;
			if(s <= l && r <= e) {
				return tree[c];
			}
			
			int mid = (l+r)/2;
			int lr = smallest(2*c, l, mid, s, e);
			int rr = smallest(2*c+1, mid+1, r, s, e);
			return val[lr] < val[rr] ? lr : rr; 
		}
		
		public void swap(int i, int j) {
			pair temp = sort[i];
			sort[i] = sort[j];
			sort[j] = temp;
		}
		

	}
	
	static class pair implements Comparable<pair> {
		int s, e, id;
		
		public pair(int S, int E, int ID) {
			s = S;
			e = E;
			id = ID;
		}

		@Override
		public int compareTo(pair o) {
			if(s == o.s) {
				if(e == o.e) {
					return Integer.compare(id, o.id);
				}
				return Integer.compare(e, o.e);
			}
			return -Integer.compare(s, o.s);
		}
	}
	
	static class sortFirst implements Comparator<pair> {
		public int compare(pair o1, pair o2) {
			if(o1.e == o2.e) {
				if(o1.s == o2.s) {
					return Integer.compare(o1.id, o2.id);
				}
				return -Integer.compare(o1.s, o2.s);
			} else {
				return -Integer.compare(o1.e, o2.e);
			}
		}
		
	}
	
	static class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner(InputStream stream) {
			br = new BufferedReader(new InputStreamReader(stream));
			st = new StringTokenizer("");
		}

		public FastScanner(String fileName) throws Exception {
			br = new BufferedReader(new FileReader(new File(fileName)));
			st = new StringTokenizer("");
		}

		public String next() throws Exception {
			while (!st.hasMoreTokens()) {
				st = new StringTokenizer(br.readLine());
			}
			return st.nextToken();
		}

		public int nextInt() throws Exception {
			return Integer.parseInt(next());
		}

		public long nextLong() throws Exception {
			return Long.parseLong(next());
		}

		public Double nextDouble() throws Exception {
			return Double.parseDouble(next());
		}

		public String nextLine() throws Exception {
			if (st.hasMoreTokens()) {
				StringBuilder str = new StringBuilder();
				boolean first = true;
				while (st.hasMoreTokens()) {
					if (first) {
						first = false;
					} else {
						str.append(" ");
					}
					str.append(st.nextToken());
				}
				return str.toString();
			} else {
				return br.readLine();
			}
		}
	}
	
}