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.*;
import static java.lang.Math.*;

// it's problem 1872 from timus
// and its clone https://codeforces.com/gym/100187/problem/C

public class SpaciousOffice implements Runnable {

	final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;

	BufferedReader in;
	PrintWriter out;
	StringTokenizer tok;

	@Override
	public void run() {
		try {
			long startTime = System.currentTimeMillis();
			if (ONLINE_JUDGE) {
				in = new BufferedReader(new InputStreamReader(System.in));
				out = new PrintWriter(System.out);
			} else {
				in = new BufferedReader(new FileReader("input.txt"));
				out = new PrintWriter("output.txt");
			}
			tok = new StringTokenizer("");
			Locale.setDefault(Locale.US);
			solve();
			in.close();
			out.close();
			long endTime = System.currentTimeMillis();
			long totalMemory = Runtime.getRuntime().totalMemory();
			long freeMemory = Runtime.getRuntime().freeMemory();
			System.err.println("Time = " + (endTime - startTime) + " ms");
			System.err.println("Memory = " + ((totalMemory - freeMemory) / 1024) + " KB");
		} catch (Throwable e) {
			e.printStackTrace(System.err);
			System.exit(-1);
		}
	}

	String readString() throws IOException {
		while (!tok.hasMoreTokens()) {
			tok = new StringTokenizer(in.readLine());
		}
		return tok.nextToken();
	}

	int readInt() throws IOException {
		return Integer.parseInt(readString());
	}

	long readLong() throws IOException {
		return Long.parseLong(readString());
	}

	double readDouble() throws IOException {
		return Double.parseDouble(readString());
	}

	void debug(Object... o) {
		if (!ONLINE_JUDGE) {
			System.err.println(Arrays.deepToString(o));
		}
	}

	public static void main(String[] args) {
		new Thread(null, new SpaciousOffice(), "", 256 * 1024 * 1024).start();
	}

//------------------------------------------------------------------------------

	class Room implements Comparable<Room> {
		int x, id;

		public Room(int x, int id) {
			this.x = x;
			this.id = id;
		}

		@Override
		public String toString() {
			return String.valueOf(x);
		}

		@Override
		public int compareTo(Room o) {
			return x == o.x ? id - o.id : x - o.x;
		}
	}

	class Item implements Comparable<Item> {
		int r, id;

		public Item(int r, int id) {
			this.r = r;
			this.id = id;
		}

		@Override
		public int compareTo(Item o) {
			return r == o.r ? id - o.id : r - o.r;
		}
	}

	class Event implements Comparable<Event> {
		static final int OPEN = 0;
		static final int ROOM = 1;
		static final int CLOSE = 2;

		int x, type, id;

		public Event(int x, int type, int id) {
			this.x = x;
			this.type = type;
			this.id = id;
		}

		@Override
		public int compareTo(Event o) {
			return x == o.x ? type - o.type : x - o.x;
		}
	}

	class SegmentTree {
		final static int INF = (int) 1e9;

		int n;
		int[] t;

		public SegmentTree(int n) {
			this.n = n;
			t = new int[4*n + 1];
			Arrays.fill(t, -INF);
		}

		public int getMax(int L, int R) {
			if (L > R) {
				return -INF;
			}
			return getMax(1, 0, n-1, L, R);
		}


		private int getMax(int v, int tl, int tr, int l, int r) {
			if (tl == l && tr == r) {
				return t[v];
			}
			int tm = (tl + tr) / 2;
			if (r <= tm) {
				return getMax(2*v, tl, tm, l, r);
			} else if (tm+1 <= l) {
				return getMax(2*v+1, tm+1, tr, l, r);
			} else {
				return max(getMax(2*v, tl, tm, l, tm), getMax(2*v+1, tm+1, tr, tm+1, r));
			}
		}

		public void set(int pos, int val) {
			set(1, 0, n-1, pos, val);
		}

		private void set(int v, int tl, int tr, int pos, int val) {
			if (tl == tr) {
				t[v] = val;
				return;
			}
			int tm = (tl + tr) / 2;
			if (pos <= tm) {
				set(2*v, tl, tm, pos, val);
			} else {
				set(2*v+1, tm+1, tr, pos, val);
			}
			t[v] = max(t[2*v], t[2*v+1]);
		}
	}

	void solve() throws IOException {
		int n = readInt();
		Room[] a = new Room[n];
		for (int i = 0; i < n; i++) {
//			a[i] = new Room(readInt(), i);
			a[i] = new Room(i + 1, i);
		}
		int[] left = new int[n];
		int[] right = new int[n];
		for (int i = 0; i < n; i++) {
			left[i] = readInt();
			right[i] = readInt();
		}
		Arrays.sort(a);
		int[] p = new int[n];
		Arrays.fill(p, -1);
		List<Event> list = new ArrayList<Event>();
		for (int i = 0; i < n; i++) {
			list.add(new Event(left[i], Event.OPEN, i));
			list.add(new Event(right[i], Event.CLOSE, i));
			list.add(new Event(a[i].x, Event.ROOM, i));
		}
		Collections.sort(list);
		NavigableSet<Item> rights = new TreeSet<Item>();
		boolean multiple = false;
		int indexToSwap = -1;
		SegmentTree tree = new SegmentTree(n);
		int roomCount = 0;
		for (Event e : list) {
			if (e.type == Event.OPEN) {
				rights.add(new Item(right[e.id], e.id));
			} else if (e.type == Event.CLOSE) {
				rights.remove(new Item(e.x, e.id));
			} else {
				Item item = rights.pollFirst();
				if (item == null) {
//					out.println("Let's search for another office.");
//					return;
					throw new AssertionError();
				}
				int roomID = e.id;
				int depID = item.id;
				int leftIdx = Arrays.binarySearch(a, new Room(left[depID], -1));
				leftIdx = ~leftIdx;
				if (e.x <= tree.getMax(leftIdx, roomCount-1)) {
					multiple = true;
					indexToSwap = depID;
				}
				p[depID] = roomID;
				tree.set(roomID, right[depID]);
				roomCount++;
			}
		}

		validate(p, a, left, right);

		if (multiple) {
//			out.println("Ask Shiftman for help.");
			out.println("NO");
			printArray(p, a);

			boolean swapped = false;
			for (int otherIndex = 0; otherIndex < n; otherIndex++) {
				if (otherIndex != indexToSwap) {
					swap(p, indexToSwap, otherIndex);
					if (validateOne(p, a, left, right, indexToSwap) && validateOne(p, a, left, right, otherIndex)) {
						swapped = true;
						break;
					}
					swap(p, indexToSwap, otherIndex);
				}
			}
			if (!swapped) {
				throw new AssertionError();
			}

			printArray(p, a);
		} else {
//			out.println("Perfect!");
			out.println("YES");
			printArray(p, a);
		}
	}

	private void swap(int[] p, int i, int j) {
		int tmp = p[i];
		p[i] = p[j];
		p[j] = tmp;
	}

	private void printArray(int[] p, Room[] a) {
		for (int i = 0; i < p.length; i++) {
			out.print(a[p[i]].id + 1);
			if (i == p.length - 1) out.println(); else out.print(" ");
		}
	}

	private void validate(int[] p, Room[] a, int[] left, int[] right) {
		for (int i = 0; i < p.length; i++) {
			if (!validateOne(p, a, left, right, i)) {
				throw new AssertionError();
			}
		}
	}

	private boolean validateOne(int[] p, Room[] a, int[] left, int[] right, int i) {
		return left[i] <= a[p[i]].x && a[p[i]].x <= right[i];
	}
}