import bisect def main(): import sys input = sys.stdin.read data = input().split() N = int(data[0]) P = list(map(int, data[1:N+1])) A = P.copy() current_S = [] operations = [] for i in range(N, 0, -1): found = False max_y = min(i, len(A)) # First, check for odd y in descending order for y in range(max_y, 0, -1): if y % 2 == 1: if y-1 >= len(A): continue x = A[y-1] idx = bisect.bisect_left(current_S, x) if idx == 0 or (idx == 1 and len(current_S) >= 1): A.pop(y-1) bisect.insort(current_S, x) operations.append((x, y)) found = True break if not found: # Check all y in descending order for y in range(max_y, 0, -1): if y-1 >= len(A): continue x = A[y-1] idx = bisect.bisect_left(current_S, x) if idx == 0 or (idx == 1 and len(current_S) >= 1): A.pop(y-1) bisect.insort(current_S, x) operations.append((x, y)) found = True break if not found: print("No") return # Reverse the operations to get the correct order operations = operations[::-1] print("Yes") for x, y in operations: print(x, y) if __name__ == "__main__": main()