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 
4
3 4
1 2
3 4
1 2
 4
2 4
1 3
4 4
1 1
 10
6 6
1 2
2 2
6 7
8 8
3 5
5 5
4 4
8 9
10 10
 4
1 4
1 4
2 4
1 2
 8
3 4
7 8
2 6
1 3
6 7
5 8
4 6
8 8
 7
7 7
2 3
2 3
5 7
5 6
4 4
1 2
 15
2 2
10 11
2 5
6 7
7 12
9 9
2 3
5 14
1 3
10 10
15 15
12 12
5 6
6 6
14 15
 5
1 3
4 4
5 5
1 4
1 5
 4
1 4
2 3
2 3
4 4
 4
1 4
1 4
1 2
1 4
 5
1 3
1 3
1 5
3 4
1 5
 3
1 3
2 2
1 3
 5
4 4
1 4
3 4
1 3
3 5
 3
1 3
1 2
2 3
 4
2 4
1 3
2 3
1 2
 5
4 5
4 5
1 3
1 2
2 4
 6
2 6
4 6
6 6
2 2
3 3
1 3
 3
2 3
1 2
1 3
 6
4 6
1 3
4 6
4 4
1 4
1 2
 7
3 6
6 6
5 7
2 4
2 3
1 2
3 5
 8
4 6
8 8
1 4
4 5
6 8
1 2
3 6
1 4
 6
2 4
2 6
4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5 1 2 3
 NO
4 5 6 2 3 1 
5 4 6 2 3 1 
 NO
2 1 3 
3 1 2 
 NO
5 2 6 4 3 1 
5 1 6 4 3 2 
 NO
5 6 7 3 2 1 4 
5 6 7 2 3 1 4  NO
5 8 2 4 7 1 6 3
5 8 1 4 7 2 6 3
 NO
2 5 4 3 6 1 
3 5 4 2 6 1  YES
4 7 3 6 8 5 1 2  NO
4 2 3 1
4 1 3 2
 YES
9 4 1 5 7 6 8 3 10 2  NO
3 4 2 1 
2 4 3 1  YES
1  NO
4 7 2 5 1 3 6 8 
5 7 2 4 1 3 6 8  YES
3 4 2 1 5  NO
1 2 3 4 
1 3 2 4 
 NO
3 4 2 1 
4 3 2 1 
 NO
1 2 
2 1 
 YES
3 4 2 1 6 7 5 8  YES
2 3 1 5 4  NO
1 3 4 2 5 6
1 2 4 3 5 6
 NO
1 5 6 3 2 4 
2 5 6 3 1 4 
 NO
4 2 5 1 3 
4 3 5 1 2  NO
1 2 3 
2 1 3 
 NO
1 2 3 4 
4 2 3 1 
 NO
4 1 2 3 5 
3 1 2 4 5 
 NO
2 3 4 1
2 1 4 3
 NO
1 4 5 2 3 6 
1 5 4 2 3 6 
 NO
2 4 5 1 3 
3 4 5 1 2 
 NO
2 1 3 5 4 
3 1 2 5 4  NO
14 13 18 3 7 11 12 2 10 4 8 17 15 9 20 16 6 19 1 5 
14 13 18 3 8 11 12 2 10 4 7 17 15 9 20 16 6 19 1 5 
 NO
1 2 3 4 5 
5 2 3 4 1 
 NO
6 2 1 3 5 4 7
6 1 2 3 5 4 7

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];
	}
}
