There are $n$ districts in the town, the $i$-th district belongs to the $a_i$-th bandit gang. Initially, no districts are connected to each other.

You are the mayor of the city and want to build $n-1$ two-way roads to connect all districts (two districts can be connected directly or through other connected districts).

If two districts belonging to the same gang are connected directly with a road, this gang will revolt.

You don't want this so your task is to build $n-1$ two-way roads in such a way that all districts are reachable from each other (possibly, using intermediate districts) and each pair of directly connected districts belong to different gangs, or determine that it is impossible to build $n-1$ roads to satisfy all the conditions.

You have to answer $t$ independent test cases.


-----Input-----

The first line of the input contains one integer $t$ ($1 \le t \le 500$) — the number of test cases. Then $t$ test cases follow.

The first line of the test case contains one integer $n$ ($2 \le n \le 5000$) — the number of districts. The second line of the test case contains $n$ integers $a_1, a_2, \ldots, a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is the gang the $i$-th district belongs to.

It is guaranteed that the sum of $n$ does not exceed $5000$ ($\sum n \le 5000$).


-----Output-----

For each test case, print:

  NO on the only line if it is impossible to connect all districts satisfying the conditions from the problem statement.  YES on the first line and $n-1$ roads on the next $n-1$ lines. Each road should be presented as a pair of integers $x_i$ and $y_i$ ($1 \le x_i, y_i \le n; x_i \ne y_i$), where $x_i$ and $y_i$ are two districts the $i$-th road connects. 

For each road $i$, the condition $a[x_i] \ne a[y_i]$ should be satisfied. Also, all districts should be reachable from each other (possibly, using intermediate districts).


-----Example-----
Input
4
5
1 2 2 1 3
3
1 1 1
4
1 1000 101 1000
4
1 2 3 4

Output
YES
1 3
3 5
5 4
1 2
NO
YES
1 2
2 3
3 4
YES
1 2
1 3
1 4

Source: codeforces | Difficulty: EASY
Tags: Graph traversal

Constructive algorithms


Solutions:
t = int(input())
for z in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	if len(set(arr)) == 1:
		print('NO')
	else:
		print('YES')
		rep = []
		for i in range(1, n):
			if arr[0] == arr[i]:
				rep.append(i)
			else:
				print('1', i + 1)
				k = i
		for num in rep:
			print(k + 1, num + 1)


def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		a = list(map(int, input().split()))
		capital = a[0]
		non_capital_idx = -1
		for i in range(1, n):
			if a[i] != capital:
				non_capital_idx = i
				break
		if non_capital_idx == -1:
			print('NO')
			continue
		print('YES')
		for j in range(1, n):
			if j == non_capital_idx:
				print(1, non_capital_idx + 1)
			elif a[j] == capital:
				print(non_capital_idx + 1, j + 1)
			else:
				print(1, j + 1)
main()


t = int(input())
for _ in range(t):
	n = int(input())
	A = list(map(int, input().split(' ')))
	x = A[0]
	y = -1
	for i in range(1, n):
		if A[i] != A[0]:
			y = i
	if y == -1:
		print('NO')
	else:
		print('YES')
		for i in range(1, n):
			if A[i] == x:
				print(i + 1, y + 1)
			else:
				print(i + 1, 1)


T = int(input())
for t in range(T):
	n = int(input())
	A = [int(i) for i in input().split()]
	primary = A[0]
	pidx = 0
	secondary = -1
	sidx = -1
	ct = 0
	for i in A:
		if i != primary:
			secondary = i
			sidx = ct
			break
		ct += 1
	pos = 1
	ans = []
	for i in range(1, n):
		if A[i] != primary:
			ans.append([1, i + 1])
		elif secondary != -1 and A[i] != secondary:
			ans.append([sidx + 1, i + 1])
		else:
			pos = 0
	if pos == 0:
		print('NO')
	else:
		print('YES')
		for i in ans:
			print(*i)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	k = a[0]
	flag = 0
	for i in range(n):
		if a[i] != k:
			flag = 1
			break
	if flag == 0:
		print('NO')
		continue
	print('YES')
	dic = {}
	for i in range(n):
		if a[i] in dic:
			dic[a[i]].append(i + 1)
		else:
			dic[a[i]] = [i + 1]
	listofgangs = []
	for i in dic:
		listofgangs.append(i)
	for i in range(len(listofgangs) - 1):
		l = dic[listofgangs[i + 1]][0]
		for j in dic[listofgangs[i]]:
			print(j, l)
	l = dic[listofgangs[0]][0]
	for j in range(1, len(dic[listofgangs[-1]])):
		print(dic[listofgangs[-1]][j], l)


from math import *
import sys
from sys import stdin
from sys import stdout
input = stdin.readline
for __ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	if max(a) == min(a):
		print('NO')
	else:
		print('YES')
		ans = 0
		node = -1
		for i in range(n):
			if a[i] != a[0]:
				node = i + 1
				print(1, i + 1)
				ans += 1
		for i in range(1, n):
			if a[i] == a[0]:
				print(node, i + 1)


import sys, collections
tc = int(sys.stdin.readline())
for _ in range(tc):
	n = int(sys.stdin.readline())
	arr = list(map(int, sys.stdin.readline().split()))
	gang = dict().fromkeys(set(arr))
	for i in gang:
		gang[i] = []
	for (idx, i) in enumerate(arr):
		gang[i].append(idx + 1)
	if len(gang.keys()) < 2:
		print('NO')
	else:
		res = sorted(gang.items())
		res.sort(key=lambda x: len(x[1]))
		adj = []
		for i in range(1, len(res)):
			for j in res[i][1]:
				adj.append([res[0][1][0], j])
		for i in range(1, len(res[0][1])):
			adj.append([res[0][1][i], res[-1][1][0]])
		print('YES')
		for i in adj:
			print(i[0], i[1])


t = int(input())
for _ in range(0, t):
	n = int(input())
	a = [int(i) for i in input().split()]
	if len(set(a)) == 1:
		print('NO')
	else:
		print('YES')
		source = a[0]
		edges = []
		for i in range(1, n):
			if a[i] != source:
				edges.append([1, i + 1])
		if a.count(source) > 1:
			newsource = -1
			ind = -1
			for i in range(1, n):
				if a[i] != source:
					newsource = a[i]
					ind = i + 1
					break
			for i in range(1, n):
				if a[i] == source:
					edges.append([ind, i + 1])
		for i in edges:
			print(*i)


for i in range(int(input())):
	n = int(input())
	lis = [int(x) for x in input().split()]
	flag = 0
	visited = [0] * n
	l = []
	for i in range(n):
		if lis[i] != lis[0]:
			flag = 1
			visited[i] = +1
			visited[0] = 1
			l.append([1, i + 1])
	remaning = []
	if flag == 0:
		print('NO')
		continue
	flag = 0
	for i in range(len(visited)):
		if visited[i] == 0:
			remaning.append(i)
			flag = 1
	ll = []
	if flag == 1:
		pos = 0
		x = len(remaning)
		curr = 0
		flag = 0
		while pos < x:
			if curr >= len(lis):
				curr = 0
			if lis[remaning[pos]] != lis[curr]:
				ll.append([curr + 1, remaning[pos] + 1])
				pos += 1
				curr = 0
			else:
				curr += 1
	print('YES')
	for i in l:
		print(*i)
	for i in ll:
		print(*i)


import sys
T = int(sys.stdin.readline())
for _ in range(T):
	n = int(sys.stdin.readline())
	list_num = list(map(int, sys.stdin.readline().split()))
	index = {}
	list_one = []
	count = 0
	for (i, num) in enumerate(list_num):
		if not num in index:
			index[num] = count
			list_one.append(i)
			count += 1
	if count == 1:
		print('NO')
	else:
		print('YES')
		for i in range(1, n):
			if index[list_num[i]] == 0:
				print(i + 1, list_one[1] + 1)
			else:
				print(i + 1, list_one[0] + 1)


t = int(input())
for q in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	mg = max(a)
	fg = min(a)
	ma = -1
	fa = -1
	if mg == fg:
		print('NO')
	else:
		for l in range(n):
			if a[l] == mg:
				ma = l + 1
			if a[l] == fg:
				fa = l + 1
			if fa >= 0 and ma >= 0:
				break
		print('YES')
		for i in range(n):
			if a[i] != fg:
				print(fa, i + 1)
			elif i + 1 != fa:
				print(ma, i + 1)


t = int(input())
for i in range(t):
	n = int(input())
	a = [int(i) for i in input().split()]
	if len(set(a)) == 1:
		print('NO')
	else:
		print('YES')
		c1 = a[0]
		c2 = -1
		for i in range(1, n):
			if a[i] != c1:
				print(1, i + 1)
				c2 = i + 1
		for i in range(1, n):
			if a[i] == c1:
				print(c2, i + 1)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	c = 0
	b = []
	if a.count(a[0]) == n:
		print('NO')
	else:
		print('YES')
		for i in range(n):
			if a[i] == a[0]:
				b.append(i + 1)
			else:
				c = i + 1
				print(i + 1, 1)
		for i in b[1:]:
			print(c, i)


from math import *
from bisect import *
from collections import *
from random import *
from decimal import *
from itertools import *
import sys
input = sys.stdin.readline

def inp():
	return int(input())

def st():
	return input().rstrip('\n')

def lis():
	return list(map(int, input().split()))

def ma():
	return map(int, input().split())
t = inp()
while t:
	t -= 1
	n = inp()
	a = lis()
	b = []
	for i in range(n):
		b.append([a[i], i])
	b.sort()
	if b[-1][0] == b[0][0]:
		print('NO')
		continue
	else:
		print('YES')
		print(b[0][1] + 1, b[-1][1] + 1)
		for i in range(1, n - 1):
			if b[i][0] != b[-1][0]:
				print(b[i][1] + 1, b[-1][1] + 1)
			else:
				print(b[0][1] + 1, b[i][1] + 1)


import sys
import math
import itertools
import functools
import collections
import operator
import fileinput
import copy
from collections import *
ORDA = 97

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return [int(i) for i in input().split()]

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def revn(n):
	return str(n)[::-1]

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=2):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base):
	new_number = 0
	while number > 0:
		new_number += number % base
		number //= base
	return new_number

def cdiv(n, k):
	return n // k + (n % k != 0)

def ispal(s):
	for i in range(len(s) // 2 + 1):
		if s[i] != s[-i - 1]:
			return False
	return True

def function(arr, size, dp):
	if size == 1 or size == 0:
		return 1
	key = ''.join(map(str, arr[:size]))
	if dp[key]:
		return dp[key]
	output = function(arr, size - 1, dp)
	key = ''.join(map(str, arr[:size - 1]))
	dp[key] = output
	if arr[size - 2] * 10 + arr[size - 1] <= 26:
		output += function(arr, size - 2, dp)
		key = ''.join(map(str, arr[:size - 2]))
		dp[key] = output
	return output

def main():
	for _ in range(ii()):
		n = ii()
		arr = li()
		for i in range(1, n, 1):
			if arr[0] != arr[i]:
				b = i
				break
		else:
			print('NO')
			continue
		print('YES')
		for i in range(1, n, 1):
			if arr[0] != arr[i]:
				print(1, i + 1)
			else:
				print(b + 1, i + 1)
main()


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	b = []
	if max(a) != min(a):
		print('YES')
		c = 0
		t = 1
		while a[c] == a[t]:
			t += 1
			b.append(t)
		for j in range(len(b)):
			print(t + 1, b[j])
		while t != n:
			if a[c] != a[t]:
				print(c + 1, t + 1)
				t += 1
			else:
				c = t - 1
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	fNum = a[0]
	pos = 1
	SAMEF = True
	for i in range(n):
		if fNum != a[i]:
			SAMEF = False
	if SAMEF:
		print('NO')
	else:
		print('YES')
		for i in range(n):
			if a[i] != fNum:
				print(pos, i + 1)
		for i in range(1, n):
			if fNum != a[i]:
				pos = i + 1
				break
		for i in range(1, n):
			if a[i] == fNum and pos != i + 1:
				print(pos, i + 1)


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(enumerate(map(int, input().split()), 1))
	if all([arr[m][1] == arr[m - 1][1] for m in range(n)]):
		print('NO')
	else:
		seen = [False] * n
		answer = []
		f = arr[0][1]
		for i in range(1, n):
			if f != arr[i][1]:
				seen[arr[i][0] - 1] = True
				answer.append((arr[0][0], arr[i][0]))
		if not all(seen):
			for i in range(n):
				if not seen[i]:
					for j in range(n):
						if arr[i][1] != arr[j][1]:
							answer.append((arr[i][0], arr[j][0]))
							break
		print('YES')
		answer = set(answer)
		for l in answer:
			print(*l)


def read_int() -> int:
	return int(input())

def read_ints():
	return map(int, input().split(' '))

def test_case():
	n = read_int()
	a = list(read_ints())
	connections = []
	not_connected = []
	first = a[0]
	iterator = iter(a)
	next(iterator)
	for (index, elem) in enumerate(iterator, 2):
		(connections if elem != first else not_connected).append(index)
	if not_connected and (not connections):
		print('NO')
	else:
		print('YES')
		for conn in connections:
			print(1, conn)
		for other in not_connected:
			print(connections[0], other)
for _ in range(read_int()):
	test_case()


for _ in range(int(input())):
	am = int(input())
	arr = list(map(int, input().split()))
	if len(set(arr)) == 1:
		print('NO')
		continue
	print('YES')
	f = (0, arr[0])
	s = (0, 0)
	for i in range(am):
		if arr[i] != f[1]:
			s = (i, arr[i])
	print(f[0] + 1, s[0] + 1)
	for i in range(am):
		if i != f[0] and i != s[0]:
			if arr[i] == f[1]:
				print(i + 1, s[0] + 1)
			else:
				print(i + 1, f[0] + 1)


cases = int(input())
for _ in range(cases):
	n = int(input())
	ds = list(map(int, input().split()))
	ds_index = [(v, i) for (i, v) in enumerate(ds)]
	ds_index.sort()
	if ds_index[-1][0] == ds_index[0][0]:
		print('NO')
	else:
		print('YES')
		j = 0
		while j < n and ds_index[j][0] == ds_index[0][0]:
			j += 1
		for i in range(j):
			print(ds_index[i][1] + 1, ds_index[j][1] + 1)
		for i in range(j + 1, n):
			print(ds_index[0][1] + 1, ds_index[i][1] + 1)


t = int(input())

def couvrir(gang, n):
	if gang == [gang[0]] * n:
		print('NO')
		return
	print('YES')
	dico = {}
	mi = 10 ** 5
	keym = -1
	for x in gang:
		if x in dico:
			dico[x] += 1
		else:
			dico[x] = 1
	for key in dico:
		if dico[key] < mi:
			mi = dico[key]
			keym = key
	reste = n - mi
	posm = []
	for i in range(n):
		if gang[i] == keym:
			posm.append(i)
	g0 = 0
	for i in range(n):
		if gang[i] != keym:
			if reste == mi - 1 - g0:
				reste -= 1
				print(posm[g0] + 1, i + 1)
				g0 += 1
				print(posm[g0] + 1, i + 1)
			else:
				reste -= 1
				print(posm[g0] + 1, i + 1)
	return
for i in range(t):
	n = int(input())
	gang = list(map(int, input().split()))
	couvrir(gang, n)


t = int(input())
for case in range(t):
	n = int(input())
	a = [int(x) for x in input().split(' ')]
	if min(a) == max(a):
		ans = 'NO'
		print(ans)
	else:
		print('YES')
		c = a[0]
		for i in range(n):
			if a[i] != c:
				j = i
				break
		for i in range(1, n):
			if a[i] == c:
				print(i + 1, j + 1)
			else:
				print(1, i + 1)


from collections import defaultdict
tests = int(input())
for t in range(tests):
	n = input()
	ls = list(map(int, input().split()))
	gang_dict = defaultdict(list)
	for (idx, gang) in enumerate(ls):
		gang_dict[gang].append(idx + 1)
	if len(gang_dict) == 1:
		print('NO')
	else:
		print('YES')
		connect = None
		for key in gang_dict:
			if connect is None:
				con_town = gang_dict[key][0]
				connect = key
			else:
				towns = gang_dict[key]
				for town in towns:
					print(f'{con_town} {town}')
		if len(gang_dict[connect]) > 1:
			for conn in gang_dict[connect][1:]:
				print(f'{conn} {town}')


for t in range(int(input())):
	n = int(input())
	M = [int(i) for i in input().split()]
	if len(set(M)) == 1:
		print('NO')
	else:
		print('YES')
		l1 = -1
		for i in range(1, n):
			if M[i] != M[0]:
				print(1, i + 1)
				l1 = i + 1
		for i in range(1, n):
			if M[i] == M[0]:
				print(l1, i + 1)


t = eval(input())
for i in range(t):
	n = eval(input())
	l = input().split()
	l2 = [i + 1 for i in range(len(l))]
	g_d = dict(zip(l, l2))
	d_g = dict(zip(l2, l))
	choose = dict()
	memory = set()
	flag = 0
	for hb in l:
		choose[hb] = -1
		for key in g_d:
			if key != hb:
				choose[hb] = g_d[key]
				break
		if choose[hb] == -1:
			flag = 1
			break
	if flag == 1:
		print('NO')
	else:
		print('YES')
		memory.add(1)
		while len(memory) < n:
			copy = memory.copy()
			for num in copy:
				for link in range(1, 1 + n):
					if link not in memory:
						if d_g[link] != d_g[num]:
							print(num, link)
							memory.add(link)
					if len(memory) >= n:
						break
				if len(memory) >= n:
					break


t = int(input())
for u in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	vastused = []
	final = [True] * n
	connected = [False] * n
	connectedCount = 0
	for i in range(n):
		for j in range(i + 1, n):
			if not (connected[j] == True and connected[i] == True):
				if a[i] != a[j]:
					vastused.append((i + 1, j + 1))
					connected[j] = True
					connected[i] = True
	if vastused == []:
		print('NO')
	else:
		print('YES')
		for e in range(n - 1):
			print(str(vastused[e][0]) + ' ' + str(vastused[e][1]))


for t in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	d = {}
	for i in a:
		if i in d:
			d[i] += 1
		else:
			d[i] = 1
	z = len(d)
	if z == 1:
		print('NO')
	else:
		print('YES')
		abc = []
		for i in d:
			abc.append(i)
		z = a.index(abc[0])
		p = a.index(abc[1])
		for i in range(n - 1):
			if a[z] != a[i + 1]:
				print(z + 1, i + 2)
			else:
				print(p + 1, i + 2)


from collections import defaultdict
for i1 in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	dict = defaultdict(int)
	for i in l:
		dict[i] += 1
	if len(dict) == 1:
		print('NO')
		continue
	print('YES')
	condition = min(dict.values())
	vertex = list(dict.keys())[list(dict.values()).index(condition)]
	pos = l.index(vertex) + 1
	c = 0
	ver = []
	for i in range(1, n + 1):
		if i != pos and l[i - 1] != vertex:
			print(i, pos)
			temp = i
			c += 1
		elif i != pos:
			ver.append(i)
	remaining = n - 1 - c
	for i in range(remaining):
		print(temp, ver[i])


for t in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	if len(set(a)) == 1:
		print('NO')
		continue
	print('YES')
	d = {}
	for i in a:
		if i in d:
			d[i] += 1
		else:
			d[i] = 1
	mc = min(d.values())
	for i in d:
		if d[i] == mc:
			mv = i
			break
	mins = []
	others = []
	for i in range(n):
		if a[i] == mv:
			mins.append(i + 1)
		else:
			others.append(i + 1)
	for i in others:
		print(mins[0], i)
	if mc > 1:
		for i in range(1, mc):
			print(mins[i], others[i])


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	if len(set(a)) == 1:
		print('NO')
	else:
		print('YES')
		p = a[0]
		a1 = []
		for i in range(1, n):
			if p != a[i]:
				print(1, i + 1)
			else:
				a1.append(i)
		for i in a1:
			q = a[i]
			for j in range(n):
				if a[j] != q:
					print(i + 1, j + 1)
					break


for _ in range(int(input())):
	sdf = input()
	l = [int(i) / 9999999 for i in input().split()]
	if len(set(l)) == 1:
		print('NO')
	else:
		d = []
		rem = []
		chk = [0] * len(l)
		for i in range(1, len(l)):
			if l[0] != l[i]:
				chk[i] = 1
				chk[0] = 1
				d.append([1, i + 1])
			else:
				rem.append(i)
		if chk[0] == 0:
			rem.append(0)
		f = 0
		for t in rem:
			for k in range(len(l)):
				if l[k] != l[t]:
					chk[t] = 1
					d.append([k + 1, t + 1])
					f = 2
					break
			if f == 2:
				break
		try:
			rem.pop(0)
			for t in rem:
				d.append([k + 1, t + 1])
		except:
			print('')
		if d != []:
			print('YES')
			for k in d:
				print(*k)
		else:
			print('NO')


from sys import stdin, stdout
t = int(stdin.readline())
for i in range(t):
	n = int(stdin.readline())
	arr = list(map(int, stdin.readline().split()))
	conn = []
	counter = 0
	color = [[arr[0], 1]]
	tst = arr[0]
	for j in range(1, len(arr)):
		if tst == arr[j]:
			continue
		else:
			counter = 1
			color.append([arr[j], j + 1])
			break
	if counter == 0:
		print('NO')
	else:
		print('YES')
		print('{} {}'.format(color[0][1], color[1][1]))
		for k in range(1, len(arr)):
			if k + 1 == color[1][1]:
				continue
			elif color[0][0] == arr[k]:
				print('{} {}'.format(color[1][1], k + 1))
			else:
				print('{} {}'.format(color[0][1], k + 1))


for _ in range(int(input())):
	input()
	sp = {}
	for (i, v) in enumerate(map(int, input().split()), 1):
		sp.setdefault(v, []).append(i)
	if len(sp) == 1:
		print('NO')
		continue
	sp = sorted(sp.values(), key=lambda x: len(x))
	print('YES')
	temp = len(sp[0]) - 1
	for v in sp[1:]:
		for v1 in v:
			print(sp[0][0], v1)
			if temp > 0:
				print(sp[0][temp], v1)
				temp -= 1


from collections import defaultdict

def solve(query):
	arr = [int(i) for i in query.split(' ')]
	val_to_idx = defaultdict(list)
	for (i, e) in enumerate(arr):
		val_to_idx[e].append(i + 1)
	if len(val_to_idx.keys()) == 1:
		print('NO')
		return
	print('YES')
	previous_vals = []
	for val in val_to_idx.values():
		if previous_vals:
			for node in previous_vals:
				print(node, val[0])
		previous_vals = val
	if len(previous_vals) > 1:
		for val in val_to_idx.values():
			for node in previous_vals[1:]:
				print(node, val[0])
			break
t = int(input())
for _ in range(t):
	input()
	query = input().strip()
	solve(query)


for i in range(int(input())):
	n = int(input())
	d = {}
	l = list(map(int, input().split()))
	l1 = []
	x = l[0]
	x2 = -1
	flg = 1
	for j in range(1, n):
		if l[j] == x:
			l1.append(j + 1)
		else:
			if flg:
				print('YES')
				flg = 0
				x2 = j + 1
			print(1, j + 1)
	if flg:
		print('NO')
	else:
		for k in l1:
			print(x2, k)


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def ii():
	return int(input())

def fi():
	return float(input())

def si():
	return input()

def msi():
	return map(str, input().split())

def mi():
	return map(int, input().split())

def li():
	return list(mi())

def read():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def lcm(x, y):
	return x * y // gcd(x, y)
mod = 1000000007

def modInverse(b, m):
	g = gcd(b, m)
	if g != 1:
		return -1
	else:
		return pow(b, m - 2, m)

def ceil(x, y):
	if x % y == 0:
		return x // y
	else:
		return x // y + 1

def modu(a, b, m):
	a = a % m
	inv = modInverse(b, m)
	if inv == -1:
		return -999999999
	else:
		return inv * a % m
from math import log, sqrt, factorial, cos, tan, sin, radians, floor
import bisect
from decimal import *
getcontext().prec = 8
abc = 'abcdefghijklmnopqrstuvwxyz'
pi = 3.141592653589793

def fun(a, n):
	s = 0
	if n == 1:
		return s
	for i in range(n):
		b = []
		b.extend(a[0:i])
		c = a[i + 1:]
		b.extend(c)
		s += fun(b, n - 1)

def isP(n):
	c = 0
	for i in range(2, int(sqrt(n)) + 1):
		if n % i == 0:
			c += 1
	if c:
		return False
	return True
pr = []
for i in range(101, 1050):
	if isP(i):
		pr.append(i)

def main():
	for _ in range(ii()):
		n = ii()
		a = li()
		if len(set(a)) == 1:
			print('NO')
			continue
		x = a[0]
		print('YES')
		l = []
		c = -1
		for i in range(1, n):
			if a[i] != x:
				print(1, i + 1)
				c = i + 1
			else:
				l.append(i + 1)
		for i in range(len(l)):
			print(c, l[i])
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


for _ in range(int(input())):
	input()
	a = [int(i) for i in input().split()]
	if len(set(a)) == 1:
		print('NO')
		continue
	else:
		print('YES')
	cur = 0
	nex = 0
	for i in range(len(a)):
		if cur != i and a[i] != a[cur]:
			print(cur + 1, i + 1)
			nex = i
	for i in range(len(a)):
		if a[i] == a[cur] and i != 0:
			print(i + 1, nex + 1)


for _ in range(int(input())):
	n = int(input())
	gang = list(map(int, input().split()))
	edges = []
	g = gang[0]
	other = -1
	same = []
	for i in range(1, n):
		if g != gang[i]:
			edges.append((1, i + 1))
			other = i + 1
		else:
			same.append(i + 1)
	if other == -1:
		print('NO')
		continue
	print('YES')
	for i in same:
		print(other, i)
	for (x, y) in edges:
		print(x, y)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	ans = []
	for i in range(1, n):
		for j in range(n):
			if arr[i] != arr[j]:
				ans.append([i + 1, j + 1])
				break
	if len(set(arr)) == 1:
		print('NO')
	else:
		print('YES')
		for i in ans:
			print(i[0], i[1])


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	head = 0
	tail = -1
	for e in enumerate(a):
		if e[1] != a[head]:
			tail = e[0]
			break
	if tail == -1:
		print('NO')
		continue
	print('YES')
	print(head + 1, tail + 1)
	for e in enumerate(a):
		if e[0] != head and e[0] != tail:
			if e[1] == a[head]:
				print(e[0] + 1, tail + 1)
			else:
				print(e[0] + 1, head + 1)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	flag = 1
	gangs = set()
	for i in range(n):
		gangs.add(arr[i])
	if len(gangs) == 1:
		print('NO')
		continue
	print('YES')
	a = arr[0]
	for i in range(n):
		if arr[i] != a:
			b = arr[i]
			index = i
			break
	for i in range(1, n):
		if arr[i] == a:
			print(index + 1, i + 1)
		else:
			print(1, i + 1)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	res = []
	idx = -1
	for i in range(1, n):
		if arr[i] != arr[0]:
			idx = i
			res.append((1, i + 1))
	if idx == -1:
		print('NO')
		continue
	for i in range(1, n):
		if arr[i] == arr[0]:
			res.append((i + 1, idx + 1))
	print('YES')
	for _ in res:
		print(*_)


import os
import sys
import math
from io import BytesIO, IOBase
from fractions import Fraction
import collections
from itertools import permutations
from collections import defaultdict
from collections import deque
import threading
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

class Factorial:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorials = [1, 1]
		self.invModulos = [0, 1]
		self.invFactorial_ = [1, 1]

	def calc(self, n):
		if n <= -1:
			print('Invalid argument to calculate n!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.factorials):
			return self.factorials[n]
		nextArr = [0] * (n + 1 - len(self.factorials))
		initialI = len(self.factorials)
		prev = self.factorials[-1]
		m = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * i % m
		self.factorials += nextArr
		return self.factorials[n]

	def inv(self, n):
		if n <= -1:
			print('Invalid argument to calculate n^(-1)')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		p = self.MOD
		pi = n % p
		if pi < len(self.invModulos):
			return self.invModulos[pi]
		nextArr = [0] * (n + 1 - len(self.invModulos))
		initialI = len(self.invModulos)
		for i in range(initialI, min(p, n + 1)):
			next = -self.invModulos[p % i] * (p // i) % p
			self.invModulos.append(next)
		return self.invModulos[pi]

	def invFactorial(self, n):
		if n <= -1:
			print('Invalid argument to calculate (n^(-1))!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.invFactorial_):
			return self.invFactorial_[n]
		self.inv(n)
		nextArr = [0] * (n + 1 - len(self.invFactorial_))
		initialI = len(self.invFactorial_)
		prev = self.invFactorial_[-1]
		p = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * self.invModulos[i % p] % p
		self.invFactorial_ += nextArr
		return self.invFactorial_[n]

class Combination:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorial = Factorial(MOD)

	def ncr(self, n, k):
		if k < 0 or n < k:
			return 0
		k = min(k, n - k)
		f = self.factorial
		return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	if a.count(a[0]) == n:
		print('NO')
	else:
		print('YES')
		ind = 0
		res = []
		for i in range(1, n):
			if a[i] != a[0]:
				res.append((1, i + 1))
				ind = i + 1
		for i in range(1, n):
			if a[i] == a[0]:
				res.append((ind, i + 1))
		for i in res:
			print(*i)


import math
t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	d = {}
	for j in range(n):
		d[l[j]] = j + 1
	ans = set()
	for j in range(n):
		k = l[j]
		a = False
		for i in d:
			if i != l[j]:
				if j + 1 > d[i]:
					ans.add((j + 1, d[i]))
				else:
					ans.add((d[i], j + 1))
				a = True
				break
		if not a:
			break
	if len(ans) == 0:
		print('NO')
	else:
		print('YES')
		for i in ans:
			print(*i)


t = int(input())
for ii in range(t):
	n = int(input())
	a = [int(i) for i in input().split()]
	for i in range(n):
		if a[i] != a[0]:
			break
		if i == n - 1:
			print('NO')
			break
	if i == n - 1 and a[n - 1] == a[0]:
		continue
	cd = -1
	print('YES')
	for i in range(n):
		if a[0] != a[i]:
			print(1, i + 1)
			a[i] = -1
			if cd == -1:
				cd = i + 1
	a[0] = -1
	for i in range(n):
		if a[i] != -1:
			print(cd, i + 1)


for _ in range(int(input())):
	input()
	dis = list(map(int, input().split()))
	if len(set(dis)) == 1:
		print('NO')
	else:
		print('YES')
		n = 0
		i = 0
		while dis[n] == dis[i]:
			n += 1
		while i < len(dis):
			if i == n:
				i += 1
			if i >= len(dis):
				break
			if dis[n] != dis[i]:
				print(n + 1, i + 1)
				i += 1
			else:
				n = 0
				while dis[n] == dis[i]:
					n += 1


t = int(input())
for tc in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	diff = -1
	for i in range(n):
		if arr[i] != arr[0]:
			diff = i
			break
	if diff == -1:
		print('NO')
	else:
		print('YES')
		for i in range(n):
			if arr[i] != arr[0]:
				print('1', i + 1)
		for i in range(n):
			if i != 0 and arr[i] == arr[0]:
				print(diff + 1, i + 1)


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	d = {}
	for j in range(n):
		if l[j] not in d:
			d[l[j]] = 0
		d[l[j]] += 1
	m = 50000
	x = 0
	for j in d:
		if d[j] < m:
			m = d[j]
			x = j
	a = l.index(x) + 1
	if m == n:
		print('NO')
	else:
		print('YES')
		s = []
		asi = []
		for j in range(n):
			if l[j] != x:
				print(j + 1, a)
				s.append(j + 1)
			elif j != a - 1:
				asi.append(j + 1)
		for j in range(len(asi)):
			print(asi[j], s[j])


import sys
from collections import Counter

def rl():
	return sys.stdin.readline().strip()

def pr(something):
	sys.stdout.write(str(something) + '\n')

def pra(array):
	sys.stdout.write(' '.join([str(x) for x in array]) + '\n')

def solve(cities):
	freqs = Counter(cities)
	if len(freqs) == 1:
		return None
	else:
		freqs = [(freqs[f], f) for f in freqs]
		min_ind = freqs[0][1]
		sec_ind = freqs[1][1]
		edge_list = []
		first_min = -1
		first_sec = -1
		for (i, c) in enumerate(cities):
			if c == min_ind and first_min < 0:
				first_min = i
			elif c == sec_ind and first_sec < 0:
				first_sec = i
		for (i, c) in enumerate(cities):
			if i == first_min:
				continue
			if c == min_ind:
				edge_list.append([min(first_sec, i), max(first_sec, i)])
			else:
				edge_list.append([min(first_min, i), max(first_min, i)])
	return edge_list
NT = int(rl())
for ti in range(NT):
	_ = rl()
	array = [int(x) for x in rl().split(' ')]
	res = solve(array)
	if res == None:
		pr('NO')
	else:
		pr('YES')
		for (a, b) in res:
			print(a + 1, b + 1)


for __ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	(h, index) = ({}, {})
	remaining = []
	for i in range(n):
		if a[i] in h:
			remaining.append([a[i], i])
		else:
			h[a[i]] = []
			index[a[i]] = i
	answer = True
	for x in remaining:
		assigned = False
		for y in h.keys():
			if y != x[0]:
				h[y].append(x[1])
				assigned = True
				break
		if not assigned:
			answer = False
			break
	if answer:
		print('YES')
		count = 0
		unique = list(h.keys())
		for i in range(len(unique) - 1):
			count += 1
			print(f'{index[unique[i]] + 1} {index[unique[i + 1]] + 1}')
		for x in h.keys():
			for y in h[x]:
				print(f'{index[x] + 1} {y + 1}')
	else:
		print('NO')


import os
import sys
from io import BytesIO, IOBase
import math
from itertools import permutations
from decimal import *
getcontext().prec = 25
MOD = pow(10, 9) + 7
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split(' ')))
	d = {}
	for i in range(n):
		if not d.get(l[i], 0):
			d[l[i]] = i + 1
	x = list(d.keys())
	if len(x) == 1:
		print('NO')
	else:
		print('YES')
		test = d[x[0]]
		test2 = d[x[1]]
		for i in range(1, n):
			if l[i] == x[0]:
				print(i + 1, test2)
			elif l[i] == x[1]:
				print(i + 1, test)
			else:
				print(i + 1, test)


t = int(input())
ll = []
for _ in range(t):
	_ = input()
	ss = input().split()
	ll.append([int(s) for s in ss])
for l in ll:
	first_ind = 0
	first = l[first_ind]
	isEqual = True
	for i in range(len(l)):
		if l[i] != first:
			second_ind = i
			second = l[i]
			isEqual = False
			break
	print('NO' if isEqual else 'YES')
	if not isEqual:
		print(str(first_ind + 1) + ' ' + str(second_ind + 1))
		for i in range(1, len(l)):
			if i != second_ind:
				if l[i] != first:
					print(str(first_ind + 1) + ' ' + str(i + 1))
				else:
					print(str(second_ind + 1) + ' ' + str(i + 1))


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	f = 0
	start = l[0]
	for i in range(1, n):
		if l[i] != start:
			f = 1
			break
	if f == 0:
		print('NO')
	else:
		print('YES')
		cur = []
		diff = -1
		for i in range(1, n):
			if l[i] != start:
				print(1, i + 1)
				diff = i
			else:
				cur.append(i)
		for i in range(len(cur)):
			print(cur[i] + 1, diff + 1)


from collections import Counter
t = int(input())
for _ in range(t):
	count = int(input()) - 1
	A = [int(a) for a in input().split()]
	availables = set(A)
	counter = Counter(A)
	if len(availables) == 1:
		print('NO')
	else:
		print('YES')
		(first, j) = (A[0], 0)
		(second, i) = (A[0], 0)
		while second == first:
			i += 1
			second = A[i]
		for (k, a) in enumerate(A):
			if a != first:
				print(j + 1, k + 1)
		occured = False
		for (k, a) in enumerate(A):
			if not occured and a == first:
				occured = True
			elif occured and a == first:
				print(i + 1, k + 1)


from collections import defaultdict
t = int(input())
while t != 0:
	d = defaultdict(list)
	n = int(input())
	list1 = list(map(int, input().split()))
	for i in range(n):
		d[list1[i]].append(i)
	if len(set(list1)) == 1:
		print('NO')
	else:
		print('YES')
		ans = []
		k = -1
		for i in range(1, len(list1)):
			if list1[i] != list1[0]:
				k = i
				ans.append([1, i + 1])
		for i in range(1, len(list1)):
			if list1[i] == list1[0]:
				ans.append([i + 1, k + 1])
		for i in range(len(ans)):
			print(ans[i][0], ans[i][1])
	t -= 1


import sys, os.path
from collections import *
from heapq import *
from copy import *
import math
mod = 10 ** 9 + 7
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
edge = []
for t in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	if a.count(a[0]) == n:
		print('NO')
	else:
		cnt = 0
		flag = 0
		graph = defaultdict(list)
		vis = [0 for i in range(n)]
		graph[1] = []
		vis[0] = 1
		k = 0
		cnt = 0
		for i in range(1, n):
			if a[0] == a[i]:
				continue
			else:
				graph[i + 1] = []
				graph[1].append(i + 1)
				k = i + 1
				vis[i] = 1
				break
		for i in range(1, n):
			if a[0] == a[i] and vis[i] == 0:
				graph[k].append(i + 1)
			elif a[0] != a[i] and vis[i] == 0:
				graph[1].append(i + 1)
		print('YES')
		for i in graph:
			if graph[i]:
				for k in graph[i]:
					print(i, k)


import sys
from collections import defaultdict
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	lis = list(map(int, input().split()))
	if len(set(lis)) == 1:
		print('NO')
		continue
	print('YES')
	x = 1
	for i in range(n):
		if lis[i] != lis[0]:
			break
	y = i + 1
	res = []
	for i in range(1, n):
		if lis[i] != lis[0]:
			print(x, i + 1)
		else:
			print(y, i + 1)


import collections
t = int(input())
for q in range(0, t):
	n = int(input())
	a = [int(i) for i in input().split()]
	count = 0
	d = collections.Counter(a)
	if len(d) == 1:
		print('NO')
	else:
		ans = []
		visit = [0] * n
		for i in range(1, n):
			for j in range(0, n):
				if a[i] != a[j]:
					ans.append([i + 1, j + 1])
					break
		if len(ans) > 0:
			print('YES')
			for i in range(0, len(ans)):
				print(ans[i][0], ans[i][1])
		else:
			print('NO')


from collections import Counter
t = int(input())
for _ in range(t):
	n = int(input())
	inp = list(map(int, input().split()))
	c = Counter([])
	if max(inp) == min(inp):
		print('NO')
		continue
	for i in range(len(inp)):
		if c[inp[i]] == 0:
			c[inp[i]] = []
		c[inp[i]].append(i + 1)
	l = list(c.keys())
	z = l[0]
	a = c[l[0]][0]
	print('YES')
	for i in range(1, len(l)):
		for item in c[l[i]]:
			print(a, end=' ')
			print(item)
	a = c[l[1]][0]
	for item in c[l[0]][1:]:
		print(item, end=' ')
		print(a)


from collections import Counter
for case in range(int(input())):
	n = int(input())
	arr = [int(a) for a in input().split()]
	ans = []
	rem = []
	if len(set(arr)) == 1:
		print('NO')
	else:
		print('YES')
		root = arr[0]
		for i in range(1, n):
			if arr[i] != root:
				ans.append((1, i + 1))
				new = i + 1
			else:
				rem.append(i + 1)
		for i in rem:
			ans.append((new, i))
	for con in ans:
		print(*con)


from sys import stdin, stdout
t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	a = []
	a = [int(x) for x in stdin.readline().split()]
	dic = {}
	for i in range(0, n):
		dic[a[i]] = 0
	for i in range(0, n):
		dic[a[i]] += 1
	m = 1000000
	x = 0
	for (first, second) in dic.items():
		if second < m:
			m = second
			x = first
	if m == n:
		print('NO')
		continue
	print('YES')
	fi = -1
	si = -1
	for i in range(0, n):
		if a[i] == x:
			fi = i
		if a[i] != x:
			si = i
	print(fi + 1, si + 1, sep=' ')
	for i in range(0, n):
		if i == fi or i == si:
			continue
		if a[i] == x:
			print(i + 1, si + 1, sep=' ')
		else:
			print(i + 1, fi + 1, sep=' ')


q = int(input())
for _ in range(q):
	n = int(input())
	data = list(map(int, input().split()))
	x = data[0]
	ost = []
	norm = []
	for (i, y) in enumerate(data[1:]):
		if y == x:
			ost.append(i + 2)
		else:
			norm.append(i + 2)
	if len(norm) == 0:
		print('NO')
	else:
		print('YES')
		r = norm[0]
		for y in norm:
			print(1, y)
		for t in ost:
			print(t, r)


def ans(ar, n):
	print('YES')
	trfa = [False] * n
	trfa[0] = True
	for i in range(1, n):
		if ar[i] != ar[0]:
			trfa[i] = True
			print(1, i + 1)
	for i in range(1, n):
		if trfa[i] == False:
			k = 0
			while k < n:
				if trfa[k] == True and ar[k] != ar[i]:
					print(k + 1, i + 1)
					trfa[k] = True
					break
				k += 1
for _ in range(int(input())):
	n = int(input())
	ar = [int(i) for i in input().split()]
	if min(ar) == max(ar):
		print('NO')
	else:
		ans(ar, n)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	b = len(list(set(a)))
	if b == 1:
		print('NO')
		continue
	print('YES')
	x = a[0]
	p = []
	for i in range(1, n):
		if a[i] == x:
			p.append(i + 1)
		else:
			y = i + 1
			print(1, i + 1)
	for i in p:
		print(i, y)


t = int(input())
for _ in range(t):
	n = int(input())
	line = list(map(int, input().split()))
	tempset = list(set(line))
	if len(tempset) == 1:
		print('NO')
	else:
		check = [0] * n
		check[0] = 1
		box = []
		get = 0
		for i in range(n):
			if line[i] != line[get]:
				elseget = i
				box.append([get + 1, i + 1])
				check[i] = 1
		for i in range(n):
			if check[i] == 0:
				box.append([elseget + 1, i + 1])
				check[i] = 1
		print('YES')
		for i in box:
			print(i[0], i[1])


import math

def arrinp():
	ls = list(map(int, input().split()))
	return ls

def mult_inp():
	return map(int, input().split())

def main():
	n = int(input())
	ls = arrinp()
	chk = set(ls)
	flag = 0
	d = {}
	for i in range(n):
		if ls[i] in d:
			d[ls[i]].append(i + 1)
		else:
			d[ls[i]] = [i + 1]
	if len(chk) == 1:
		flag = 1
	if flag == 1:
		print('NO')
	else:
		print('YES')
		ans = []
		for it in d:
			ans.append(d[it])
		for i in range(1, len(ans)):
			for j in ans[i]:
				print(ans[0][0], j)
		baki = 1
		for i in range(1, len(ans[0])):
			print(ans[0][i], ans[1][0])
for _ in range(int(input())):
	main()


from collections import Counter, OrderedDict
from itertools import permutations as perm
from collections import deque
from sys import stdin
from bisect import *
from heapq import *
import math
g = lambda : stdin.readline().strip()
gl = lambda : g().split()
gil = lambda : [int(var) for var in gl()]
gfl = lambda : [float(var) for var in gl()]
gcl = lambda : list(g())
gbs = lambda : [int(var) for var in g()]
mod = int(1000000000.0) + 7
inf = float('inf')
(t,) = gil()
for _ in range(t):
	(n,) = gil()
	d = gil()
	if d.count(d[0]) == n:
		print('NO')
	else:
		print('YES')
		nodes = [(1, d[0])]
		left = set()
		for i in range(1, n):
			left.add((i + 1, d[i]))
		while left:
			rem = []
			for (ide, gang) in left:
				for (nide, ngang) in nodes:
					if gang != ngang:
						rem.append((ide, gang))
						nodes.append(rem[-1])
						print(nide, ide)
						break
			while rem:
				left.remove(rem.pop())


t = int(input())
for _ in range(t):
	n = int(input())
	li = list(map(int, input().split(' ')))
	if li.count(li[0]) == len(li):
		print('NO')
		continue
	print('YES')
	i = 1
	second = False
	while i < len(li):
		if li[0] == li[i]:
			pass
		else:
			second = i + 1
			print(1, i + 1)
		i += 1
	i = 1
	while i < len(li):
		if li[0] == li[i]:
			print(second, i + 1)
		i += 1


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	g = [0] * n
	c = 0
	for j in range(1, n):
		if a[j] != a[0]:
			g[j] = -1
			c = c + 1
			break
	if c == 0:
		print('NO')
	else:
		print('YES')
		print('1', j + 1)
		for k in range(1, n):
			if g[k] == 0:
				if a[k] != a[0]:
					print('1', k + 1)
				else:
					print(j + 1, k + 1)


def solve():
	n = int(input())
	lst = list(map(int, input().split()))
	if len(set(lst)) == 1:
		print('NO')
		return 0
	print('YES')
	p1 = [lst[0], 1]
	p2 = []
	for i in range(n):
		if lst[0] != lst[i]:
			p2 = [lst[i], i + 1]
			break
	for i in range(1, n):
		if lst[i] != lst[0]:
			print(i + 1, p1[1])
		else:
			print(i + 1, p2[1])
for i in range(int(input())):
	solve()


import sys
import math
from collections import Counter
try:
	for _ in range(int(input())):
		n = int(input())
		v = []
		arr = [int(i) for i in input().split()]
		mx = 0
		for i in range(n):
			mx = max(mx, arr[i])
			v.append((arr[i], i + 1))
		c = arr.count(mx)
		if c == n:
			print('NO')
		else:
			print('YES')
			j = 0
			v.sort()
			while v[j][0] == v[0][0]:
				j += 1
			for i in range(j, n):
				print('{} {}'.format(v[0][1], v[i][1]))
			for i in range(1, j):
				print('{} {}'.format(v[i][1], v[n - 1][1]))
except EOFError as e:
	print(e)


t = int(input())
for i in range(t):
	n = int(input())
	l = [int(i) for i in input().split()]
	if len(set(l)) == 1:
		print('NO')
	else:
		print('YES')
		p = [0, l[0]]
		for j in range(n):
			if l[j] != p[1]:
				q = [j, l[j]]
				break
		print(1, q[0] + 1)
		for j in range(1, n):
			if j == q[0]:
				continue
			if l[j] == p[1]:
				print(j + 1, q[0] + 1)
			else:
				print(j + 1, 1)


t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	if len(set(a)) == 1:
		print('NO')
		continue
	else:
		print('YES')
	center_gang = a.pop()
	for (i, gang) in enumerate(a):
		if gang != center_gang:
			district = i + 1
			break
	for (i, gang) in enumerate(a):
		if gang == center_gang:
			print(district, i + 1)
		else:
			print(n, i + 1)


t = int(input())

def dfs(districts, connected, index):
	if index > len(districts) - 1:
		return
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	districts = dict()
	prev = None
	diff = False
	for (index, gang) in enumerate(a):
		districts[index] = gang
		if prev is None:
			prev = gang
		if gang != prev:
			diff = True
	if not diff == 1:
		print('NO')
	else:
		pairs = []
		not_assigned = []
		root = districts[0]
		random = None
		for i in range(1, n):
			if root != districts[i]:
				pairs.append([1, i + 1])
				if random is None:
					random = i
			else:
				not_assigned.append(i)
		for i in not_assigned:
			pairs.append([random + 1, i + 1])
		print('YES')
		for i in pairs:
			print(i[0], end=' ')
			print(i[1])


def connection(A):
	n = len(A)
	gangs = {}
	for i in range(len(A)):
		gangs.setdefault(A[i], [])
		gangs[A[i]].append(i + 1)
	if len(gangs) == 1:
		print('NO')
	else:
		print('YES')
		keys = list(gangs.keys())
		first = gangs[keys[0]]
		rest = []
		for i in keys[1:]:
			rest += gangs[i]
		for j in rest:
			print(first[0], j)
		for i in first[1:]:
			print(rest[-1], i)
t = int(input())
for _ in range(t):
	n = int(input())
	A = list(map(int, input().split()))
	connection(A)


from math import gcd
from bisect import bisect_left, bisect_right
from itertools import combinations
from itertools import permutations
from bisect import bisect_left
from math import ceil
from math import radians
from heapq import heapify, heappush, heappop, nsmallest
import bisect
from math import pi
from collections import deque
from math import factorial
from math import log, ceil
from collections import defaultdict
from math import *
from sys import stdin, stdout
import itertools
import os
import sys
import threading
from collections import deque, Counter, OrderedDict, defaultdict
from heapq import *
from fractions import Fraction
mod = int(pow(10, 9) + 7)

def ii():
	return int(input())

def si():
	return str(input())

def mi():
	return map(int, input().split())

def li1():
	return list(mi())

def fii():
	return int(stdin.readline())

def fsi():
	return str(stdin.readline())

def fmi():
	return map(int, stdin.readline().split())

def fli():
	return list(fmi())
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}

def getKey(item):
	return item[0]

def sort2(l):
	return sorted(l, key=getKey)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def ntl(n):
	return [int(i) for i in str(n)]

def powerMod(x, y, p):
	res = 1
	x %= p
	while y > 0:
		if y & 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res
graph = defaultdict(list)
visited = [0] * 1000000
col = [-1] * 1000000

def bfs(d, v):
	q = []
	q.append(v)
	visited[v] = 1
	while len(q) != 0:
		x = q[0]
		q.pop(0)
		for i in d[x]:
			if visited[i] != 1:
				visited[i] = 1
				q.append(i)
		print(x)

def make_graph(e):
	d = {}
	for i in range(e):
		(x, y) = mi()
		if x not in d:
			d[x] = [y]
		else:
			d[x].append(y)
		if y not in d:
			d[y] = [x]
		else:
			d[y].append(x)
	return d

def gr2(n):
	d = defaultdict(list)
	for i in range(n):
		(x, y) = mi()
		d[x].append(y)
	return d

def connected_components(graph):
	seen = set()

	def dfs(v):
		vs = set([v])
		component = []
		while vs:
			v = vs.pop()
			seen.add(v)
			vs |= set(graph[v]) - seen
			component.append(v)
		return component
	ans = []
	for v in graph:
		if v not in seen:
			d = dfs(v)
			ans.append(d)
	return ans

def primeFactors(n):
	s = set()
	while n % 2 == 0:
		s.add(2)
		n = n // 2
	for i in range(3, int(sqrt(n)) + 1, 2):
		while n % i == 0 and i % 2 == 1:
			s.add(i)
			n = n // i
	if n > 2 and n % 2 == 1:
		s.add(n)
	return s

def find_all(a_str, sub):
	start = 0
	while True:
		start = a_str.find(sub, start)
		if start == -1:
			return
		yield start
		start += len(sub)

def SieveOfEratosthenes(n, isPrime):
	isPrime[0] = isPrime[1] = False
	for i in range(2, n):
		isPrime[i] = True
	p = 2
	while p * p <= n:
		if isPrime[p] == True:
			i = p * p
			while i <= n:
				isPrime[i] = False
				i += p
		p += 1
	return isPrime

def dijkstra(edges, f, t):
	g = defaultdict(list)
	for (l, r, c) in edges:
		g[l].append((c, r))
	(q, seen, mins) = ([(0, f, ())], set(), {f: 0})
	while q:
		(cost, v1, path) = heappop(q)
		if v1 not in seen:
			seen.add(v1)
			path = (v1, path)
			if v1 == t:
				return (cost, path)
			for (c, v2) in g.get(v1, ()):
				if v2 in seen:
					continue
				prev = mins.get(v2, None)
				next = cost + c
				if prev is None or next < prev:
					mins[v2] = next
					heappush(q, (next, v2, path))
	return float('inf')

def binsearch(a, l, r, x):
	while l <= r:
		mid = l + (r - 1) // 2
		if a[mid]:
			return mid
		elif a[mid] > x:
			l = mid - 1
		else:
			r = mid + 1
	return -1

def readTree(n):
	adj = [set() for _ in range(n)]
	for _ in range(n - 1):
		(u, v) = map(int, input().split())
		adj[u - 1].add(v - 1)
		adj[v - 1].add(u - 1)
	return adj

def treeOrderByDepth(n, adj, root=0):
	parent = [-2] + [-1] * (n - 1)
	ordered = []
	q = deque()
	q.append(root)
	depth = [0] * n
	while q:
		c = q.popleft()
		ordered.append(c)
		for a in adj[c]:
			if parent[a] == -1:
				parent[a] = c
				depth[a] = depth[c] + 1
				q.append(a)
	return (ordered, parent, depth)

def isSubSequence(str1, str2):
	m = len(str1)
	n = len(str2)
	j = 0
	i = 0
	while j < m and i < n:
		if str1[j] == str2[i]:
			j = j + 1
		i = i + 1
	return j == m

def nextPowerOf2(n):
	count = 0
	if n and (not n & n - 1):
		return n
	while n != 0:
		n >>= 1
		count += 1
	return 1 << count

def cou(n):
	c = 0
	while n > 1:
		c += 1
		n //= 2
	return c

def sortsec(l):
	return sorted(l, key=lambda x: x[1])

def BinarySearch(a, x):
	i = bisect_left(a, x)
	if i:
		return i - 1
	else:
		return -1

def subarray(A):
	r = set()
	p = {0}
	for x in A:
		p = {x | y for y in p} | {x}
		r |= p
	return len(r)

def setBitNumber(n):
	n |= n >> 1
	n |= n >> 2
	n |= n >> 4
	n |= n >> 8
	n |= n >> 16
	n = n + 1
	return n >> 1

def countSetBits(n):
	count = 0
	while n:
		count += n & 1
		n >>= 1
	return count

def allsub(l):
	n = len(l)
	a = []
	for i in range(n - 1):
		for j in range(i + 1, n):
			a.append(l[i:j])
	return a
for _ in range(ii()):
	n = ii()
	l = li1()
	d = defaultdict(list)
	for i in range(n):
		d[l[i]].append(i + 1)
	ans = []
	count = 0
	for i in d.keys():
		count += 1
	if count == 1:
		print('NO')
		continue
	for i in d.keys():
		ans.append(d[i])
	ans = sorted(ans, key=len)[::-1]
	if len(ans) == 1:
		print('NO')
		continue
	x = ans[-1]
	anss = []
	s = []
	for i in range(len(ans) - 1):
		for j in ans[i]:
			anss.append([ans[-1][0], j])
			s.append(j)
	j = 0
	for i in range(1, len(ans[-1])):
		anss.append([s[j], ans[-1][i]])
		j += 1
	print('YES')
	for i in anss:
		print(*i)


for t in range(int(input())):
	n = int(input())
	a = list(map(int, input().split(' ')))
	v = [False] * n
	paths = []
	roads = n - 1
	v[0] = True
	c = -1
	s = []
	for i in range(1, n):
		if a[0] != a[i]:
			if c == -1:
				c = i
			v[i] = True
			paths.append((0, i))
			roads -= 1
		else:
			s.append(i)
	if c != -1:
		for i in s:
			roads -= 1
			v[i] = True
			paths.append((c, i))
	possible = True
	for i in v:
		possible = possible and i
	if not possible or roads > 0:
		print('NO')
	else:
		print('YES')
		for path in paths:
			print('{} {}'.format(path[0] + 1, path[1] + 1))


for i in range(int(input())):
	input()
	s = list(map(int, input().split()))
	j = 0
	for (i, q) in enumerate(s, 1):
		if q != s[0]:
			j = i
	print('YES' if j else 'NO')
	if j:
		for (i, q) in enumerate(s, 1):
			if i > 1:
				print(1 if s[0] != q else j, i)


T = int(input())
for z in range(T):
	n = int(input())
	a = [int(x) for x in input().split()]
	ls = list(set(a))
	if len(ls) == 1:
		print('NO')
	else:
		print('YES')
		nex = 0
		ll = []
		for i in range(1, len(a)):
			if a[0] == a[i]:
				ll.append(i + 1)
			else:
				nex = i + 1
				print(1, i + 1)
		for e in ll:
			print(nex, e)


t = int(input())
for _ in range(t):
	n = int(input())
	line = list(map(int, input().split()))
	if len(set(line)) == 1:
		print('NO')
		continue
	(top, tmp, pair) = (line[0], 0, [])
	print('YES')
	for i in range(1, len(line)):
		if line[i] == top:
			pair.append([i + 1, 0])
		else:
			pair.append([1, i + 1])
			tmp = i + 1
	for i in pair:
		if i[1] == 0:
			print(i[0], tmp)
		else:
			print(i[0], i[1])


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split(' ')))
	x = -1
	for i in range(1, n):
		if a[i] != a[0]:
			x = i
			break
	if x == -1:
		print('NO')
	else:
		print('YES')
		for i in range(1, n):
			if a[i] == a[0]:
				print(str(x + 1) + ' ' + str(i + 1))
			else:
				print('1 ' + str(i + 1))


def solve():
	n = int(input())
	districts = [int(x) for x in input().split()]
	dict = {}
	for (idx, district) in enumerate(districts):
		if district in dict.keys():
			dict[district].append(idx + 1)
		else:
			dict[district] = [idx + 1]
	if len(dict) == 1:
		print('NO')
	else:
		print('YES')
		vals = list(dict.values())
		for (idx, valarr) in enumerate(vals):
			for (idx2, val) in enumerate(valarr):
				if idx == 0 and idx2 == 0:
					continue
				print(vals[idx - 1][0], val)
t = int(input())
while t:
	solve()
	t -= 1


import sys, threading
import math
from collections import defaultdict, Counter
input = sys.stdin.readline

def rl(type):
	return [type(w) for w in input().split()]

def reverse(arr):
	return arr[-1::-1]

def mod(a, m):
	return (a % m + m) % m

def check_prime(n):
	temp = int(math.sqrt(n) + 1)
	for i in range(2, temp):
		if n % i == 0:
			return False
	return True

def create_graph(n):
	graph = {}
	for _ in range(n):
		(x, y) = map(int, input().split())
		graph[x].append(y)
		graph[y].append(x)
	return graph

def main():
	for _ in range(int(input())):
		n = int(input())
		arr = rl(int)
		if arr.count(arr[0]) == len(arr):
			print('NO')
		else:
			print('YES')
			p = list(set(arr))
			(t1, t2) = (p[0], p[1])
			for (idx, i) in enumerate(arr):
				if i == t1:
					idx1 = idx + 1
				if i == t2:
					idx2 = idx + 1
			visited = [0] * n
			c = 0
			for i in range(len(arr)):
				if not visited[i]:
					c += 1
					if arr[i] == t1:
						print(idx2, i + 1)
						visited[idx2 - 1] = 1
						visited[i] = 1
					else:
						print(idx1, i + 1)
						visited[idx1 - 1] = 1
						visited[i] = 1
			if c < n - 1:
				print(idx1, idx2)
sys.setrecursionlimit(10 ** 6)
threading.stack_size(10 ** 8)
t = threading.Thread(target=main)
t.start()
t.join()


for s in [*open(0)][2::2]:
	(f, *a) = s.split()
	(b, c) = d = [[], []]
	i = 1
	for x in a:
		i += 1
		d[x == f] += (f'{i} ',)
	print(*(b and ['YES'] + [x + '1 ' for x in b] + [x + b[0] for x in c] or ['NO']))


t = int(input())
for i in range(t):
	n = int(input())
	a = [int(item) for item in input().split()]
	if len(set(a)) == 1:
		print('NO')
	else:
		print('YES')
		b = []
		for i in range(1, n):
			if a[0] != a[i]:
				print(f'1 {i + 1}')
				k = i
			else:
				b.append(i)
		for item in b:
			print(f'{k + 1} {item + 1}')


for _ in range(int(input())):
	n = int(input())
	x = list(map(int, input().split()))
	y = sorted(x)
	if y[0] == y[len(x) - 1]:
		print('NO')
	else:
		print('YES')
		l = []
		idx = x.index(max(x))
		for i in range(len(x)):
			if i == idx:
				continue
			if x[i] != x[idx]:
				l.append([i + 1, idx + 1])
			elif idx == 0:
				if x[i] == x[idx]:
					l.append([i + 1, x.index(min(x)) + 1])
				else:
					l.append([i + 1, len(x)])
			else:
				l.append([1, i + 1])
		for i in range(len(l)):
			print(*l[i])


tc = int(input())
for t in range(tc):
	n = int(input())
	arr = list(map(int, input().split()))
	a = list(set(arr))
	if len(a) == 1:
		print('NO')
		continue
	print('YES')
	for i in range(n):
		if i == arr.index(a[-1]):
			continue
		print(i + 1, arr.index(a[(1 + a.index(arr[i])) % len(a)]) + 1)


import sys
None
try:
	import os
	f = open('input.txt', 'r')
	sys.stdin = f
except FileNotFoundError:
	None
from math import sqrt, ceil
input = lambda : sys.stdin.readline().strip()

class UnionFind:

	def __init__(self, num):
		self.n = num
		self.parents = [-1 for i in range(self.n)]

	def find(self, x):
		if self.parents[x] < 0:
			return x
		else:
			self.parents[x] = self.find(self.parents[x])
			return self.parents[x]

	def union(self, x, y):
		xx = self.find(x)
		yy = self.find(y)
		if xx == yy:
			return
		else:
			size_xx = abs(self.parents[xx])
			size_yy = abs(self.parents[yy])
			if size_xx > size_yy:
				(xx, yy) = (yy, xx)
			self.parents[yy] += self.parents[xx]
			self.parents[xx] = yy

	def size(self, x):
		xx = self.find(x)
		return abs(self.parents[xx])

	def same(self, x, y):
		return 1 if self.find(x) == self.find(y) else 0

	def members(self, x):
		xx = self.find(x)
		return [i for i in range(self.n) if self.find(i) == xx]

	def roots(self):
		return [i for (i, x) in enumerate(self.parents) if x < 0]

	def all_group_members(self):
		return {r: self.members(r) for r in self.roots()}

	def state_grouping(self):
		return list(self.all_group_members().values())
o = int(input())
for _ in range(o):
	n = int(input())
	uf = UnionFind(n)
	A = list(map(int, input().split()))
	cnt = 0
	ANS = []
	for i in range(n):
		po = 0
		for j in range(i):
			if A[i] != A[j] and (not uf.same(i, j)):
				ANS.append((j + 1, i + 1))
				uf.union(i, j)
	if len(ANS) == n - 1:
		print('YES')
		for i in range(n - 1):
			print(*ANS[i])
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	d = list(set(l))
	if len(d) == 1:
		print('NO')
		continue
	print('YES')
	a = l.index(d[0])
	b = l.index(d[1])
	for i in range(n):
		if i != a:
			if l[i] != l[a]:
				print(a + 1, i + 1)
			else:
				print(b + 1, i + 1)


def solv():
	x = int(input())
	s = list(map(int, input().split()))
	st = list(set(s))
	if len(st) == 1:
		print('NO')
		return
	print('YES')
	a = -1
	b = -1
	ct = 0
	for n in range(x):
		if st[0] == s[n]:
			a = n
			ct += 1
		elif s[n] == st[1]:
			b = n
	for n in range(x):
		if s[n] != s[a]:
			print(a + 1, n + 1)
	if ct > 1:
		ct -= 1
		for n in range(x):
			if s[n] == s[a] and n != a:
				print(b + 1, n + 1)
for _ in range(int(input())):
	solv()


from sys import stdout
from sys import stdin

def get():
	return stdin.readline().strip()

def getf():
	return [int(i) for i in get().split()]

def put(a, end='\n'):
	stdout.write(str(a) + end)

def putf(a, sep=' ', end='\n'):
	stdout.write(sep.join([str(i) for i in a]) + end)

def solve(a, n):
	if len(set(a)) == 1:
		put('NO')
		return 0
	put('YES')
	d = []
	q = [0] * n
	for i in range(n - 1):
		for j in range(i + 1, n):
			if q[i] + q[j] == 0:
				if a[i] != a[j]:
					(q[i], q[j]) = (1, 1)
					d.append([i + 1, j + 1])
			elif q[i] + q[j] == 1:
				if a[i] != a[j]:
					(q[i], q[j]) = (1, 1)
					d.append([i + 1, j + 1])
	[putf(i) for i in d]

def main():
	q = int(get())
	for _ in range(q):
		n = int(get())
		a = getf()
		solve(a, n)
main()


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	if len(set(a)) == 1:
		print('NO')
	else:
		d = {}
		for i in range(n):
			d[a[i]] = d.get(a[i], 0) + 1
		m = n
		z = 0
		w = a[i]
		e = a[i]
		for i in d:
			if d[i] < m:
				m = d[i]
				e = i
		x = a.index(e)
		y = -1
		for i in range(n):
			if a[i] != e:
				y = i
				break
		print('YES')
		for i in range(n):
			if i != x:
				if a[i] != e:
					print(x + 1, i + 1)
				else:
					print(i + 1, y + 1)


for x in range(int(input())):
	n = int(input())
	m = list(map(int, input().split()))
	s = set(m)
	if len(s) == 1:
		print('NO')
	else:
		print('YES')
		z = m.pop()
		for i in range(n):
			if m[i] != z:
				l = i + 1
				break
		for i in range(n - 1):
			if m[i] != z:
				print(n, i + 1)
			else:
				print(i + 1, l)


from collections import *
from itertools import *
from bisect import *

def inp():
	return int(input())

def arrinp():
	return [int(x) for x in input().split()]

def main():
	t = inp()
	for _ in range(t):
		n = inp()
		A = arrinp()
		check = set(A)
		if len(check) == 1:
			print('NO')
			continue
		prime = A[0]
		first = dict([(A[0], [])])
		others = []
		for (pos, i) in enumerate(A):
			if i == prime:
				first[prime].append(pos + 1)
			else:
				others.append(pos + 1)
		second = others[0]
		first = first[prime][1:]
		print('YES')
		for i in others:
			print(1, i)
		for i in first:
			print(second, i)
main()


import sys
import math
from collections import defaultdict, deque
input = sys.stdin.readline

def inar():
	return [int(el) for el in input().split()]

def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		arr = inar()
		res = []
		take = arr[0]
		second = -1
		for i in range(1, n):
			if arr[i] != take:
				res.append((1, i + 1))
				second = i + 1
		for i in range(1, n):
			if arr[i] == take:
				res.append((second, i + 1))
		if second == -1:
			print('NO')
		else:
			print('YES')
			for i in range(len(res)):
				print(*res[i])
main()


for efkjr in range(int(input())):
	a = int(input())
	our = list(map(int, input().split()))
	if our.count(our[0]) == a and a > 1:
		print('NO')
	else:
		print('YES')
		x = our[0]
		x_ind = 1
		for i in range(a):
			elem = our[i]
			if elem != x:
				y = elem
				y_ind = i + 1
				break
		for i in range(1, a):
			if our[i] != x:
				print(x_ind, i + 1)
			else:
				print(y_ind, i + 1)


def answer():
	n = int(input())
	a = [int(x) for x in input().split()]
	t = [0 for i in range(n)]
	c = 0
	for i in range(n - 1):
		if a[i] != a[i + 1]:
			c = 1
			break
	if c == 0:
		print('NO')
		return
	print('YES')
	num = 0
	t[0] = 2
	for i in range(1, n, 1):
		if a[0] != a[i]:
			print('1', end=' ')
			print(i + 1)
			t[i] = 1
	for i in range(1, n, 1):
		if t[i] == 0:
			for j in range(n):
				if t[j] == 1:
					print(i + 1, end=' ')
					print(j + 1)
					break
t = int(input())
for i in range(t):
	answer()


from collections import Counter
T = int(input())
for _ in range(T):
	n = int(input())
	a = list(map(int, input().split()))
	c = Counter(a)
	if len(c) == 1:
		print('NO')
	else:
		print('YES')
		p = list(c.keys())[0]
		q = list(c.keys())[-1]
		assert p != q
		for i in range(n):
			if a[i] == p:
				pi = i
			if a[i] == q:
				qi = i
		edges = []
		for i in range(n):
			if a[i] == p and i != pi:
				edges.append((i, qi))
			elif a[i] != p:
				edges.append((i, pi))
		assert len(edges) == n - 1
		for (u, v) in edges:
			print(u + 1, v + 1)


t = int(input())
arr = []
for _ in range(t):
	n = input()
	arr.append(list(map(int, input().split())))
for nums in arr:
	if [nums[0]] * len(nums) == nums:
		print('NO')
		continue
	print('YES')
	a = 0
	b = 1
	i = 1
	while i < len(nums) and nums[a] == nums[i]:
		i += 1
		b = i
	print(f'{a + 1} {b + 1}')
	for i in range(len(nums)):
		if i == a or i == b:
			continue
		elif nums[i] == nums[a]:
			print(f'{i + 1} {b + 1}')
		else:
			print(f'{i + 1} {a + 1}')


for _ in range(int(input())):
	n = int(input())
	arr = [int(num) for num in input().split(' ')]
	if len(set(arr)) == 1:
		print('NO')
	else:
		x = arr.count(arr[0])
		x = x - 1
		a = []
		for i in range(n):
			if arr[i] != arr[0]:
				a.append([1, i + 1])
		b = a[0][1]
		for i in range(1, n):
			if arr[i] == arr[0]:
				a.append([b, i + 1])
		print('YES')
		for item in a:
			print(item[0], item[1])


import sys
import math
import collections
input = sys.stdin.readline
T = int(input())
for case in range(T):
	N = int(input())
	a = [int(x) for x in input().split()]
	all = True
	for i in range(1, N):
		if a[i] != a[0]:
			all = False
			break
	if all:
		print('NO')
	else:
		print('YES')
		nodes = []
		ans = []
		for i in range(N - 1):
			for j in range(i + 1, N):
				if a[i] != a[j]:
					nodes = [i, j]
					break
			if len(nodes):
				break
		ans.append([nodes[0] + 1, nodes[1] + 1])
		for i in range(N):
			if i == nodes[0] or i == nodes[1]:
				continue
			if a[i] == a[nodes[0]]:
				ans.append([i + 1, nodes[1] + 1])
			else:
				ans.append([i + 1, nodes[0] + 1])
		for i in range(len(ans)):
			print(*ans[i])


import sys, collections, math, itertools, random
INF = sys.maxsize

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def input():
	return sys.stdin.readline().strip()
mod = 1000000007
for _ in range(int(input())):
	n = int(input())
	arr = get_array()
	if all((arr[0] == arr[i] for i in range(1, n))):
		print('NO')
		continue
	print('YES')
	ss = 0
	for i in range(1, n):
		if arr[i] != arr[0]:
			ss = i
			break
	for i in range(1, n):
		if arr[i] != arr[0]:
			print(1, i + 1)
		else:
			print(ss + 1, i + 1)


t = int(input())
for case in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	if all((x == a[0] for x in a)):
		print('NO')
	else:
		print('YES')
		non_root = None
		for (i, x) in enumerate(a):
			if x != a[0]:
				non_root = i
				break
		for (i, x) in enumerate(a):
			if i == 0:
				continue
			if x == a[0]:
				print(non_root + 1, i + 1)
			else:
				print(1, i + 1)


import sys
import os
from io import BytesIO, IOBase

def cel(a, b):
	return (a + b - 1) // b

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // gcd(a, b)

def prr(a, sep=' '):
	print(sep.join(map(str, a)))

def ddi():
	return defaultdict(int)

def ddl():
	return defaultdict(list)

def ddd():
	return defaultdict(defaultdict(int))
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from collections import defaultdict
from math import gcd, pi, inf
from heapq import *
for _ in range(ii()):
	n = ii()
	a = li()
	d = ddl()
	for i in range(n):
		d[a[i]].append(i + 1)
	if len(d) == 1 and len(d[a[0]]) > 1:
		print('NO')
	else:
		print('YES')
		k = list(d.keys())
		root = d[k[0]][0]
		for i in k[1:]:
			for v in d[i]:
				print(root, v)
		if len(k) > 1:
			root = d[k[1]][0]
			for v in d[k[0]][1:]:
				print(root, v)


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from itertools import *
import bisect
from heapq import *
from math import ceil, floor
from copy import *
from collections import deque, defaultdict
from collections import Counter as counter
from itertools import combinations
from itertools import permutations as permutate
from bisect import bisect_left as bl
from operator import *
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192
from sys import stderr

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func
mod = 1000000007

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def fsep():
	return map(float, inp().split())

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def pow(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res
from functools import reduce

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))

def gcd(a, b):
	if a == b:
		return a
	while b > 0:
		(a, b) = (b, a % b)
	return a

def prefix_sum(ar):
	return list(accumulate(ar))

def suffix_sum(ar):
	return list(accumulate(ar[::-1]))[::-1]

def N():
	return int(inp())
from collections import defaultdict
sys.setrecursionlimit(300000)

def numberOfSetBits(i):
	i = i - (i >> 1 & 1431655765)
	i = (i & 858993459) + (i >> 2 & 858993459)
	return ((i + (i >> 4) & 252645135) * 16843009 & 4294967295) >> 24

def solve():
	n = N()
	ar = lis()
	gang = defaultdict(list)
	temp = sorted(set(ar))
	for i in range(n):
		gang[ar[i]].append(i + 1)
	l = len(temp)
	if l == 1:
		print('NO')
		return
	print('YES')
	for i in range(l):
		a = temp[i]
		b = temp[(i + 1) % l]
		if (i + 1) % l == 0:
			gang[b] = gang[b][1:]
		for j in gang[b]:
			print(gang[a][0], j)
testcase(int(inp()))


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	lis = list(map(int, input().split()))
	counter = Counter(lis)
	if len(counter) <= 1:
		print('NO')
		continue
	print('YES')
	oneWala = [1]
	othersWala = []
	for i in range(1, n):
		if lis[i] != lis[0]:
			oneWala.append(i + 1)
		else:
			othersWala.append(i + 1)
	flag = 0
	idx = -1
	for i in oneWala:
		for j in othersWala:
			if lis[i - 1] != lis[j - 1]:
				idx = i - 1
				flag = 1
				break
		if flag:
			break
	for i in oneWala:
		if i != 1:
			print(1, i)
	if len(othersWala) == 0:
		continue
	for i in othersWala:
		print(idx + 1, i)


from sys import stdin, stdout
from collections import defaultdict
input = stdin.readline
print = stdout.write
for _ in range(int(input())):
	n = int(input())
	A = list(map(int, input().split()))
	allsame = True
	for i in range(n):
		if A[i] != A[0]:
			allsame = False
			break
	if allsame:
		print('NO\n')
	else:
		edges = []
		myfirst = A[0]
		for i in range(1, n):
			if A[i] != myfirst:
				edges.append('1 ' + str(i + 1))
		different = 0
		for i in range(n):
			if A[i] != A[0]:
				different = i + 1
				break
		for i in range(1, n):
			if A[i] == A[0]:
				edges.append(str(different) + ' ' + str(i + 1))
		print('YES\n')
		for items in edges:
			print(items + '\n')


import sys
import math

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def get_list():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_string():
	return sys.stdin.readline().strip()

def getMaxLength(arr, n):
	count = 0
	result = 0
	for i in range(0, n):
		if arr[i] == 0:
			count = 0
		else:
			count += 1
			result = max(result, count)
	return result
for t in range(int(input())):
	n = int(input())
	arr = get_list()
	if len(set(arr)) == 1:
		print('NO')
		continue
	visted = [False] * n
	ans = []
	stack = [0]
	while len(stack) > 0:
		if len(ans) == n - 1:
			break
		pos = stack.pop(0)
		visted[pos] = True
		val = arr[pos]
		for i in range(n):
			if i == pos:
				continue
			elif arr[i] != val and visted[i] == False:
				visted[i] = True
				stack.append(i)
				ans.append([pos + 1, i + 1])
	print('YES')
	for i in ans:
		print(*i)


for T in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	key = a[0]
	all = []
	all_key = []
	for i in range(1, n):
		if key != a[i]:
			all.append([1, i + 1])
		else:
			all_key.append(i + 1)
	if len(all) != 0:
		for ind in all_key:
			all.append([ind, all[0][1]])
		print('YES')
		for val in all:
			print(val[0], val[1])
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	arr = [int(x) for x in input().split()]
	S = set(arr)
	if len(S) == 1:
		print('NO')
	else:
		print('YES')
		f = False
		s = False
		first = S.pop()
		firstIndex = arr.index(first) + 1
		second = S.pop()
		secondIndex = arr.index(second) + 1
		print(firstIndex, secondIndex)
		for city in range(1, n + 1):
			belongTo = arr[city - 1]
			if belongTo == first:
				if f:
					print(secondIndex, city)
				f = True
			elif belongTo == second:
				if s:
					print(firstIndex, city)
				s = True
			else:
				print(firstIndex, city)


import sys, math
import io, os
from collections import defaultdict as dd, deque, Counter

def data():
	return sys.stdin.readline().strip()

def mdata():
	return list(map(int, data().split()))

def outl(var):
	sys.stdout.write('\n'.join(map(str, var)) + '\n')

def out(var):
	sys.stdout.write(str(var) + '\n')
mod = int(1000000000.0) + 7
for t in range(int(data())):
	n = int(data())
	a = mdata()
	if len(set(a)) == 1:
		out('NO')
		continue
	ind1 = 0
	ind2 = 0
	for i in range(n):
		if a[i] != a[0]:
			ind2 = i
			break
	ans = []
	out('YES')
	for i in range(n):
		if i == ind2:
			continue
		if a[i] != a[ind1]:
			ans.append(str(i + 1) + ' ' + str(ind1 + 1))
		else:
			ans.append(str(i + 1) + ' ' + str(ind2 + 1))
	outl(ans)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	d = {}
	for (ind, r) in enumerate(a):
		if r in d:
			d[r].append(ind + 1)
		else:
			d[r] = [ind + 1]
	if len(d) == 1:
		print('NO')
	else:
		print('YES')
		keys = list(d.keys())
		first = d[keys[0]][0]
		for i in keys[1:]:
			for r in d[i]:
				print(first, r)
		second = d[keys[1]][0]
		for r in d[keys[0]][1:]:
			print(second, r)


import sys
t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	arr = list(map(int, input().split()))
	a = []
	b = []
	for i in range(1, n):
		if arr[i] != arr[0]:
			a.append(i)
		else:
			b.append(i)
	if len(a) == n - 1:
		print('YES')
		for x in a:
			print(1, x + 1, sep=' ')
	elif len(a) == 0:
		print('NO')
	else:
		print('YES')
		for x in a:
			print(1, x + 1, sep=' ')
		for i in range(len(b)):
			print(a[0] + 1, b[i] + 1, sep=' ')


for _ in range(int(input())):
	n = int(input())
	array = list(map(int, input().split()))
	first = array[0]
	second = -1
	pos_second = -1
	for (j, i) in enumerate(array):
		if i != first:
			second = i
			pos_second = j + 1
			break
	result = []
	if second == -1:
		print('NO')
		continue
	for (j, i) in enumerate(array):
		if i != first:
			result.append((1, j + 1))
			pre = i
		else:
			result.append((pos_second, j + 1))
	print('YES')
	for (i, j) in result[1:]:
		print(i, j)


import sys
input = sys.stdin.readline

def main():
	n = int(input())
	alst = list(map(int, input().split()))
	if max(alst) == min(alst):
		print('NO')
		return
	print('YES')
	max_ = max(alst)
	min_ = min(alst)
	max_pos = alst.index(max_) + 1
	min_pos = alst.index(min_) + 1
	ans = []
	for (i, a) in enumerate(alst):
		if a == max_:
			if i + 1 != max_pos:
				ans.append((min_pos, i + 1))
		else:
			ans.append((max_pos, i + 1))
	for row in ans:
		print(*row)
for _ in range(int(input())):
	main()


t = int(input())
for _ in range(t):
	lol = input()
	things = list(map(int, input().split()))
	left = set(list(range(len(things))))
	output = []
	seen = set()
	if len(set(things)) <= 1:
		print('NO')
		continue
	win = False
	for x in range(len(things)):
		cur = things[x]
		for y in range(len(things)):
			if x == y:
				continue
			if len(things) == 0:
				win = True
				break
			if cur != things[y]:
				if x not in left and y not in left:
					continue
				if x in left:
					left.remove(x)
				if y in left:
					left.remove(y)
				output.append([x, y])
	print('YES')
	for z in output:
		print(f'{z[0] + 1} {z[1] + 1}')


for _ in range(int(input())):
	n = int(input())
	s = list(map(int, input().split()))
	x = sorted(s)
	if x[0] == x[-1]:
		print('NO')
		continue
	dic = {}
	index = []
	for (i, n) in enumerate(s):
		if n in dic:
			index[dic[n]].append(i + 1)
		else:
			index.append([i + 1])
			dic[n] = len(index) - 1
	first = index[0][0]
	print('YES')
	for (i, row) in enumerate(index):
		if i == 0:
			continue
		for ele in row:
			print(first, ele)
	second = index[1][0]
	for i in range(1, len(index[0])):
		print(index[0][i], second)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	f = 1
	for b in range(n):
		if arr[0] != arr[b]:
			f = 0
			print('YES')
			break
	else:
		print('NO')
	if f == 0:
		same = []
		diff = 0
		for i in range(1, n):
			if arr[0] != arr[i]:
				print(1, i + 1)
				diff = i
			else:
				same.append(i)
		for j in same:
			print(diff + 1, j + 1)


from collections import *
from math import *
from re import *
test = int(input())
for t in range(1, test + 1):
	n = int(input())
	a = list(map(int, input().split()))
	s = set(a)
	if len(s) == 1:
		print('NO')
	else:
		print('YES')
		x = a[0]
		alt = 0
		for idx in range(n):
			if a[idx] != x:
				alt = idx + 1
				break
		for i in range(1, n):
			if a[i] != x:
				print(1, i + 1)
			else:
				print(alt, i + 1)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	vis = [False] * n
	q = [0]
	vis[0] = True
	ans = []
	while len(q):
		head = q.pop(0)
		for i in range(n):
			if not vis[i] and l[i] != l[head]:
				ans.append([head + 1, i + 1])
				vis[i] = True
				q.append(i)
	if False in vis:
		print('NO')
	else:
		print('YES')
		for i in ans:
			print(*i)


from collections import defaultdict
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	if len(list(set(a))) == 1:
		print('NO')
		continue
	d = defaultdict(list)
	fi = []
	for i in range(len(a)):
		d[a[i]].append(i + 1)
	x = list(d.keys())
	l1 = d[x[0]][0]
	li = d[x[0]]
	l2 = d[x[1]][0]
	for i in range(n):
		if i + 1 not in li:
			fi.append([l1, i + 1])
	for i in range(1, len(li)):
		fi.append([l2, li[i]])
	print('YES')
	for i in range(len(fi)):
		print(*fi[i])


import sys
import os
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import math
import random
import re
import heapq
t = int(input())
while t:
	t -= 1
	n = int(input())
	arr = list(map(int, input().split()))
	counts = {}
	for i in range(len(arr)):
		a = arr[i]
		if a in counts:
			counts[a].append(i)
		else:
			counts[a] = [i]
	if len(counts) == 1:
		print('NO')
	else:
		print('YES')
		root1 = arr[-1]
		counts[root1].pop()
		root2 = -1
		for c in counts:
			if c != root1:
				root2 = counts[c].pop()
				break
		root1 = n - 1
		for a in range(len(arr[:-1])):
			if arr[a] == arr[root1]:
				print(a + 1, root2 + 1)
			else:
				print(a + 1, root1 + 1)


import math
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	mi = min(a)
	ma = max(a)
	if mi == ma:
		print('NO')
	else:
		d = []
		print('YES')
		l = -1
		for i in range(n):
			if a[i] != l:
				d.append(i + 1)
				l = a[i]
			if len(d) == 2:
				break
		c = 0
		for i in range(n):
			if a[i] != a[d[0] - 1] and i + 1 != d[0]:
				c += 1
				print(d[0], i + 1)
		e = a[d[0] - 1]
		for i in range(1, n):
			if a[i] == e:
				print(d[1], i + 1)


from collections import Counter
l = []
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	d = dict(Counter(a))
	if len(set(a)) == 1:
		l.append('NO')
	else:
		s = []
		w = []
		for i in d:
			if d[i] <= n // 2:
				k = i
				break
		for i in range(n):
			if a[i] != k:
				w.append(i + 1)
			else:
				s.append(i + 1)
		l.append('YES')
		for i in w:
			l.append(str(s[0]) + ' ' + str(i))
		for i in range(1, len(s)):
			l.append(str(w[i - 1]) + ' ' + str(s[i]))
for i in l:
	print(i)


def find(x):
	if x.count(x[0]) == len(x):
		print('NO')
	else:
		x = [(x[i], i + 1) for i in range(len(x))]
		print('YES')
		x.sort(key=lambda x: x[0])
		f = x[0][0]
		first = []
		second = []
		for i in range(len(x)):
			if x[i][0] == f:
				first.append(x[i][1])
			else:
				second.append(x[i][1])
		for i in second:
			print(first[0], i)
		if len(first) > 0:
			for i in first[1:]:
				print(i, second[0])
for i in range(int(input())):
	input()
	l = list(map(int, input().split()))
	find(l)


t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	ma = arr.count(arr[0])
	if ma == n:
		print('NO')
	else:
		print('YES')
		for i in range(n):
			if arr[i] != arr[0]:
				print(1, i + 1, sep=' ')
				ind = i
		for i in range(1, n):
			if arr[i] == arr[0]:
				print(i + 1, ind + 1, sep=' ')


for _ in range(int(input())):
	n = int(input())
	x = list(map(int, input().split()))
	s = len(set(x))
	if s == 1:
		print('NO')
	else:
		print('YES')
		t = 0
		for i in range(1, n):
			if x[i] != x[0]:
				t = i + 1
				break
		for i in range(1, n):
			if x[i] != x[0]:
				print(1, i + 1)
			else:
				print(t, i + 1)


from collections import Counter
from sys import stdin
input = stdin.readline
for _ in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	d = {}
	c = Counter()
	for (i, e) in enumerate(a, start=1):
		c[e] += 1
		if e not in d:
			d[e] = []
		d[e].append(i)
	t = c.most_common(2)
	r = []
	while len(t) == 2 and t[1][1] > 0:
		x = t[0][0]
		y = t[1][0]
		xi = d[x].pop()
		yi = d[y][-1]
		c[x] -= 1
		r.append((xi, yi))
		t = c.most_common(2)
	if len(r) == n - 1:
		print('YES')
		for i in range(n - 1):
			print(*r[i])
	else:
		print('NO')


from collections import defaultdict
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	if len(set(a)) == 1:
		print('NO')
	else:
		print('YES')
		r = []
		start = a[0]
		flag = 0
		for i in range(1, n):
			if a[i] != start:
				print(1, i + 1)
				if flag == 0:
					flag = i
			elif flag == 0:
				r.append(i)
			else:
				print(i + 1, flag + 1)
		for i in r:
			print(i + 1, flag + 1)


def solve(gangs, n):
	waiting = []
	lst = []
	free_node = None
	for i in range(1, n):
		if gangs[0] != gangs[i]:
			lst.append([1, i + 1])
			free_node = i
		else:
			waiting.append(i)
	if len(waiting) != 0 and free_node == None:
		return False
	for i in range(len(waiting)):
		lst.append([free_node + 1, waiting[i] + 1])
	return lst
for _ in range(int(input())):
	n = int(input())
	gangs = list(map(int, input().split()))
	res = solve(gangs, n)
	if res:
		print('YES')
		for i in res:
			print(' '.join([str(i) for i in i]))
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	if len(list(set(arr))) == 1:
		print('NO')
	else:
		print('YES')
		a = arr[0]
		for i in range(1, n):
			if arr[i] != a:
				b = arr[i]
				ind = i
				break
		for i in range(1, n):
			if arr[i] != a:
				print(1, i + 1)
			elif arr[i] != b:
				print(ind + 1, i + 1)


from collections import defaultdict

def dfs(adj, vis, v):
	vis[v] = True
	for i in adj[v]:
		if not vis[i]:
			print(v + 1, i + 1)
			dfs(adj, vis, i)

def solve():
	n = int(input())
	l = list(map(int, input().split()))
	if len(set(l)) == 1:
		print('NO')
		return
	adj = defaultdict(list)
	s = set()
	print('YES')
	for i in range(n):
		for j in range(n):
			(x, y) = ((i, j), (j, i))
			if l[i] != l[j] and x not in s and (y not in s):
				adj[i].append(j)
				adj[j].append(i)
				s.add(x)
				s.add(y)
				break
	vis = [False for i in range(n)]
	dfs(adj, vis, 0)
t = int(input())
while t:
	solve()
	t -= 1


def sol(a, n):
	ans = []
	dd = a[0]
	vstd = [0]
	for i in range(1, n):
		if a[i] != dd:
			ans.append([1, i + 1])
			vstd.append(i)
	if len(ans) == 0:
		return -1
	w = ans[0]
	tm = w[1] - 1
	for i in range(n):
		if i not in vstd and a[i] != a[tm]:
			ans.append([w[1], i + 1])
	return ans
t = int(input())
while t:
	n = int(input())
	a = input()
	a = list(map(int, a.split()))
	w = sol(a, n)
	if w == -1:
		print('NO')
	else:
		print('YES')
		for i in w:
			print(i[0], i[1])
	t = t - 1


def f(arr):
	r1 = 0
	r2 = 1
	while r2 != len(arr) and arr[r2] == arr[r1]:
		r2 += 1
	if r2 == len(arr):
		return 'NO'
	r = []
	r.append((r1, r2))
	for i in range(len(arr)):
		if i in [r1, r2]:
			continue
		if arr[i] != arr[r1]:
			r.append((r1, i))
		else:
			r.append((r2, i))
	s = 'YES'
	for (i, j) in r:
		s += f'\n{i + 1} {j + 1}'
	return s
for _ in range(int(input())):
	int(input())
	print(f(list(map(int, input().split()))))


def district_connect(arr):
	if len(set(arr)) == 1:
		print('NO')
		return []
	l = []
	k = arr[0]
	for i in arr:
		if i != k:
			index = arr.index(i)
			break
	for i in range(1, len(arr)):
		if arr[i] != k:
			l.append([1, i + 1])
		else:
			l.append([i + 1, index + 1])
	print('YES')
	return l
t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	result = district_connect(arr)
	for i in result:
		print(i[0], i[1])


import collections
for _ in range(int(input())):
	n = int(input())
	A = list(map(int, input().split()))
	if len(set(A)) == 1:
		print('NO')
	else:
		ans = []
		seen = [0] * n
		dic = collections.defaultdict(list)
		x = A[0]
		for (i, a) in enumerate(A, 1):
			dic[a == A[0]].append(i)
		i = dic[1][0]
		for j in dic[0]:
			ans.append((i, j))
		j = dic[0][0]
		for i in dic[1][1:]:
			ans.append((i, j))
		print('YES')
		for a in ans:
			print(*a)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	if len(set(a)) == 1:
		print('NO')
		continue
	print('YES')
	index1 = index2 = 0
	for i in range(n):
		if a[i] != a[index2]:
			index2 = i
			break
	mylist = []
	for i in range(1, n):
		if a[i] != a[0]:
			print(1, i + 1)
		else:
			mylist.append(i + 1)
	for i in mylist:
		print(index2 + 1, i)


import sys
input = sys.stdin.readline
t = int(input())
for tests in range(t):
	n = int(input())
	A = list(map(int, input().split()))
	if len(set(A)) == 1:
		print('NO')
		continue
	else:
		print('YES')
	L = list(set(A))
	one = A.index(L[0])
	two = A.index(L[1])
	print(one + 1, two + 1)
	for i in range(n):
		if i == one or i == two:
			continue
		if A[i] == L[0]:
			print(i + 1, two + 1)
		else:
			print(i + 1, one + 1)


from collections import deque

def connect_asimilar(pts):
	n = len(pts)
	graph = [[] for i in range(n)]
	for (i, pt) in enumerate(pts):
		if pts[i] != pts[0]:
			graph[0].append(i)
	j = 1
	while j < n and pts[j] == pts[0]:
		j += 1
	if j == n:
		return []
	for i in range(1, n):
		if pts[i] == pts[0]:
			graph[j].append(i)
	return graph
t = int(input())
cases = []
for i in range(t):
	input()
	cases.append(list(map(int, input().split(' '))))
for case in cases:
	ret = connect_asimilar(case)
	if len(ret) == 0:
		print('NO')
	else:
		print('YES')
		for (i, row) in enumerate(ret):
			for val in row:
				print(i + 1, end=' ')
				print(val + 1)


from collections import defaultdict
t = int(input())
for i in range(t):
	l1 = int(input())
	d = defaultdict(list)
	l = list(map(int, input().split()))
	ans = []
	for j in range(l1):
		d[l[j]].append(j + 1)
	if len(d) == 1:
		print('NO')
		continue
	else:
		for j in d:
			k1 = j
			break
		for j in d:
			if j == k1:
				continue
			else:
				for k in d[j]:
					ans.append((d[k1][0], k))
		for j in d:
			if k1 != j:
				r = j
				break
		for j in d[k1]:
			if j == d[k1][0]:
				continue
			else:
				ans.append((d[r][0], j))
	print('YES')
	for j in ans:
		print(j[0], j[1])


from bisect import *
from collections import *
from math import gcd, ceil, sqrt, floor
from heapq import *
from typing import List
from itertools import *
from operator import add, mul, sub, xor, truediv, floordiv
from functools import *
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def RL():
	return map(int, sys.stdin.readline().rstrip().split())

def RLL():
	return list(map(int, sys.stdin.readline().rstrip().split()))

def N():
	return int(input())

@lru_cache(None)
def fact(x):
	if x < 2:
		return 1
	return fact(x - 1) * x

@lru_cache(None)
def per(i, j):
	return fact(i) // fact(i - j)

@lru_cache(None)
def com(i, j):
	return per(i, j) // fact(j)

def linc(f, t, l, r):
	while l < r:
		mid = (l + r) // 2
		if t > f(mid):
			l = mid + 1
		else:
			r = mid
	return l

def rinc(f, t, l, r):
	while l < r:
		mid = (l + r + 1) // 2
		if t < f(mid):
			r = mid - 1
		else:
			l = mid
	return l

def ldec(f, t, l, r):
	while l < r:
		mid = (l + r) // 2
		if t < f(mid):
			l = mid + 1
		else:
			r = mid
	return l

def rdec(f, t, l, r):
	while l < r:
		mid = (l + r + 1) // 2
		if t > f(mid):
			r = mid - 1
		else:
			l = mid
	return l

def isprime(n):
	for i in range(2, int(n ** 0.5) + 1):
		if n % i == 0:
			return False
	return True

def binfun(x):
	c = 0
	for w in arr:
		c += ceil(w / x)
	return c

def lowbit(n):
	return n & -n

class BIT:

	def __init__(self, arr):
		self.arr = arr
		self.n = len(arr) - 1

	def update(self, x, v):
		while x <= self.n:
			self.arr[x] += v
			x += x & -x

	def query(self, x):
		ans = 0
		while x:
			ans += self.arr[x]
			x &= x - 1
		return ans

class smt:

	def __init__(self, l, r, arr):
		self.l = l
		self.r = r
		self.value = (1 << 31) - 1 if l < r else arr[l]
		mid = (l + r) // 2
		if l < r:
			self.left = smt(l, mid, arr)
			self.right = smt(mid + 1, r, arr)
			self.value &= self.left.value & self.right.value

	def setvalue(self, x, val):
		if self.l == self.r:
			self.value = val
			return
		mid = (self.l + self.r) // 2
		if x <= mid:
			self.left.setvalue(x, val)
		else:
			self.right.setvalue(x, val)
		self.value = self.left.value & self.right.value

	def ask(self, l, r):
		if l <= self.l and r >= self.r:
			return self.value
		val = (1 << 31) - 1
		mid = (self.l + self.r) // 2
		if l <= mid:
			val &= self.left.ask(l, r)
		if r > mid:
			val &= self.right.ask(l, r)
		return val

class UFS:

	def __init__(self, n):
		self.parent = [i for i in range(n)]
		self.ranks = [0] * n

	def find(self, x):
		if x != self.parent[x]:
			self.parent[x] = self.find(self.parent[x])
		return self.parent[x]

	def union(self, u, v):
		(pu, pv) = (self.find(u), self.find(v))
		if pu == pv:
			return False
		if self.ranks[pu] >= self.ranks[pv]:
			self.parent[pv] = pu
			if self.ranks[pv] == self.ranks[pu]:
				self.ranks[pu] += 1
		else:
			self.parent[pu] = pv

def Prime(n):
	c = 0
	prime = []
	flag = [0] * (n + 1)
	for i in range(2, n + 1):
		if not flag[i]:
			prime.append(i)
			c += 1
		for j in range(c):
			if i * prime[j] > n:
				break
			flag[i * prime[j]] = prime[j]
			if i % prime[j] == 0:
				break
	return prime

def dij(s, graph):
	d = {}
	d[s] = 0
	heap = [(0, s)]
	seen = set()
	while heap:
		(dis, u) = heappop(heap)
		if u in seen:
			continue
		for v in graph[u]:
			if v not in d or d[v] > d[u] + graph[u][v]:
				d[v] = d[u] + graph[u][v]
				heappush(heap, (d[v], v))
	return d

def md(a, b, mod):
	return a * pow(b, mod - 2, mod) % mod
t = N()
for i in range(t):
	n = N()
	a = RLL()
	d = defaultdict(list)
	for (i, ai) in enumerate(a, 1):
		d[ai].append(i)
	if len(d) == 1:
		print('NO')
		continue
	res = []
	for k in d:
		res.append(k)
		if len(res) == 2:
			break
	(x, y) = res
	ans = []
	tmp = d[y][0]
	for k in d:
		if k == x:
			for i in d[k]:
				ans.append([i, d[y][0]])
		elif k == y:
			for i in d[k]:
				if i != tmp:
					ans.append([i, d[x][0]])
		else:
			for i in d[k]:
				ans.append([i, d[y][0]])
	print('YES')
	for a in ans:
		print(*a)


def solve(n, arr):
	roadmap = []
	other = None
	for i in range(1, n):
		if arr[0] != arr[i]:
			roadmap.append((0, i))
			other = i
			break
	if not other:
		print('NO')
		return
	for i in range(1, n):
		if i != other:
			if arr[i] != arr[0]:
				roadmap.append((0, i))
			else:
				roadmap.append((other, i))
	print('YES')
	for i in roadmap:
		print(i[0] + 1, i[1] + 1)
T = int(input())
for t in range(T):
	n = int(input())
	arr = list(map(int, input().split()))
	solve(n, arr)


t = int(input())
for _ in range(t):
	n = int(input())
	dist = list(map(int, input().strip().split()))[:n]
	adj = {}
	for i in range(len(dist)):
		if dist[i] not in adj.keys():
			adj[dist[i]] = []
		adj[dist[i]].append(i)
	if len(adj) == 1:
		print('NO')
	else:
		print('YES')
		keys = list(adj.keys())
		for i in range(len(keys) - 1):
			for j in adj[keys[i]]:
				print(j + 1, adj[keys[i + 1]][0] + 1)
		if len(adj[keys[-1]]) > 1:
			for j in adj[keys[-1]][1:]:
				print(j + 1, adj[keys[-2]][0] + 1)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
for j in range(int(input())):
	n = int(input())
	vals = list(map(int, input().split()))
	dis = {}
	for s in range(n):
		if not vals[s] in dis:
			dis[vals[s]] = [s + 1]
		else:
			dis[vals[s]].append(s + 1)
	keys = [x for x in dis.keys()]
	if len(keys) == 1:
		print('NO')
	else:
		ans = []
		for s in range(n):
			if vals[s] != keys[0]:
				ans.append((dis[keys[0]][0], s + 1))
		for s in range(n):
			if vals[s] == keys[0] and s + 1 != dis[keys[0]][0]:
				ans.append((dis[keys[1]][0], s + 1))
		print('YES')
		for i in ans:
			print(*i)


import sys
try:
	(sys.stdin, sys.stdout) = (open('in.txt', 'r'), open('out.txt', 'w'))
except:
	pass
ii1 = lambda : int(sys.stdin.readline().strip())
is1 = lambda : sys.stdin.readline().strip()
iia = lambda : list(map(int, sys.stdin.readline().strip().split()))
isa = lambda : sys.stdin.readline().strip().split()
mod = int(1000000000.0 + 7)
from collections import *
from math import *
for _ in range(ii1()):
	n = ii1()
	arr = iia()
	a = Counter(arr)
	if len(a) == 1:
		print('NO')
	elif 1 in a.values():
		print('YES')
		for (key, val) in a.items():
			if val == 1:
				ans = key
				break
		idx = arr.index(ans)
		for i in range(n):
			if i == idx:
				continue
			print(idx + 1, i + 1)
	else:
		mn = min(a.values())
		ans = 0
		for (key, val) in a.items():
			if val == mn:
				ans = key
				break
		res = []
		for i in range(n):
			if arr[i] == ans:
				res.append(i)
		main = res.pop()
		print('YES')
		for i in range(n):
			if arr[i] != ans:
				print(main + 1, i + 1)
				if len(res) > 0:
					print(i + 1, res.pop() + 1)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	st = []
	p = []
	for i in range(1, n):
		if a[0] != a[i]:
			st.append([1, i + 1])
		else:
			p.append([a[i], i + 1])
	if len(st) == 0:
		print('NO')
	else:
		for i in range(len(p)):
			st.append([st[0][1], p[i][1]])
		print('YES')
		for i in st:
			print(i[0], i[1])


import sys, io, os
BUFSIZE = 8192

class FastIO(io.IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = io.BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(io.IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
T = int(input())
for _ in range(T):
	N = int(input())
	A = list(map(int, input().split()))
	if all([A[0] == a for a in A]):
		print('NO')
	else:
		print('YES')
		a0 = A[0]
		for (i, a) in enumerate(A, 1):
			if a0 != a:
				idx2 = i
				break
		for (i, a) in enumerate(A[1:], 2):
			print(i, 1 if a != a0 else idx2)


t = int(input())
for _ in range(t):
	n = int(input())
	l1 = list(map(int, input().split()))
	x = l1[0]
	if l1.count(x) == n:
		print('NO')
	elif l1.count(x) == 1:
		print('YES')
		for i in range(2, n + 1):
			print(1, i)
	else:
		print('YES')
		(l2, l3) = ([], [])
		for i in range(1, n):
			if l1[i] == x:
				l2.append(i)
			else:
				l3.append(i)
		for i in range(len(l3)):
			print(1, l3[i] + 1)
		if len(l2) >= len(l3):
			for i in range(len(l2)):
				print(l2[i] + 1, l3[0] + 1)
		else:
			i = 0
			while i < len(l2):
				print(l2[i] + 1, l3[i] + 1)
				i += 1


import sys
import bisect as bi
import collections as cc
import heapq as hp
input = sys.stdin.readline
I = lambda : list(map(int, input().split()))
ar = []
for i in range(1, 10):
	j = str(i)
	while int(j) <= 10000:
		ar.append(int(j))
		j += str(i)
for tc in range(int(input())):
	(n,) = I()
	l = I()
	if len(set(l)) == 1:
		print('NO')
		continue
	else:
		ans = []
		prev = -1
		to = []
		for i in range(1, n):
			if l[i] != l[0]:
				ans.append([i + 1, 1])
				prev = i + 1
			else:
				to.append(i + 1)
		for j in to:
			ans.append([j, prev])
		print('YES')
		for i in ans:
			print(*i)


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	ans = []
	if len(set(l)) == 1:
		sys.stdout.write('NO\n')
		continue
	else:
		x = l[0]
		z = []
		f = -1
		for i in range(1, len(l)):
			y = l[i]
			if x == y:
				z.append(i + 1)
			else:
				ans.append((1, i + 1))
				f = i + 1
		for i in z:
			ans.append((f, i))
	sys.stdout.write('YES\n')
	for i in ans:
		r1 = str(i[0])
		r2 = str(i[1])
		sys.stdout.write(r1 + ' ' + r2 + '\n')


t = int(input())
while t:
	n = int(input())
	a = list(map(int, input().split()))
	s = set(a)
	if len(s) <= 1:
		print('NO')
	else:
		print('YES')
		(u, v) = (0, 0)
		for x in range(n):
			if a[x] != a[u]:
				v = x
				break
		for x in range(1, n):
			if a[x] != a[u]:
				print(u + 1, x + 1)
			else:
				print(v + 1, x + 1)
	t -= 1


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	dic = {}
	for i in range(n):
		try:
			if dic[arr[i]]:
				dic[arr[i]].append(i + 1)
		except:
			dic[arr[i]] = [i + 1]
	t = [dic[i] for i in dic]
	t = sorted(t, key=lambda x: len(x))
	l = 0
	if len(t) == 1:
		print('NO')
	elif len(t) > 1:
		for i in t[1:]:
			l += len(i)
		if len(t[0]) - l >= 2:
			print('NO')
		else:
			ans = []
			p = t[0][0]
			for i in range(1, len(t)):
				for j in t[i]:
					ans.append([p, j])
			for i in t[0][1:]:
				ans.append([i, t[1][0]])
			print('YES')
			for i in ans:
				print(*i)


t = int(input())
for _ in range(t):
	n = int(input())
	mas = list(map(int, input().split()))
	ind = -1
	for k in range(n):
		if mas[k] != mas[0]:
			ind = k
			break
	if ind == -1:
		print('NO')
	else:
		print('YES')
		for i in range(1, n):
			if mas[i] != mas[0]:
				print(1, i + 1)
			else:
				print(ind + 1, i + 1)


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	x = int(input())
	(*li,) = map(int, input().split())
	if len(set(li)) == 1:
		print('NO')
	else:
		print('YES')
		for i in range(x):
			if li[i] != li[0]:
				print(1, i + 1)
				idx = i
		for i in range(1, x):
			if li[i] == li[0]:
				print(idx + 1, i + 1)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	a_set = set(a)
	d = dict()
	for i in range(n):
		if a[i] not in d.keys():
			d[a[i]] = [i]
		else:
			d[a[i]].append(i)
	d_keys = list(d.keys())
	if len(d) > 1:
		print('YES')
		for i in range(n):
			if a[i] != d_keys[0]:
				print(f'{i + 1} {d[d_keys[0]][0] + 1}')
		for i in range(n):
			if a[i] == d_keys[0] and i != d[d_keys[0]][0]:
				print(f'{i + 1} {d[d_keys[1]][0] + 1}')
	else:
		print('NO')


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	if a.count(max(a)) == n:
		print('NO')
	else:
		print('YES')
		mi = []
		ma = []
		other = []
		valmi = min(a)
		valma = max(a)
		for i in range(n):
			if a[i] == valmi:
				mi.append(i + 1)
			elif a[i] == valma:
				ma.append(i + 1)
			else:
				other.append(i + 1)
		for i in ma:
			print(mi[0], i)
		for i in other:
			print(mi[0], i)
		for i in mi[1:]:
			print(ma[0], i)


from os import path
import sys
from heapq import heappush, heappop
from functools import cmp_to_key as ctk
from collections import deque, defaultdict as dd
from bisect import bisect, bisect_left, bisect_right, insort, insort_left, insort_right
from itertools import permutations
from datetime import datetime
from math import ceil, sqrt, log, gcd

def ii():
	return int(input())

def si():
	return input().rstrip()

def mi():
	return list(map(int, input().split()))

def li():
	return list(mi())
abc = 'abcdefghijklmnopqrstuvwxyz'
mod = 1000000007
inf = float('inf')
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def bo(i):
	return ord(i) - ord('a')
file = 1

def solve():
	for _ in range(ii()):
		n = ii()
		a = li()
		if len(set(a)) == 1:
			print('NO')
			continue
		print('YES')
		(ans, p) = ([], [])
		x = a[0]
		y = -1
		for i in range(1, n):
			if a[i] != x:
				y = i + 1
				ans.append([1, i + 1])
			else:
				p.append(i + 1)
		for i in p:
			ans.append([y, i])
		for i in ans:
			print(*i)

def __starting_point():
	if file:
		if path.exists('input.txt'):
			sys.stdin = open('input.txt', 'r')
			sys.stdout = open('output.txt', 'w')
		else:
			input = sys.stdin.readline
	solve()
__starting_point()


import sys

def isMax(x):
	return x == max(l)
for t in range(0, int(sys.stdin.readline())):
	n = sys.stdin.readline()
	l = list(map(int, sys.stdin.readline().split()))
	hub = l.index(max(l))
	try:
		nhub = list(map(isMax, l)).index(False)
		sys.stdout.write('YES\n')
		for i in range(0, len(l)):
			if i == hub:
				pass
			elif l[i] == l[hub]:
				sys.stdout.write(str(min([i, nhub]) + 1) + ' ' + str(max([i, nhub]) + 1) + '\n')
			else:
				sys.stdout.write(str(min([i, hub]) + 1) + ' ' + str(max([i, hub]) + 1) + '\n')
	except:
		sys.stdout.write('NO\n')


for t in range(int(input())):
	n = int(input())
	dist = list(map(int, input().split()))
	if len(set(dist)) == 1:
		print('NO')
		continue
	print('YES')
	path = [0]
	connect = [0] * n
	for i in range(1, n):
		if dist[i] != dist[0]:
			print(1, i + 1)
			path.append(i)
			connect[i] = connect[0] = 1
			break
	for i in range(1, n):
		for j in path:
			if dist[i] != dist[j] and (connect[i] and connect[j]) == 0:
				print(i + 1, j + 1)
				connect[i] = connect[j] = 1
				break


t = int(input())
for _ in range(t):
	n = int(input())
	s = input().split()
	a = [int(c) for c in s]
	pairs = []
	for i in range(n):
		pairs.append((a[i], i + 1))
	pairs.sort(key=lambda x: x[0])
	if pairs[0][0] == pairs[n - 1][0]:
		print('NO')
	else:
		print('YES')
		for i in range(n - 1):
			if pairs[i][0] == pairs[n - 1][0]:
				print(str(pairs[0][1]) + ' ' + str(pairs[i][1]))
			else:
				print(str(pairs[i][1]) + ' ' + str(pairs[n - 1][1]))


from math import *
from sys import *
t = int(stdin.readline())
for _ in range(t):
	n = int(stdin.readline())
	a = list(map(int, stdin.readline().split()))
	f = 0
	for i in range(n - 1):
		if a[i] != a[i + 1]:
			f = 1
			break
	if f == 0:
		print('NO')
	else:
		print('YES')
		m = []
		x = []
		for i in range(1, n):
			if a[i] != a[0]:
				m.append(i + 1)
			else:
				x.append(i + 1)
		for i in range(len(m)):
			print(1, m[i])
		for i in range(len(x)):
			print(m[-1], x[i])


for i in range(int(input())):
	n = int(input())
	s = list(map(int, input().split()))
	if s.count(s[0]) == n:
		print('NO')
	else:
		print('YES')
		k = -1
		m = s.index(max(s)) + 1
		for i in range(n):
			if s[i] != max(s):
				k = i + 1
				break
		for i in range(1, n):
			if s[i] != s[m - 1]:
				print(i + 1, m)
			else:
				print(i + 1, k)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	c = 1
	l = [a[0]]
	for z in range(1, n):
		if a[z] != a[0]:
			c += 1
			l.append(z)
			break
	if c == 1:
		print('NO')
	else:
		print('YES')
		for z in range(1, n):
			if a[z] != a[0]:
				print(1, z + 1)
			else:
				print(l[1] + 1, z + 1)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	if len(set(a)) == 1:
		print('NO')
	else:
		print('YES')
		edges = []
		mn = min(a)
		found_mn = False
		for i in range(n):
			if a[i] == mn:
				if not found_mn:
					for j in range(n):
						if a[j] != mn:
							edges.append((i + 1, j + 1))
				else:
					for j in range(n):
						if a[j] != mn:
							edges.append((i + 1, j + 1))
							break
				found_mn = True
		for i in edges:
			print(*i)


t = int(input())
for _ in range(t):
	n = int(input())
	cities = [int(x) for x in input().split()]
	gangs = {}
	for (i, c) in enumerate(cities):
		if c in gangs:
			gangs[c].append(i)
		else:
			gangs[c] = [i]
	if len(gangs) == 1:
		print('NO')
		continue
	connections = []
	last_gang = None
	first = True
	for gang in gangs.values():
		if last_gang != None:
			if first:
				for g in last_gang[1:]:
					connections.append([g, gang[0]])
			for g in gang:
				connections.append([last_gang[0], g])
			first = False
		last_gang = gang
	print('YES')
	for c in connections:
		print(c[0] + 1, c[1] + 1)


import os
import sys
from io import BytesIO, IOBase
import heapq as h
from bisect import bisect_left, bisect_right
from types import GeneratorType
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		import os
		self.os = os
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			self.os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import collections as col

def getInts():
	return [int(s) for s in input().split()]

def getInt():
	return int(input())

def getStrs():
	return [s for s in input().split()]

def getStr():
	return input()

def listStr():
	return list(input())
MOD = 10 ** 9 + 7

def solve():
	N = getInt()
	A = getInts()
	if len(set(A)) == 1:
		print('NO')
		return
	print('YES')
	root = A[0]
	flag = True
	for j in range(N):
		if A[j] != root:
			print(1, j + 1)
			if flag:
				child = j
				flag = not flag
	for j in range(1, N):
		if A[j] == root:
			print(child + 1, j + 1)
	return
for _ in range(getInt()):
	solve()


for _ in range(int(input())):
	x = int(input())
	r = [int(x) for x in input().split()]
	if len(set(r)) == 1:
		print('NO')
	else:
		print('YES')
		f_gang = r[0]
		f_gang_2_val = [x for x in r if x != f_gang][0]
		f_gang_2 = r.index(f_gang_2_val)
		for i in range(1, x):
			if r[i] == f_gang:
				print(str(i + 1) + ' ' + str(f_gang_2 + 1))
			else:
				print(str(i + 1) + ' ' + str(1))


from collections import defaultdict
for i in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	if len(set(arr)) == 1:
		print('NO')
	else:
		print('YES')
		graph = defaultdict(list)
		for j in range(n):
			graph[arr[j]].append(j + 1)
		ans = list(graph.values())
		for j in ans[1:]:
			for k in range(len(j)):
				print(ans[0][0], j[k])
		for k in ans[0][1:]:
			print(ans[1][0], k)


import sys, math, itertools
from collections import Counter, deque, defaultdict
from bisect import bisect_left, bisect_right
mod = 10 ** 9 + 7
INF = float('inf')

def inp():
	return int(sys.stdin.readline())

def inpl():
	return list(map(int, sys.stdin.readline().split()))
for _ in range(inp()):
	n = inp()
	a = inpl()
	tmp = set()
	for x in a:
		tmp.add(x)
	if len(tmp) == 1:
		print('NO')
		continue
	fir = a[0]
	for (i, x) in enumerate(a):
		if fir == x:
			continue
		sub = i
		break
	print('YES')
	for i in range(1, n):
		if a[i] == fir:
			print(i + 1, sub + 1)
		else:
			print(i + 1, 1)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	if len(set(arr)) == 1:
		print('NO')
		continue
	first = arr[0]
	diff = -1
	print('YES')
	for i in range(1, n):
		if arr[i] != first:
			print(1, i + 1)
			if diff == -1:
				diff = i + 1
	for i in range(1, n):
		if arr[i] == first:
			print(diff, i + 1)


t = int(input())
for i10 in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	if max(a) == min(a):
		print('NO')
	else:
		p = 0
		print('YES')
		for i in range(n):
			if a[i] != a[p]:
				p1 = i
				break
		for i in range(1, n):
			if a[i] != a[p]:
				print(p + 1, i + 1)
			else:
				print(p1 + 1, i + 1)


from sys import maxsize, stdout, stdin
mod = int(1000000000.0 + 7)

def I():
	return int(stdin.readline())

def lint():
	return [int(x) for x in stdin.readline().split()]

def S():
	return input().strip()

def grid(r, c):
	return [lint() for i in range(r)]

def districts():
	n = I()
	ls = lint()
	ans = []
	if len(set(ls)) == 1:
		print('NO')
	else:
		print('YES')
		x = ls[0]
		y = 0
		for i in range(1, n):
			if ls[i] == x:
				ans.append(i + 1)
			else:
				print(1, i + 1)
				y = i + 1
		for i in ans:
			print(y, i)
for _ in range(I()):
	districts()


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	if a.count(a[0]) == n:
		print('NO')
	else:
		print('YES')
		ans = []
		v = [0] * n
		c = a[0]
		v[0] = 1
		ind = -1
		for i in range(1, n):
			if a[i] != c:
				ans.append([1, i + 1])
				ind = i + 1
				v[i] = 1
		for i in range(1, n):
			if v[i] == 0:
				ans.append([ind, i + 1])
		for i in ans:
			print(i[0], i[1])


for _ in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	connected_districts = [False] * n
	roads = []
	for district in range(n):
		for neighbor in range(n):
			if district != neighbor and a[district] != a[neighbor] and (connected_districts[neighbor] is False):
				connected_districts[district] = True
				connected_districts[neighbor] = True
				roads.append((district + 1, neighbor + 1))
	if all(connected_districts):
		print('YES')
		for road in roads:
			print(*road)
	else:
		print('NO')


import sys
t = int(input())
for tc in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	c = list()
	b = dict()
	for i in range(n):
		if a[i] == a[0]:
			c.append(i)
			continue
		k = a[i]
		b[a[i]] = b.get(a[i], list())
		b[k].append(i)
	if len(c) == n:
		print('no')
		continue
	print('yes')
	for values in b.values():
		for i in values:
			print(c[0] + 1, i + 1)
	for i in range(1, len(c)):
		print(b[k][0] + 1, c[i] + 1)


def main():
	for _ in range(int(input())):
		n = int(input())
		a = list(map(int, input().split()))
		s = set(a)
		if len(s) == 1:
			print('NO')
			continue
		(f, s) = (-1, -1)
		f = 0
		for i in range(1, n):
			if a[i] != a[f]:
				s = i
				break
		ans = []
		for i in range(n):
			if a[i] != a[f]:
				ans.append((i + 1, f + 1))
				continue
			if a[i] != a[s]:
				ans.append((i + 1, s + 1))
				continue
		print('YES')
		for (x, y) in ans:
			if x == f + 1 and y == s + 1:
				continue
			print('%d %d' % (x, y))
main()


for k in range(int(input())):
	N = int(input())
	A = [int(i) for i in input().split(' ')]
	m = max(A)
	if A.count(m) == N:
		print('NO')
	else:
		print('YES')
		second_index = 0
		for i in range(N):
			if A[0] != A[i]:
				second_index = i
				break
		for i in range(1, N):
			if A[0] != A[i]:
				print(1, i + 1)
		for i in range(1, N):
			if A[i] == A[0]:
				print(i + 1, second_index + 1)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	ind = -1
	for i in range(n):
		if arr[i] != arr[0]:
			ind = i
			break
	if ind == -1:
		print('NO')
	else:
		print('YES')
		for i in range(1, n):
			if arr[i] != arr[0]:
				print(1, i + 1)
			else:
				print(ind + 1, i + 1)


from collections import defaultdict

def ans(a):
	if len(set(a)) == 1:
		print('NO')
		return
	print('YES')
	(temp, id) = ([], None)
	for i in range(1, n):
		if a[i] != a[0]:
			print(1, i + 1)
			if id is None:
				id = i + 1
		else:
			temp.append(i + 1)
	for x in temp:
		print(id, x)
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	ans(a)


for _ in range(int(input())):
	a = int(input())
	b = list(map(int, input().split()))
	if b.count(b[0]) == len(b):
		print('NO')
	else:
		print('YES')
		b = list(enumerate(b, 1))
		for k in b[1:len(b)]:
			if b[0][1] == k[1]:
				b.remove(k)
				b.append(k)
		for jj in b[1:len(b)]:
			if b[0][1] != jj[1]:
				print(b[0][0], end=' ')
				print(jj[0])
				continue
			else:
				print(b[1][0], end=' ')
				print(jj[0])


for s in [*open(0)][2::2]:
	l = list(map(int, s.split()))
	a = []
	x = y = 1
	for i in range(1, len(l)):
		if l[x - 1] != l[i]:
			y = i + 1
	for i in range(1, len(l)):
		if l[i] != l[x - 1]:
			a.append([x, i + 1])
		elif l[i] != l[y - 1]:
			a.append([y, i + 1])
	print('YNEOS'[len(a) < 1::2])
	for i in a:
		print(*i)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def RL():
	return map(int, sys.stdin.readline().rstrip().split())

def RLL():
	return list(map(int, sys.stdin.readline().rstrip().split()))

def N():
	return int(input())

def print_list(l):
	print(' '.join(map(str, l)))
from collections import defaultdict as dc
for _ in range(N()):
	n = int(input()) + 1
	a = [0] + RLL()
	dic = dc(list)
	for i in range(1, n):
		dic[a[i]].append(i)
	bangs = list(dic.keys())
	if len(bangs) == 1:
		print('NO')
	else:
		print('YES')
		for i in range(1, len(bangs)):
			for v in dic[bangs[i]]:
				print(dic[bangs[i - 1]][0], v)
		for v in dic[bangs[0]][1:]:
			print(dic[bangs[-1]][0], v)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	c = {}
	for (j, i) in enumerate(a):
		c[i] = c.get(i, []) + [j + 1]
	x = list(c.values())
	if len(x) == 1:
		print('NO')
		continue
	print('YES')
	s = x[0].pop(0)
	for i in x[1]:
		print(s, i)
	for i in range(len(x)):
		if i == 1:
			continue
		for j in x[i]:
			print(x[1][0], j)


for i in range(int(input())):
	n = int(input())
	lst = [int(i) for i in input().split()]
	gang1 = lst[0]
	gang2 = 0
	rem = []
	if len(set(lst)) == 1:
		print('NO')
	else:
		print('YES')
		for (ind, j) in enumerate(lst[1:]):
			ind += 2
			if gang1 != j:
				print(1, ind)
				if gang2 == 0:
					gang2 = j
					numgang2 = ind
			elif gang2 == 0:
				rem += [ind]
			else:
				print(numgang2, ind)
	if len(rem) != 0:
		for j in rem:
			print(numgang2, j)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	c = a[0]
	f = False
	d = 0
	for i in range(1, n):
		if a[i] != c:
			if f == False:
				print('YES')
				f = True
				d = i
			print(1, i + 1)
	if f == False:
		print('NO')
		continue
	for i in range(1, n):
		if a[i] == c:
			print(d + 1, i + 1)


t = int(input())
for ii in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	num = a[0]
	can = False
	for i in a:
		if i != num:
			can = True
			break
	if not can:
		print('NO')
		continue
	print('YES')
	types = set(a)
	t1 = types.pop()
	t2 = types.pop()
	roads = []
	firstindex = None
	secindex = None
	for i in range(n):
		if a[i] == t1 and firstindex is None:
			firstindex = i
		if a[i] == t2 and secindex is None:
			secindex = i
	for i in range(n):
		if a[i] != t1:
			roads.append((firstindex, i))
		elif i != firstindex:
			roads.append((secindex, i))
	for i in roads:
		print(i[0] + 1, i[1] + 1)


from collections import deque
for _ in range(int(input())):
	f = input()
	li = list(map(int, input().split()))
	visited = [False] * len(li)
	n = len(li) - 1
	k = deque()
	k.append(0)
	visited[0] = True
	f = []
	while n and len(k):
		key = k.popleft()
		for i in range(len(li)):
			if visited[i] == False and li[key] != li[i]:
				k.append(i)
				f.append((key + 1, i + 1))
				visited[i] = True
				n -= 1
	if n == 0:
		print('YES')
		for i in f:
			print(*i)
	else:
		print('NO')


from collections import Counter
from math import ceil

def main():
	for _ in range(int(input())):
		n = int(input())
		a = list(map(int, input().split()))
		d = dict(Counter(a))
		b = list(enumerate(a))
		b.sort(key=lambda x: (-d[x[1]], x[1]))
		(w, i, j) = ([0] * n, 0, -1)
		if a.count(b[0][1]) != n:
			print('YES')
			k = 0
			while k < n - 1 and b[i][1] != b[j][1]:
				print(1 + b[i][0], 1 + b[j][0])
				i += 1
				k += 1
			j -= 1
			while k < n - 1:
				print(1 + b[i - 1][0], 1 + b[j][0])
				j -= 1
				k += 1
		else:
			print('NO')
main()


for _ in range(int(input())):
	n = int(input())
	d = 0
	m = []
	v = [0] * n
	flag = 0
	a = [int(x) for x in input().split()]
	c = a[0]
	for i in range(1, n):
		if a[i] != c:
			v[i] = 1
			m.append([0, i])
			if flag == 0:
				flag = 1
				d = i
	for i in range(1, n):
		if v[i] == 0:
			m.append([d, i])
	if len(set(a)) != 1:
		print('YES')
		for i in range(n - 1):
			print(m[i][0] + 1, m[i][1] + 1)
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	arr = [int(i) for i in input().split()]
	if len(set(arr)) == 1:
		print('NO')
	else:
		print('YES')
		rems = []
		for i in range(1, n):
			if arr[i] != arr[0]:
				print(1, i + 1)
				x = i + 1
			else:
				rems.append(i + 1)
		for i in rems:
			print(x, i)


import sys
input = sys.stdin.readline

def solve():
	n = int(input())
	L = list(map(int, input().split()))
	v = len(set(L))
	if v == 1:
		print('NO')
		return
	if v == n:
		print('YES')
		for i in range(n - 1):
			print(1, i + 2)
		return
	ans = []
	val = L[0]
	for i in range(1, n):
		if L[i] != L[0]:
			ans.append([1, i + 1])
		else:
			for j in range(1, n):
				if L[j] != L[0]:
					break
			ans.append([i + 1, j + 1])
	print('YES')
	for i in ans:
		print(*i)
for _ in range(int(input())):
	solve()


import math
import sys, bisect
from heapq import *
from itertools import *
from collections import *
sys.setrecursionlimit(10 ** 6)
I = lambda : int(sys.stdin.readline())
neo = lambda : map(int, sys.stdin.readline().split())
Neo = lambda : list(map(int, sys.stdin.readline().split()))
for _ in range(I()):
	n = I()
	A = Neo()
	if len(set(A)) == 1:
		print('NO')
	else:
		print('YES')
		B = []
		for i in range(1, n):
			if A[i] != A[0]:
				print(1, i + 1)
				t = i + 1
			else:
				B += [i + 1]
		for i in B:
			print(t, i)


t = int(input())
for _ in range(t):
	n = int(input())
	dis = [int(i) for i in input().split()]
	disCount = {}
	for (i, d) in enumerate(dis):
		l = disCount.get(d, [])
		l.append(i)
		disCount[d] = l
	if len(list(disCount.keys())) == 1:
		print('NO')
		continue
	pos = list(disCount.keys())
	a = disCount[pos[0]].pop()
	b = disCount[pos[1]].pop()
	print('YES')
	print('%d %d' % (a + 1, b + 1))
	for d in disCount[pos[0]]:
		print('%d %d' % (b + 1, d + 1))
	for d in disCount[pos[1]]:
		print('%d %d' % (a + 1, d + 1))
	for j in range(2, len(pos)):
		for d in disCount[pos[j]]:
			print('%d %d' % (a + 1, d + 1))


from heapq import heappush, heappop, heapify
from collections import deque, defaultdict

def solve(n, arr):
	d = defaultdict(list)
	for (i, x) in enumerate(arr):
		d[x].append(i + 1)
	if len(d) < 2:
		return None
	p = None
	res = []
	for (k, v) in d.items():
		if p is None:
			p = v.pop()
			continue
		for i in range(len(v)):
			res.append((p, v[i]))
		p = v[0]
	(k, v) = next(iter(d.items()))
	for i in range(len(v)):
		res.append((p, v[i]))
	return res
t = int(input())
while t:
	n = int(input())
	arr = list(map(int, input().split()))
	res = solve(n, arr)
	if res is None:
		print('NO')
	else:
		print('YES')
		for (a, b) in res:
			print(a, b)
	t -= 1


import sys
import math

def II():
	return int(sys.stdin.readline())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def MI():
	return map(int, sys.stdin.readline().split())

def SI():
	return sys.stdin.readline().strip()
t = II()
for q in range(t):
	n = II()
	a = LI()
	if len(set(a)) == 1:
		print('NO')
	else:
		b = sorted(list(set(a)))
		l = len(b)
		d = {}
		for i in range(len(b)):
			d[b[i]] = i
		dp = [[] for i in range(l)]
		ans = []
		for i in range(n):
			dp[d[a[i]]].append(i)
		for i in range(1, l):
			x = dp[i - 1].pop()
			for j in dp[i]:
				ans.append([j + 1, x + 1])
		x = dp[-1].pop()
		for j in dp[0]:
			ans.append([x + 1, j + 1])
		print('YES')
		for i in ans:
			print(*i)


a = int(input())
for i in range(0, a):
	t = int(input())
	arr = list(map(int, input().split()))
	s = set(arr)
	d = dict()
	for i in s:
		d[i] = 0
	for i in arr:
		d[i] = d[i] + 1
	count = []
	minc = 0
	for i in d.keys():
		count.append(d[i])
	count.sort()
	minn = count[0]
	for i in d.keys():
		if d[i] == minn:
			minc = i
			break
	ind = []
	indm = []
	for i in range(0, len(arr)):
		if arr[i] == minc:
			indm.append(i + 1)
		else:
			ind.append(i + 1)
	if len(s) == 1:
		print('NO')
	else:
		print('YES')
		for i in ind:
			print(i, indm[0])
		for i in range(1, len(indm)):
			print(indm[i], ind[0])


import math
import sys
import collections
import bisect
input = sys.stdin.readline
flush = sys.stdout.flush
readint = lambda : int(input())
readintm = lambda : map(int, input().strip().split())
readintl = lambda : list(map(int, input().strip().split()))
readfloatm = lambda : map(float, input().strip().split())
readfloatl = lambda : list(map(float, input().strip().split()))
readstr = lambda : input().strip()
readstrl = lambda : list(input().strip())
join = lambda x, l: x.join(map(str, l))
print = lambda *x: sys.stdout.write(' '.join(map(str, x)) + '\n')
printl = lambda l: sys.stdout.write(' '.join(map(str, l)) + '\n')
ceil = lambda x, y: (x + y - 1) // y
mod = 1000000007
for _ in range(readint()):
	n = readint()
	nums = readintl()
	a = nums[0]
	ai = 1
	b = None
	bi = None
	for (i, num) in enumerate(nums):
		if num != a:
			b = num
			bi = i + 1
			break
	if b:
		print('YES')
		print(f'{ai} {bi}')
		for i in range(n):
			if i + 1 != ai and i + 1 != bi:
				if nums[i] != a:
					print(f'{ai} {i + 1}')
				else:
					print(f'{bi} {i + 1}')
	else:
		print('NO')


import collections
T = int(input())
while T > 0:
	n = int(input())
	arr = list(map(int, input().split()))
	dic = collections.defaultdict(list)
	for i in range(n):
		dic[arr[i]].append(i + 1)
	if len(dic) == 1:
		print('NO')
	else:
		print('YES')
		first = -1
		gang = arr[0]
		for key in dic.keys():
			if gang == key:
				continue
			for en in dic[key]:
				if first == -1:
					first = en
				print('1 ' + str(en))
		for en in dic[gang]:
			if en == 1:
				continue
			print(str(first) + ' ' + str(en))
	T -= 1


import io
import os
from collections import Counter, defaultdict, deque

def solve(N, A):

	def getNbr(u):
		for v in range(N):
			if A[v] != A[u]:
				yield v
	source = 0
	q = deque([source])
	parent = {source: None}
	while q:
		node = q.popleft()
		for nbr in getNbr(node):
			if nbr not in parent:
				q.append(nbr)
				parent[nbr] = node
	if len(parent) != N:
		return 'NO'
	ans = []
	for (k, v) in parent.items():
		if v is not None:
			ans.append(str(k + 1) + ' ' + str(v + 1))
	return 'YES\n' + '\n'.join(ans)
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
TC = int(input())
for tc in range(1, TC + 1):
	(N,) = [int(x) for x in input().split()]
	A = [int(x) for x in input().split()]
	ans = solve(N, A)
	print(ans)


t = int(input())
while t:
	n = int(input())
	arr = list(map(int, input().split()))
	ans = []
	pair = {}
	flag = [0] * n
	for i in range(n):
		if flag[i] == 0:
			flag[i] = 1
			for j in range(n):
				if arr[i] != arr[j]:
					flag[j] = 1
					(a, b) = (min(i, j), max(i, j))
					ans.append((a, b))
					break
	if len(ans) == n - 1:
		print('YES')
		for i in ans:
			print(i[0] + 1, i[1] + 1)
	else:
		print('NO')
	t -= 1


t = int(input())
for tc in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	b = [i for i in range(1, n) if a[i] != a[0]]
	if len(b) == 0:
		print('NO')
	else:
		print('YES')
		for i in range(1, n):
			print(i + 1, 1 if a[i] != a[0] else b[0] + 1)


def modinv(n, p):
	return pow(n, p - 2, p)

def main():
	for case in range(int(input())):
		n = int(input())
		arr = [int(x) for x in input().split()]
		if len(set(arr)) == 1:
			print('NO')
			continue
		print('YES')
		dists = []
		for i in range(n):
			dists.append([arr[i], i + 1])
		dists.sort()
		print(dists[0][1], dists[n - 1][1])
		for i in range(1, n - 1):
			if dists[0][0] != dists[i][0]:
				print(dists[0][1], dists[i][1])
			else:
				print(dists[n - 1][1], dists[i][1])
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
import os, sys
from io import IOBase, BytesIO
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.getvalue())
			(self.truncate(0), self.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			self.write = lambda s: self.buffer.write(s.encode('ascii'))
			self.read = lambda : self.buffer.read().decode('ascii')
			self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


caseNum = int(input())
for zl in range(caseNum):
	length = int(input())
	vector = list(map(int, input().split()))
	ans = []
	dic = {}
	for (p, i) in enumerate(vector):
		dic.setdefault(i, []).append(p)
	resorted = sorted(dic.items())
	if len(resorted) > 1:
		for i in resorted[0][1][1:]:
			ans.append((i + 1, resorted[-1][1][0] + 1))
	for (p, i) in enumerate(resorted[1:]):
		for j in i[1]:
			ans.append((resorted[p][1][0] + 1, j + 1))
	if len(ans) == length - 1:
		print('YES')
		for k in ans:
			print(*k)
	else:
		print('NO')


from sys import stdin
for _ in range(int(stdin.readline())):
	l = int(stdin.readline())
	a = list(map(int, stdin.readline().split()))
	first = a[0]
	fidx = 1
	sidx = 0
	second = 0
	for i in range(l):
		if a[i] != first:
			sidx = i + 1
			second = a[i]
			break
	if sidx == 0:
		print('NO')
		continue
	else:
		print('YES')
		print(fidx, sidx)
		for i in range(l):
			if i + 1 == sidx or i + 1 == fidx:
				continue
			if a[i] != first:
				print(fidx, i + 1)
			else:
				print(sidx, i + 1)


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	s = set(l)
	if len(s) == 1:
		print('NO')
	else:
		print('YES')
		x = min(l)
		x_pos = l.index(x)
		y = max(l)
		y_pos = l.index(y)
		for i in range(n):
			if i == x_pos:
				continue
			if l[i] == x:
				print(i + 1, y_pos + 1)
			else:
				print(i + 1, x_pos + 1)


for _ in range(int(input())):
	n = int(input())
	x = list(map(int, input().split()))
	y = []
	if len(set(x)) == 1:
		print('NO')
		continue
	print('YES')
	j = 1
	while x[j] == x[0]:
		j += 1
	for i in range(1, n):
		if x[i] == x[0]:
			print(i + 1, j + 1)
		else:
			print(1, i + 1)


from collections import defaultdict
import math

def getEdges(hoods, gangs):
	edges = []
	visited = []
	visited_gang = []
	for gang in hoods:
		visited.append(hoods[gang][0])
		visited_gang.append(gang)
	for i in range(len(visited) - 1):
		edges.append([visited[i], visited[i + 1]])
	for (i, gang) in enumerate(gangs):
		if i + 1 not in visited:
			visited.append(i + 1)
			visited_gang.append(gang)
			if gang != visited_gang[0]:
				edges.append([visited[0], i + 1])
			else:
				edges.append([visited[1], i + 1])
	return edges

def solve(colors, n):
	hoods = defaultdict(list)
	for i in range(n):
		hoods[colors[i]].append(i + 1)
	if len(hoods) == 1:
		return (False, None)
	else:
		edges = getEdges(hoods, colors)
		return (True, edges)

def print_edges(edges):
	for edge in edges:
		print(str(edge[0]) + ' ' + str(edge[1]))

def main():
	t = int(input())
	for _ in range(t):
		num_districts = int(input())
		gang = [int(a) for a in input().split()]
		assert len(gang) == num_districts
		(possible, roads) = solve(gang, num_districts)
		if not possible:
			print('NO')
		else:
			print('YES')
			print_edges(roads)
main()


import math
import collections
t = int(input())
for w in range(t):
	n = int(input())
	l = [int(i) for i in input().split()]
	s = set(l)
	if len(s) == 1:
		print('NO')
	else:
		print('YES')
		d = collections.Counter(l)
		for i in range(1, n):
			if l[i] != l[0]:
				print(1, i + 1)
				l[i] = -1
		k = l.index(-1)
		for i in range(1, n):
			if l[i] == l[0]:
				print(i + 1, k + 1)


from collections import defaultdict as dd, deque as dq, Counter as c
from math import factorial as f, ceil, gcd, sqrt
for _ in range(int(input())):
	a = int(input())
	b = list(map(int, input().split()))
	d = dd(lambda : [])
	for i in range(a):
		d[b[i]].append(i + 1)
	r = list(d.values())
	if len(r) == 1:
		print('NO')
	else:
		r.sort(key=lambda i: len(i))
		r.reverse()
		k = r[-1][0]
		q = r[0][0]
		print('YES')
		for i in range(len(r) - 1):
			while r[i]:
				print(k, r[i].pop())
		while len(r[-1]) > 1:
			print(q, r[-1].pop())


for _ in range(int(input())):
	n = int(input())
	a = [*map(int, input().split())]
	if a.count(a[0]) == n:
		print('NO')
		continue
	print('YES')
	other = 0
	for i in range(1, n):
		if a[i] != a[0]:
			print(1, i + 1)
			other = i + 1
	for i in range(1, n):
		if a[i] == a[0]:
			print(other, i + 1)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	val = l[0]
	s = set(l)
	if len(s) == 1:
		print('NO')
	else:
		k = []
		o = -1
		print('YES')
		for i in range(1, n):
			if l[i] == val:
				k.append(i + 1)
			else:
				o = i + 1
				print(1, i + 1)
		for i in k:
			print(o, i)


from sys import stdin, stdout
import math
from collections import deque
input = stdin.readline

def print(*args, end='\n'):
	s = []
	for i in args:
		s.append(str(i) + ' ')
	s = ''.join(s)
	stdout.write(s + end)

def solve():
	n = int(input())
	l = list(map(int, input().split()))
	if len(set(l)) == 1:
		print('NO')
	else:
		print('YES')
		j = 0
		for p in range(1, n):
			if l[p] != l[0]:
				j = p
				break
		print(1, j + 1)
		for i in range(1, n):
			if i != j:
				if l[i] == l[0]:
					print(i + 1, j + 1)
				else:
					print(1, i + 1)
tt = 1
tt = int(input())
for __ in range(tt):
	solve()


from collections import *
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	if len(set(l)) == 1:
		print('NO')
	else:
		print('YES')
		rest = []
		fst = 0
		for i in range(1, n):
			if l[i] != l[0]:
				if not fst:
					fst = i + 1
				print(1, i + 1)
			else:
				rest.append(i + 1)
		for i in rest:
			print(fst, i)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	vis = set()
	vis.add(0)
	if len(set(a)) == 1:
		print('NO')
		continue
	edg = []
	ed = -1
	for i in range(1, n):
		if a[0] != a[i]:
			ed = i
			edg.append([1, i + 1])
	print('YES')
	for i in range(1, n):
		if a[0] == a[i]:
			edg.append([ed + 1, i + 1])
	for i in edg:
		print(*i)


for __ in range(int(input())):
	n = int(input())
	ar = list(map(int, input().split()))
	ans = []
	num = 0
	for i in range(1, n):
		if ar[i] != ar[0]:
			num = i
			ans.append([1, i + 1])
	if len(ans) == 0:
		print('NO')
	else:
		for i in range(1, n):
			if ar[i] == ar[0]:
				ans.append([num + 1, i + 1])
		print('YES')
		for elem in ans:
			print(*elem)


t = int(input())
for _ in range(t):
	n = int(input())
	A = list(map(int, input().split()))
	g = [[] for _ in range(n)]
	for i in range(n - 1):
		for j in range(i + 1, n):
			if A[i] != A[j]:
				g[i].append(j)
				g[j].append(i)
	s = []
	s.append(0)
	visit = [-1] * n
	visit[0] = 0
	ans = []
	while s:
		v = s.pop()
		for u in g[v]:
			if visit[u] == -1:
				ans.append((u + 1, v + 1))
				s.append(u)
				visit[u] = 0
	for i in range(n):
		if visit[i] == -1:
			print('NO')
			break
	else:
		print('YES')
		for i in range(len(ans)):
			print(*ans[i])


for _ in range(int(input())):
	n = int(input())
	gangs = list(map(int, input().split()))
	same = []
	first = gangs[0]
	s = set(gangs)
	if len(s) == 1:
		print('NO')
	else:
		flag = 0
		print('YES')
		for i in range(1, n):
			if first == gangs[i]:
				same.append(i + 1)
			else:
				flag = i + 1
				print(1, i + 1)
		for i in same:
			print(flag, i)


def solve():
	n = int(input())
	a = list(map(int, input().split()))
	inds = {}
	ind_a = []
	for i in range(n):
		if a[i] not in inds:
			inds[a[i]] = []
			ind_a.append(a[i])
		inds[a[i]].append(i + 1)
	if len(ind_a) == 1:
		print('NO')
		return
	print('YES')
	for i in range(1, len(ind_a)):
		for ind in inds[ind_a[i]]:
			print(inds[ind_a[0]][0], ind)
	for i in range(1, len(inds[ind_a[0]])):
		print(inds[ind_a[0]][i], inds[ind_a[1]][0])
for _ in range(int(input())):
	solve()


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	a = []
	if l.count(l[0]) == n:
		print('NO')
	else:
		print('YES')
		for i in range(1, n):
			if l[i] != l[0]:
				print('1', i + 1)
				x = i + 1
			else:
				a.append(i + 1)
		for v in a:
			print(x, v)


from sys import stdin, stdout

class SOLVE:

	def solve(self):
		R = stdin.readline
		W = stdout.write
		ans = []
		for i in range(int(R())):
			n = int(R())
			a = [int(x) for x in R().split()]
			if len(set(a)) == 1:
				ans.append('NO')
			else:
				mx_pos = mn_pos = None
				(mn, mx) = (10 ** 9, 1)
				for j in range(n):
					if a[j] < mn:
						mn = a[j]
						mn_pos = j + 1
					if a[j] > mx:
						mx = a[j]
						mx_pos = j + 1
				flg = 0
				ans.append('YES')
				for j in range(n):
					if a[j] != mn:
						ans.append('{} {}'.format(mn_pos, j + 1))
					elif flg:
						ans.append('{} {}'.format(mx_pos, j + 1))
					else:
						flg = 1
		W('\n'.join(ans))
		return 0

def main():
	s = SOLVE()
	s.solve()
main()


cases = int(input())
respuestas = list()
for _ in range(cases):
	conexiones = list()
	size = int(input())
	nodos = input()
	nodos = nodos.split(' ')
	nodos = list(nodos)
	diferente = -1
	to_do = list()
	for n in range(len(nodos[1:])):
		if nodos[0] != nodos[n + 1]:
			conexiones.append(f'1 {n + 2}')
			diferente = n + 2
		elif diferente != -1:
			conexiones.append(f'{diferente} {n + 2}')
		else:
			to_do.append(n + 2)
	if diferente != -1:
		for m in range(len(to_do)):
			conexiones.append(f'{diferente} {to_do[m]}')
		respuestas.append(('YES', conexiones))
	else:
		respuestas.append(('NO', conexiones))
for j in range(len(respuestas)):
	if respuestas[j][0] == 'YES':
		coordenadas = list(respuestas[j][1])
		print('YES')
		for m in range(len(coordenadas)):
			print(coordenadas[m])
	else:
		print('NO')


t = int(input())
for tn in range(1, t + 1):
	n = int(input())
	a = list(map(int, input().split()))
	lsa = list(set(a))
	if len(lsa) == 1:
		print('NO')
	else:
		print('YES')
		pc = 0
		stack = []
		st = -1
		for i in range(1, n):
			if a[0] != a[i]:
				print(1, i + 1)
				pc = pc + 1
				st = i + 1
				continue
			stack.append(i + 1)
		while pc != n - 1:
			print(st, stack.pop())
			pc = pc + 1


MOD = 1000000007
from collections import defaultdict as dd, Counter, deque

def si():
	return input()

def ii():
	return int(input())

def li():
	return list(map(int, input().split()))

def mi():
	return map(int, input().split())

def out(v):
	print(v)

def spout():
	print(v, end=' ')

def d2b(n):
	return bin(n).replace('0b', '')

def twod(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def vow():
	return ['a', 'e', 'i', 'o', 'u']

def let():
	return [chr(i) for i in range(97, 123)]

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def ispow2(x):
	return x and (not x & x - 1)

def prime_factors(n):
	i = 2
	factors = []
	while i * i <= n:
		if n % i:
			i += 1
		else:
			n //= i
			factors.append(i)
	if n > 1:
		factors.append(n)
	return list(factors)
t = ii()
while t:
	t -= 1
	n = ii()
	a = li()
	d = dd(list)
	for i in range(n):
		d[a[i]].append(i)
	if len(d) == 1:
		print('NO')
	else:
		print('YES')
		vill = list(d.keys())
		for i in range(1, len(vill)):
			for j in range(len(d[vill[i]])):
				print(d[vill[0]][0] + 1, d[vill[i]][j] + 1)
		if len(d[vill[0]]) > 1:
			for i in range(1, len(d[vill[0]])):
				print(d[vill[0]][i] + 1, d[vill[1]][0] + 1)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	answer = []
	idx = -1
	for i in range(n):
		if a[i] != a[0]:
			idx = i
			answer.append((1, i + 1))
	if idx == -1:
		print('NO')
		continue
	print('YES')
	for i in range(1, n):
		if a[i] == a[0]:
			answer.append((i + 1, idx + 1))
	for (u, v) in answer:
		print(u, v)


import sys
from os import path
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
else:
	input = sys.stdin.readline
for t_c_ in range(int(input())):
	n = int(input())
	ar = [int(x) for x in input().split()]
	ans = []
	left = []
	if max(ar) == min(ar):
		print('NO')
		continue
	diff = 0
	for i in range(1, n):
		if ar[i] != ar[0]:
			diff = i
			ans.append((0, i))
		else:
			left.append(i)
	for i in range(len(left)):
		ans.append((diff, left[i]))
	print('YES')
	for (i, j) in ans:
		print(i + 1, j + 1)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	queue = []
	roads = []
	root = 1
	connected = {1}
	while True:
		for i in range(0, n):
			if l[root - 1] == l[i]:
				continue
			elif i + 1 not in connected:
				roads.append((root, i + 1))
				queue.append(i + 1)
				connected.add(i + 1)
		if len(queue) == 0 or len(connected) == n:
			break
		root = queue.pop(0)
	if len(roads) == 0:
		print('NO')
	else:
		print('YES')
		for (i, j) in roads:
			print(i, j)


t = int(input())
while t:
	n = int(input())
	a = list(map(int, input().split()))
	d = {}
	for i in range(n):
		if a[i] in d:
			d[a[i]].append(i + 1)
		else:
			d[a[i]] = [i + 1]
	if len(d) == 1:
		print('NO')
	else:
		print('YES')
		l = list(d.keys())
		for i in range(len(l) - 1):
			list1 = d[l[i]]
			list2 = d[l[i + 1]]
			if i == 0:
				for j in range(len(list1)):
					print(list1[j], list2[0])
			else:
				print(list1[0], list2[0])
			for j in range(1, len(list2)):
				print(list2[j], list1[0])
	t -= 1


t = int(input())
for you in range(t):
	n = int(input())
	l = input().split()
	li = [int(i) for i in l]
	poss = 0
	for i in li:
		if i != li[0]:
			poss = 1
			break
	if poss == 0:
		print('NO')
		continue
	hashi = dict()
	print('YES')
	for i in range(n):
		if li[i] in hashi:
			hashi[li[i]].append(i)
		else:
			hashi[li[i]] = [i]
	done = 0
	for i in hashi:
		if done == 0:
			sp = i
		else:
			if done == 1:
				sp2 = i
			for j in hashi[i]:
				print(hashi[sp][0] + 1, j + 1)
		done += 1
	for k in hashi[sp]:
		if k == hashi[sp][0]:
			continue
		print(k + 1, hashi[sp2][0] + 1)


for _ in range(int(input())):
	(n, values) = (int(input()), [int(i) for i in input().split()])
	if len(set(values)) == 1:
		print('NO')
	else:
		print('YES')
		first = 0
		for i in range(n):
			if values[i] != values[0]:
				second = i
				break
		print(first + 1, second + 1)
		for i in range(n):
			if i != first and i != second:
				if values[i] != values[0]:
					print(first + 1, i + 1)
				else:
					print(second + 1, i + 1)


t = int(input())
for _ in range(t):
	n = int(input())
	a = input().split()
	b = set(a)
	if len(b) == 1:
		print('NO')
		continue
	p1 = b.pop()
	p2 = b.pop()
	n1 = a.index(p1)
	n2 = a.index(p2)
	print('YES')
	for p in range(n):
		if p == n2:
			continue
		if a[p] != p1:
			print(n1 + 1, p + 1)
		else:
			print(n2 + 1, p + 1)


mod = 10 ** 9 + 7

def solve():
	n = int(input())
	a = list(map(int, input().split()))
	f = a[0]
	s = -1
	id = -1
	for i in range(n):
		if a[i] != f:
			s = a[i]
			id = i + 1
			break
	if s == -1:
		print('NO')
	else:
		print('YES')
		for i in range(1, n):
			if a[i] == f:
				print(id, i + 1)
			else:
				print(1, i + 1)
t = 1
t = int(input())
while t > 0:
	solve()
	t -= 1


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	if len(set(a)) == 1:
		print('NO')
		continue
	else:
		temp = a[0]
		yo = 1
		print('YES')
		for i in range(n):
			if a[i] != temp:
				yo2 = i + 1
				temp2 = a[i]
				break
		for i in range(1, n):
			if a[i] != temp:
				print(1, i + 1)
			else:
				print(yo2, i + 1)


import math
for _ in range(int(input())):
	n = int(input())
	ar = list(map(int, input().split()))
	ans = []
	if len(list(set(ar))) == 1:
		print('NO')
	else:
		print('YES')
		c1 = ar[0]
		c2 = -1
		for i in range(1, n):
			if ar[i] != c1:
				print(1, i + 1)
				c2 = i + 1
		for i in range(1, n):
			if ar[i] == c1:
				print(c2, i + 1)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = [int(i) for i in input().split()]
	lis = [[arr[i], i] for i in range(n)]
	lis.sort()
	if lis[0][0] == lis[-1][0]:
		print('NO')
	else:
		to_be_added = []
		che = lis[0][0]
		ind = -1
		for i in range(n):
			if lis[i][0] == che:
				to_be_added.append(lis[i][1])
			else:
				ind = i
				break
		edges = []
		for i in range(len(to_be_added)):
			edges.append([to_be_added[i] + 1, lis[ind][1] + 1])
		for i in range(ind + 1, n):
			edges.append([lis[i][1] + 1, lis[0][1] + 1])
		print('YES')
		for i in range(len(edges)):
			print(*edges[i])


import math as mt
import bisect
import sys
input = sys.stdin.readline
t = int(input())
import collections
import heapq
p = 10 ** 9 + 7

def ncr_util():
	inv[0] = inv[1] = 1
	fact[0] = fact[1] = 1
	for i in range(2, 300001):
		inv[i] = inv[i % p] * (p - p // i) % p
	for i in range(1, 300001):
		inv[i] = inv[i - 1] * inv[i] % p
		fact[i] = fact[i - 1] * i % p

def solve():
	d = {}
	for i in range(n):
		d[i + 1] = l[i]
	d1 = {}
	vis = {}
	for i in range(n + 1):
		vis[i] = []
	v = [0] * (n + 1)
	ans = 0
	for i in range(1, n + 1):
		for j in range(1, n + 1):
			if d[i] != d[j] and v[j] == 0:
				v[j] = 1
				v[i] = 1
				vis[i].append(j)
				ans += 1
			if ans == n - 1:
				break
		if ans == n - 1:
			break
	if ans < n - 1:
		print('NO')
	else:
		print('YES')
		for i in range(1, n + 1):
			for j in range(len(vis[i])):
				print(i, vis[i][j])
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	solve()


t = int(input())
for i in range(t):
	n = int(input())
	values = list(map(int, input().split(' ')))
	cont = False
	pos = 0
	for j in range(1, n):
		if values[0] != values[j]:
			cont = True
			pos = j
			break
	if not cont:
		print('NO')
	else:
		print('YES')
		streets = list(range(1, n))
		for j in range(len(streets)):
			street = streets.pop(0)
			if values[0] != values[street]:
				print(1, street + 1)
			else:
				streets.append(street)
		for j in range(len(streets)):
			print(pos + 1, streets[j] + 1)


t = int(input())
for _ in range(t):
	districts = int(input())
	gang_belong = list(map(int, input().split()))
	if gang_belong.count(gang_belong[0]) == districts:
		print('NO')
		continue
	print('YES')
	root_gang = gang_belong[0]
	for index in range(1, districts):
		if gang_belong[index] != root_gang:
			print(1, index + 1)
			child_gang = index + 1
	for index in range(1, districts):
		if gang_belong[index] == root_gang:
			print(child_gang, index + 1)


import sys
input = sys.stdin.buffer.readline
for _ in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	d = {}
	for i in range(n):
		if a[i] not in d:
			d[a[i]] = [i + 1]
		else:
			d[a[i]].append(i + 1)
	ans = [-1] * n
	dd = []
	for i in d:
		dd.append([])
		for j in d[i]:
			dd[-1].append(j)
	dd.sort(key=len)
	if len(dd) == 1:
		print('NO')
	else:
		print('YES')
		for i in range(1, len(dd)):
			for j in dd[i]:
				print(dd[0][0], j)
		for i in range(1, len(dd[0])):
			print(dd[0][i], dd[-1].pop())


t = int(input())
for i in range(t):
	n = int(input())
	arr = [int(x) for x in input().split()]
	if len(set(arr)) == 1:
		print('NO')
		continue
	x = arr[0]
	l = []
	print('YES')
	for i in range(1, n):
		if arr[i] == x:
			l.append(i)
		else:
			print(1, i + 1)
	for i in range(n):
		if arr[i] != x:
			y = i + 1
			break
	for i in l:
		print(i + 1, y)


n = int(input())
for _ in range(n):
	n = int(input())
	l = list(map(int, input().split()))
	if l.count(l[0]) == n:
		print('NO')
		continue
	else:
		print('YES')
		temp = []
		k = 0
		for i in range(1, n):
			if l[i] != l[0]:
				print('1', i + 1)
				k = i + 1
			else:
				temp.append(i + 1)
		for j in temp:
			print(k, j)


for test in range(int(input())):
	n = int(input())
	city = list(map(int, input().split()))
	dicti = {city[i]: i for i in range(n)}
	if len(dicti) == 1:
		print('NO')
	else:
		print('YES')
		strt = city[0]
		diff = -1
		for i in range(1, n):
			if city[i] != strt:
				diff = i + 1
				break
		for i in range(1, n):
			if city[i] != strt:
				print(1, i + 1)
			else:
				print(i + 1, diff)


def chkList(lst):
	return len(set(lst)) == 1
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	if chkList(a):
		print('NO')
	else:
		print('YES')
		d = dict()
		for i in a:
			d[i] = []
		for i in range(1, n + 1):
			d[a[i - 1]].append(i)
		count = len(d)
		taken = 0
		first = 0
		element = 0
		for key in d:
			first = d[key][0]
			taken = key
			break
		for key in d:
			if key != taken:
				element = d[key][0]
				for i in range(len(d[key])):
					print(first, ' ', d[key][i])
		if len(d[taken]) > 1:
			for i in d[taken]:
				if i != d[taken][0]:
					print(element, ' ', i)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split(' ')))
	(ans, edge) = ([], 0)
	diff = -1
	for i in range(len(a)):
		if a[i] != a[0]:
			diff = i
	for i in range(1, len(a)):
		if a[i] != a[0]:
			ans.append([1, i + 1])
			edge += 1
		elif diff != -1:
			ans.append([i + 1, diff + 1])
			edge += 1
		if edge == n - 1:
			break
	if edge == n - 1:
		print('YES')
		for i in range(n - 1):
			print(ans[i][0], ans[i][1], sep=' ')
	else:
		print('NO')


from math import *
t = int(input())
for u in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	d = dict()
	d1 = dict()
	for i in range(n):
		d[a[i]] = d.get(a[i], 0) + 1
		d1[a[i]] = list()
	mx = 0
	mxx = 0
	out1 = []
	for i in range(n):
		d1[a[i]].append(i + 1)
		if d[a[i]] > mxx:
			mxx = d[a[i]]
			mx = a[i]
	for i in range(n):
		if a[i] != mx:
			out1.append(i + 1)
	if d[mx] == n:
		print('NO')
	else:
		print('YES')
		for i in out1:
			print(d1[mx][0], i)
		for i in range(1, d[mx]):
			print(d1[mx][i], out1[0])


def solve(n):
	s = list(map(int, input().split()))
	if len(set(s)) == 1:
		print('NO')
		return
	print('YES')
	g1 = s[0]
	for i in range(1, n):
		if s[i] != g1:
			ind = i + 1
			g2 = s[i]
			break
	for i in range(1, n):
		if s[i] == g1:
			print(ind, i + 1)
		elif s[i] == g2:
			print(1, i + 1)
		else:
			print(1, i + 1)
for _ in range(int(input())):
	solve(int(input()))


for _ in range(int(input())):
	n = int(input())
	l = [int(i) for i in input().split()]
	(ans, f) = (False, False)
	for i in range(1, n):
		if l[i] != l[0]:
			ans = True
			break
	if ans:
		print('YES')
		for i in range(1, n):
			if l[0] != l[i]:
				k = i + 1
				print(1, i + 1)
		for i in range(1, n):
			if l[i] == l[0]:
				print(i + 1, k)
	else:
		print('NO')


from collections import defaultdict as dd
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	if len(set(a)) == 1:
		print('NO')
	else:
		print('YES')
		b = [0]
		c = []
		for i in range(1, n):
			if a[i] == a[0]:
				b.append(i)
			else:
				c.append(i)
		for i in range(len(c)):
			print(1, c[i] + 1)
		for j in range(1, len(b)):
			print(b[j] + 1, c[0] + 1)


for t in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	if len(set(a)) == 1:
		print('NO')
	else:
		print('YES')
		ind1 = 0
		a1 = a[0]
		for i in range(1, n):
			if a[i] != a1:
				ind2 = i
				a2 = a[i]
				break
		for i in range(1, n):
			if a[i] != a1:
				print(1, i + 1)
			else:
				print(i + 1, ind2 + 1)


from collections import defaultdict
for _ in range(int(input())):
	n = int(input())
	arr = [int(i) for i in input().split()]
	cnt = defaultdict(int)
	for i in range(n):
		cnt[arr[i]] += 1
	less = min(cnt, key=lambda x: cnt[x])
	ans = 1
	if len(cnt) == 1:
		ans = -1
	rem = []
	for i in range(n):
		if arr[i] != less:
			rem.append(i)
	have = -1
	for i in range(n):
		if arr[i] == less:
			have = i
			break
	edges = []
	for i in range(n):
		if i != have:
			if arr[i] != less:
				edges.append([i + 1, have + 1])
			elif not rem:
				ans = -1
				break
			else:
				a = rem.pop()
				edges.append([i + 1, a + 1])
	if ans != -1:
		print('YES')
		for k in edges:
			print(*k)
	else:
		print('NO')


import os
import sys
from math import *
from collections import *
from fractions import *
from heapq import *
from bisect import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
ALPHA = 'abcdefghijklmnopqrstuvwxyz/'
M = 1000000007
EPS = 1e-06

def Ceil(a, b):
	return a // b + int(a % b > 0)

def value():
	return tuple(map(int, input().split()))

def array():
	return [int(i) for i in input().split()]

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]
for _ in range(Int()):
	n = Int()
	a = array()
	if len(set(a)) == 1:
		print('NO')
	else:
		print('YES')
		key1 = 0
		for i in range(n):
			if a[i] != a[key1]:
				key2 = i
		for i in range(1, n):
			if a[i] != a[key1]:
				print(key1 + 1, i + 1)
			else:
				print(key2 + 1, i + 1)


for _ in range(int(input())):
	n = int(input())
	(*arr,) = map(int, input().split())
	if arr.count(arr[0]) == n:
		print('NO')
	else:
		print('YES')
		for i in range(1, n):
			if arr[i] != arr[0]:
				print(1, i + 1)
				other = i
		for i in range(1, n):
			if arr[i] == arr[0]:
				print(other + 1, i + 1)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	if len(set(a)) == 1:
		print('NO')
		continue
	print('YES')
	not_added = []
	elem = 0
	for i in range(1, n):
		if a[i] != a[0]:
			elem = i + 1
			print(1, i + 1)
		else:
			not_added.append(i + 1)
	for el in not_added:
		print(elem, el)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	if len(set(a)) == 1:
		print('NO')
		continue
	print('YES')
	for (i, x) in enumerate(a[1:]):
		if x != a[0]:
			print(f'1 {i + 2}')
			other_i = i + 2
			other = x
	for (i, x) in enumerate(a[1:]):
		if x == a[0]:
			print(f'{other_i} {i + 2}')


from math import *
import threading
import sys

def fact(x):
	if x == 0:
		return 1
	else:
		return x * fact(x - 1)

def lower_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] >= num:
			answer = middle
			end = middle - 1
		else:
			start = middle + 1
	return answer

def upper_bound(li, num):
	answer = -1
	start = 0
	end = len(li) - 1
	while start <= end:
		middle = (end + start) // 2
		if li[middle] <= num:
			answer = middle
			start = middle + 1
		else:
			end = middle - 1
	return answer

def abs(x):
	return x if x >= 0 else -x

def binary_search(li, val, lb, ub):
	ans = -1
	while lb <= ub:
		mid = (lb + ub) // 2
		if li[mid] > val:
			ub = mid - 1
		elif val > li[mid]:
			lb = mid + 1
		else:
			ans = mid
			break
	return ans

def kadane(x):
	sum_so_far = 0
	current_sum = 0
	for i in x:
		current_sum += i
		if current_sum < 0:
			current_sum = 0
		else:
			sum_so_far = max(sum_so_far, current_sum)
	return sum_so_far

def pref(li):
	pref_sum = [0]
	for i in li:
		pref_sum.append(pref_sum[-1] + i)
	return pref_sum

def graph(n, m):
	adj = dict()
	for i in range(1, n + 1):
		adj.setdefault(i, 0)
	for i in range(m):
		(a, b) = map(int, input().split())
		adj[a] += 1
		adj[b] += 1
	return adj

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	li = []
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	for p in range(2, len(prime)):
		if prime[p]:
			li.append(p)
	return li
INF = 1000000000.0
primes = SieveOfEratosthenes(1300000)

def fn(n):
	i = 2
	res = n - 1
	val = 0
	for i in range(int(sqrt(n)) + 1, 1, -1):
		val = i - 1 + int(ceil((n - i) / i))
		if val <= res:
			res = val
		else:
			break
	return res

def solve(a, b, c):
	dis = b ** 2 - 4 * a * c
	ans1 = (-b - sqrt(dis)) / (2 * a)
	print(int(ans1))
	return
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	if len(set(a)) == 1:
		print('NO')
	else:
		print('YES')
		(one, two) = list(set(a))[:2]
		(ind_one, ind_two) = (a.index(one), a.index(two))
		for i in range(1, n):
			if a[i] == one and i != ind_two:
				print(ind_two + 1, i + 1)
			else:
				print(ind_one + 1, i + 1)


test_cases = int(input())
for test_case in range(test_cases):
	n = int(input())
	a = list(map(int, input().split()))
	count = 1
	min = 5001
	x = 0
	z = 0
	m = 0
	v = 0
	b = a[:]
	a.sort()
	for i in range(n):
		if i != n - 1:
			if a[i] == a[i + 1]:
				count += 1
			else:
				if count < min:
					min = count
					x = i
				count = 1
		else:
			if count < min:
				min = count
				x = i
			count = 1
	if min == n:
		print('NO')
	else:
		print('YES')
		for i in range(n):
			if b[i] == a[x]:
				v = i
				break
		for i in range(n):
			if b[i] != a[x]:
				z = i
				break
		for i in range(n):
			if b[i] != a[x]:
				print(v + 1, i + 1)
			elif m == 1:
				print(z + 1, i + 1)
			else:
				m = 1


def fun(n):
	z = set(n)
	if len(z) == 1 and len(n) != 1:
		print('NO')
		return 0
	print('YES')
	a = []
	z = n[0]
	d = []
	for i in range(1, len(n)):
		if n[i] == z:
			try:
				print(i + 1, d[0])
			except:
				a.append(i + 1)
		else:
			print(1, i + 1)
			d.append(i + 1)
	for i in range(len(a)):
		print(d[0], a[i])
	return 0
y122 = int(input())
for _ in range(y122):
	z = int(input())
	n = list(map(int, input().strip().split()))
	a = fun(n)


from collections import defaultdict
T = int(input())
for _ in range(T):
	n = int(input())
	arr = list(map(int, input().split()))
	if arr.count(arr[0]) == n:
		print('NO')
	else:
		d = defaultdict(list)
		f = 1
		vis = [False] * n
		for i in range(n):
			for j in range(0, n):
				if arr[i] != arr[j] and vis[j] == False:
					vis[i] = True
					vis[j] = True
					d[i].append(j)
		print('YES')
		for i in d:
			l = d[i]
			for j in l:
				print(i + 1, j + 1)


t = int(input())
for i in range(t):
	n = int(input())
	li = [*map(int, input().split())]
	count = 0
	req = 0
	if len(set(li)) == 1:
		print('NO')
	else:
		print('YES')
		for j in range(1, n):
			if li[j] != li[0]:
				print(1, j + 1)
				count += 1
				req = j
		if count != n - 1:
			for j in range(1, n):
				if li[j] == li[0]:
					print(j + 1, req + 1)


from collections import defaultdict
for _ in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	dic = defaultdict(list)
	for i in range(n):
		dic[a[i]] += [i + 1]
	ans = {}
	if len(dic) == 1:
		print('NO')
		continue
	cur = list(dic.keys())[0]
	for i in dic.keys():
		if i == cur:
			continue
		for j in dic[i]:
			ans[dic[cur][0], j] = 1
	temp = list(dic.keys())[1]
	for i in dic[cur]:
		ans[i, dic[temp][0]] = 1
	print('YES')
	for i in ans.keys():
		print(*i)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	paired = []
	for _ in range(len(arr)):
		paired.append(False)
	allEqual = True
	temp = arr[0]
	for num in arr:
		if num != temp:
			allEqual = False
	paired[0] = True
	ans = []
	for i in range(1, len(arr)):
		if arr[i] != arr[0]:
			ans.append((0, i))
			paired[i] = True
	second = 0
	for i in range(1, len(arr)):
		if arr[i] != arr[0]:
			second = i
			break
	for i in range(1, len(arr)):
		if arr[i] != arr[second] and (not paired[i]):
			ans.append((second, i))
			paired[i] = True
	if allEqual:
		print('NO')
	else:
		print('YES')
		for ele in ans:
			print(ele[0] + 1, ele[1] + 1)


def connect_districts(districts):
	roads = []
	side_districts = []
	connection_district = None
	for d in range(1, len(districts)):
		if districts[d] != districts[0]:
			if connection_district is None:
				connection_district = d + 1
			roads.append([1, d + 1])
		else:
			side_districts.append(d + 1)
	if connection_district is not None:
		for d in side_districts:
			roads.append([connection_district, d])
	return roads
for i in range(int(input())):
	n = input()
	roads = connect_districts([int(i) for i in input().split()])
	if roads:
		print('YES')
		for r in roads:
			print(' '.join((str(d) for d in r)))
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	if len(set(l)) == 1:
		print('NO')
	else:
		print('YES')
		a = set()
		a.add(l[0])
		c = set()
		c.add(1)
		d = set()
		for i in range(1, n):
			if l[i] in a:
				c.add(i + 1)
			else:
				d.add(i + 1)
		c = list(c)
		d = list(d)
		for i in d:
			print(i, c[0])
		for i in c[1:]:
			print(i, d[0])


t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	if len(set(arr)) != 1:
		print('YES')
		a = arr[0]
		res = []
		for j in range(1, n):
			if arr[j] != a:
				b = j + 1
				print(1, j + 1)
			else:
				res.append(j + 1)
		for j in res:
			print(b, j)
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	s = set(a)
	if len(s) == 1:
		print('NO')
		continue
	print('YES')
	l = []
	r = []
	for i in range(n):
		if a[i] in l:
			pass
		else:
			l.append(a[i])
			r.append(i + 1)
			if len(r) == 2:
				break
	for i in range(1, n):
		if a[i] == l[0]:
			print(r[1], i + 1)
		else:
			print(r[0], i + 1)


import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	a = max(arr)
	b = min(arr)
	if a == b:
		print('NO')
	else:
		print('YES')
		dict1 = {}
		a = 0
		for i in range(n):
			if arr[i] not in dict1.keys():
				dict1[arr[i]] = [i + 1]
				a += 1
			else:
				dict1[arr[i]].append(i + 1)
		lis = list(dict1.keys())
		ans = []
		for i in range(a - 1):
			for j in range(len(dict1[lis[i + 1]])):
				ans.append([dict1[lis[i]][0], dict1[lis[i + 1]][j]])
		for i in range(len(dict1[lis[0]]) - 1):
			ans.append([dict1[lis[0]][i + 1], dict1[lis[1]][0]])
		for i in range(n - 1):
			print(' '.join((str(x) for x in ans[i])))


t = int(input())
while t > 0:
	n = int(input())
	a = list(map(int, input().split()))
	cnt = 0
	for i in a:
		if i == a[0]:
			cnt += 1
	if cnt == n:
		print('NO')
	else:
		print('YES')
		temp = 0
		for i in range(n):
			if a[i] != a[0]:
				temp = i
		for i in range(n):
			if i == temp:
				continue
			if a[i] == a[temp]:
				print(1, i + 1)
			else:
				print(i + 1, temp + 1)
	t -= 1


from collections import defaultdict
t = int(input())
for _ in range(t):
	n = int(input())
	l = [int(x) for x in input().split()]
	arr = []
	for i in range(n):
		arr.append([l[i], i])
	arr.sort()
	p = [0] * n
	if arr[0][0] == arr[n - 1][0]:
		print('NO')
		continue
	a = arr[0][1]
	b = arr[0][0]
	for i in range(1, n):
		if arr[i][0] != arr[i - 1][0]:
			c = arr[i][1]
			d = arr[i][0]
			break
	for i in range(n):
		if arr[i][0] == b:
			p[arr[i][1]] = c
		elif arr[i][0] == d and arr[i][1] != c:
			p[arr[i][1]] = a
		else:
			p[arr[i][1]] = c
	print('YES')
	for i in range(n):
		if i != c:
			print(i + 1, p[i] + 1)


a = int(input())
for i in range(a):
	b = int(input())
	c = list(map(int, input().split()))
	d = c[0]
	e = 0
	for j in range(1, b):
		if c[j] != d:
			e = j + 1
			break
	if not e:
		print('NO')
	else:
		print('YES')
		for j in range(1, b):
			if c[j] == d:
				print(j + 1, e)
			else:
				print(1, j + 1)


n = int(input())
for i in range(n):
	n = int(input())
	s = input()
	s1 = s.split()
	l = [int(i) for i in s1]
	start = l[0]
	temp = []
	for i in range(1, len(l)):
		if l[i] != start:
			temp.append([0, i])
	if len(temp) > 0:
		print('YES')
		start2 = temp[0][1]
		for i in range(1, len(l)):
			if l[i] == start:
				temp.append([i, start2])
		for i in temp:
			s = str(i[0] + 1) + ' ' + str(i[1] + 1)
			print(s)
	else:
		print('NO')


import sys
n = int(input())
for i in range(n):
	d = int(input())
	g = list(map(int, input().split()))
	dic = {}
	index = 0
	for j in range(1, d + 1):
		dic[j] = g[j - 1]
	if len(set(dic.values())) == 1:
		print('NO')
	else:
		for k in range(1, d):
			if g[k] != g[0]:
				print('YES')
				print(1, k + 1)
				index = k
				break
		for k in range(1, d):
			if k != index:
				if g[k] != g[0]:
					print(1, k + 1)
				else:
					print(index + 1, k + 1)
			else:
				pass


case = int(input())
for i in range(case):
	dist = int(input())
	x = [int(v) for v in input().split()]
	temp = 0
	list1 = []
	for j in range(1, dist):
		if x[j] != x[j - 1]:
			for k in range(temp + 1):
				list1.append(str(j - k) + ' ' + str(j + 1))
			temp = 0
		else:
			temp += 1
	if len(list1) == dist - 1:
		print('YES')
		for l in range(len(list1)):
			print(list1[l])
	elif temp == dist - 1:
		print('NO')
	else:
		print('YES')
		for m in range(temp):
			list1.append(str(dist - temp - 1) + ' ' + str(dist - m))
		for n in range(len(list1)):
			print(list1[n])


from collections import defaultdict as dd
t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	d = dd(list)
	for i in range(n):
		d[l[i]].append(i + 1)
	if len(d) == 1:
		print('NO')
		continue
	else:
		print('YES')
		for i in d:
			val1 = d[i]
			break
		lans = []
		root = val1[0]
		for i in d:
			if d[i] == val1:
				continue
			else:
				for k in d[i]:
					lans.append((root, k))
		rest = lans[-1][1]
		for i in val1:
			if i == root:
				continue
			else:
				lans.append((i, rest))
		for i in lans:
			print(i[0], i[1])


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().strip().split()))
	visit = {0}
	edges = set()
	for i in range(1, n):
		if arr[i] != arr[0]:
			visit.add(i)
			edges.add((1, i + 1))
	if len(edges) == 0:
		print('NO')
	else:
		print('YES')
		for i in range(1, n):
			if i not in visit:
				for v in visit:
					if arr[v] != arr[i]:
						edges.add((i + 1, v + 1))
						break
		for e in edges:
			print(*e)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	lst = []
	if a.count(a[0]) != n:
		print('YES')
		for i in range(1, n):
			if a[0] != a[i]:
				k = i + 1
				print(1, i + 1)
			else:
				lst.append(i + 1)
		for val in lst:
			print(k, val)
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	li = list(map(int, input().strip().split()))
	if len(set(li)) == 1:
		print('NO')
	else:
		print('YES')
		s = list(set(li))
		(fuc1, fuc2) = (s[0], s[1])
		(i1, i2) = (li.index(s[0]) + 1, li.index(s[1]) + 1)
		for i in range(1, n):
			if li[i] == fuc1:
				print(i2, i + 1)
			elif li[i] == fuc2:
				print(i1, i + 1)
			else:
				print(i1, i + 1)


from sys import stdin
tt = int(stdin.readline())
for loop in range(tt):
	n = int(stdin.readline())
	a = list(map(int, stdin.readline().split()))
	ind = []
	for i in range(n):
		if len(ind) == 0:
			ind.append(i)
		elif len(ind) == 1 and a[ind[0]] != a[i]:
			ind.append(i)
	if len(ind) == 1:
		print('NO')
		continue
	print('YES')
	print(ind[0] + 1, ind[1] + 1)
	for i in range(n):
		if i not in ind:
			if a[i] != a[ind[0]]:
				print(i + 1, ind[0] + 1)
			else:
				print(i + 1, ind[1] + 1)


for i in range(int(input())):
	n = int(input())
	lst = list(map(int, input().split()))
	if len(set(lst)) == 1:
		print('NO')
	else:
		fix = lst[0]
		print('YES')
		a1 = []
		a = []
		a2 = []
		for i in range(1, n):
			if lst[i] != fix:
				a.append([1, i + 1])
				a1.append(i + 1)
			else:
				a2.append(i + 1)
		for rem in a2:
			a.append([rem, a1[0]])
		for i1 in a:
			print(*i1)


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	N = int(input())
	a = list(map(int, input().split()))
	if len(set(a)) == 1:
		print('NO')
		continue
	print('YES')
	subroot = 0
	for i in range(N):
		if a[i] != a[0]:
			subroot = i
			break
	for i in range(1, N):
		if a[i] == a[0]:
			print(subroot + 1, i + 1)
		else:
			print(1, i + 1)


game = int(input())
for i in range(game):
	n = int(input())
	k = list(map(int, input().split()))
	l = [k[0]] * n
	m = []
	if k == l:
		print('NO')
	else:
		print('YES')
		for j in range(1, n):
			if k[0] != k[j]:
				print(1, j + 1)
				final = j + 1
			else:
				m.append(j + 1)
		for value in m:
			print(final, value)


from functools import reduce
import os
import sys
from collections import *
from math import *
from bisect import *
from heapq import *
from io import BytesIO, IOBase
input = lambda : sys.stdin.readline().rstrip('\r\n')

def value():
	return tuple(map(int, input().split()))

def arr():
	return [int(i) for i in input().split()]

def sarr():
	return [int(i) for i in input()]

def starr():
	return [str(x) for x in input().split()]

def inn():
	return int(input())

def svalue():
	return tuple(map(str, input().split()))

def parr():
	return [value() for i in range(n)]
mo = 1000000007
inf = 1e+18
div = 998244353
for _ in range(inn()):
	n = inn()
	a = arr()
	s = list(set(a))
	if len(set(a)) == 1:
		print('NO')
		continue
	ans = []
	(res1, res2) = (s[0], s[1])
	val1 = a.index(res1)
	val2 = a.index(res2)
	ans += [(val1 + 1, val2 + 1)]
	for i in range(n):
		if i == val1 or i == val2:
			pass
		elif a[i] != res1:
			ans += [(val1 + 1, i + 1)]
		else:
			ans += [(val2 + 1, i + 1)]
	print('YES')
	for (i, j) in ans:
		print(i, j)


import sys
from collections import defaultdict
from sys import maxsize

def ini():
	return int(sys.stdin.readline())

def inp():
	return map(int, sys.stdin.readline().strip().split())

def li():
	return list(map(int, sys.stdin.readline().strip().split()))
for _ in range(ini()):
	n = ini()
	l = li()
	if len(set(l)) == 1:
		print('NO')
		continue
	print('YES')
	d = defaultdict(list)
	c = 0
	for i in l:
		d[i] += [c]
		c += 1
	v = list(d.values())
	a = v[1][0]
	t = v[0]
	for i in range(1, len(v)):
		c = v[i - 1][0]
		for j in range(len(v[i])):
			print(c + 1, v[i][j] + 1)
	for i in range(1, len(t)):
		print(a + 1, t[i] + 1)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = [int(val) for val in input().split(' ')]
	cd = {}
	for (idx, val) in enumerate(arr, 1):
		if val in cd:
			cd[val].append(idx)
		else:
			cd[val] = [idx]
	curr_min = 1000000000000
	curr_k = -1
	for (k, v) in cd.items():
		if len(v) < curr_min:
			curr_min = len(v)
			curr_k = k
	if len(cd[curr_k]) == n:
		print('NO')
	else:
		print('YES')
		curr_v = cd[curr_k]
		counting = len(curr_v) - 1
		init = 0
		curr_list = []
		for (k, v) in cd.items():
			if k != curr_k:
				for c in v:
					print('%i %i' % (curr_v[0], c))
					if init < counting:
						curr_list.append(c)
						init += 1
		for (idx, val) in enumerate(curr_list):
			print('%i %i' % (curr_v[idx + 1], val))


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	if len(set(arr)) == 1:
		print('NO')
	else:
		rootVal = arr[0]
		secondRoot = None
		print('YES')
		for i in range(1, len(arr)):
			if arr[i] != rootVal:
				secondRoot = i
				print(1, i + 1)
		for i in range(1, len(arr)):
			if arr[i] == rootVal:
				print(i + 1, secondRoot + 1)


import sys

def input():
	return sys.stdin.readline().strip()

def list2d(a, b, c):
	return [[c for j in range(b)] for i in range(a)]

def list3d(a, b, c, d):
	return [[[d for k in range(c)] for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e):
	return [[[[e for l in range(d)] for k in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1):
	return int(-(-x // y))

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def LIST(N=None):
	return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes():
	print('Yes')

def No():
	print('No')

def YES():
	print('YES')

def NO():
	print('NO')
INF = 10 ** 19
MOD = 10 ** 9 + 7
EPS = 10 ** (-10)
for _ in range(INT()):
	N = INT()
	A = LIST()
	grp1 = A[0]
	v1 = 0
	v2 = -1
	for i in range(N):
		if A[i] != grp1:
			v2 = i
			break
	if v2 == -1:
		NO()
		continue
	ans = []
	for i in range(1, N):
		if A[i] != grp1:
			ans.append((v1 + 1, i + 1))
		else:
			ans.append((v2 + 1, i + 1))
	YES()
	for a in ans:
		print(*a)


n = int(input())
for i in range(n):
	t = int(input())
	l = list(map(int, input().split()))
	d1 = []
	d2 = []
	c = -1
	for i in range(t):
		if l[i] != l[0]:
			c = i
			d1.append(1)
			d2.append(i + 1)
	if c == -1:
		print('NO')
		continue
	for i in range(1, t):
		if l[i] == l[0]:
			d1.append(c + 1)
			d2.append(i + 1)
	print('YES')
	for i in range(len(d1)):
		print(d1[i], d2[i])


import math
t = int(input())
for _ in range(t):
	n = int(input())
	l = [int(x) for x in input().split()]
	a = l[0]
	m = []
	p = []
	b = 0
	for i in range(n):
		if l[i] == a:
			m.append(i + 1)
		else:
			p.append(i + 1)
	if len(p) == 0:
		print('NO')
	else:
		print('YES')
		for x in p:
			print(1, x)
		for y in range(1, len(m)):
			print(p[0], m[y])


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	if a.count(a[0]) == len(a):
		print('NO')
	else:
		print('YES')
		s = []
		o = []
		for i in range(n):
			if a[i] == a[0]:
				s.append(i + 1)
			else:
				o.append(i + 1)
		for i in range(1, len(s)):
			print(s[i], o[0])
		for oo in o:
			print(oo, s[0])


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import math
from collections import Counter, defaultdict, deque

def int1():
	return int(input())

def map1():
	return map(int, input().split())

def list1():
	return list(map(int, input().split()))
mod = pow(10, 9) + 7

def solve():
	n = int1()
	l1 = list1()
	s = list(set(l1))
	if len(s) == 1:
		print('NO')
	else:
		print('YES')
		for i in range(1, n):
			if l1[0] != l1[i]:
				print(1, i + 1)
				v = i + 1
		for i in range(1, n):
			if l1[0] == l1[i]:
				print(v, i + 1)
for _ in range(int(input())):
	solve()


for tt in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	if n == l.count(l[0]):
		print('NO')
		continue
	print('YES')
	fi = 0
	sec = -1
	for i in range(1, n):
		if l[i] != l[fi]:
			sec = i
			break
	for i in range(1, n):
		if l[i] != l[fi]:
			print(i + 1, fi + 1)
		else:
			print(i + 1, sec + 1)


from sys import stdin
t = int(stdin.readline().strip())

def build(arr):
	graph = {arr[0]: []}
	entry = arr[0]
	queue = []
	for i in range(1, len(arr)):
		current_node = entry
		if arr[i] != current_node:
			graph[current_node].append([arr[i], i])
			graph[arr[i]] = []
			print(1, i + 1)
		elif len(graph[current_node]) > 0:
			(value, pos) = graph[current_node][0]
			graph[value].append([arr[i], i])
			print(pos + 1, i + 1)
		else:
			queue.append([arr[i], i])
	for (val, pos) in queue:
		current_node = entry
		if val != current_node:
			graph[current_node].append([val, pos])
			graph[val] = []
			print(1, pos + 1)
		elif len(graph[current_node]) > 0:
			(cvalue, cpos) = graph[current_node][0]
			graph[cvalue].append([val, pos])
			print(cpos + 1, pos + 1)
for _ in range(t):
	n = int(stdin.readline().strip())
	arr = [int(x) for x in stdin.readline().strip().split(' ')]
	diff = set(arr)
	if len(diff) <= 1:
		print('NO')
	else:
		print('YES')
		build(arr)


import sys
t = int(sys.stdin.readline())
for _ in range(t):
	n = int(sys.stdin.readline())
	lst = list(map(int, sys.stdin.readline().split()))
	cnt = 0
	ans = []
	if len(set(lst)) < 2:
		print('NO')
		continue
	vis = set()
	vis.add(1)
	for i in range(n):
		if len(ans) == n - 1:
			break
		st = lst[i]
		for j in range(n):
			if len(ans) == n - 1:
				break
			if lst[i] != lst[j] and j + 1 not in vis:
				ans.append((i + 1, j + 1))
				vis.add(j + 1)
	if len(ans) == n - 1:
		print('YES')
		for c in ans:
			print(*c)
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	li = list(map(int, input().split()))
	index = -1
	for i in range(1, n):
		if li[i] != li[0]:
			index = i
			break
	if index == -1:
		print('NO')
	else:
		print('YES')
		other = []
		for i in range(1, n):
			if li[i] == li[0]:
				other.append(i + 1)
			elif li[i] != li[0]:
				print(1, i + 1)
		for i in other:
			print(index + 1, i)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	x = l[0]
	if len(l) == l.count(x):
		print('NO')
	else:
		print('YES')
		z = []
		for i in range(1, n):
			if l[i] != x:
				print(1, i + 1)
				y = i + 1
			else:
				z.append(i + 1)
		for i in range(len(z)):
			print(y, z[i])


import sys
from math import gcd, sqrt, ceil, log2
from collections import defaultdict, Counter, deque
from bisect import bisect_left, bisect_right
import math
import heapq
from itertools import permutations
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def get_sum(bit, i):
	s = 0
	i += 1
	while i > 0:
		s += bit[i]
		i -= i & -i
	return s

def update(bit, n, i, v):
	i += 1
	while i <= n:
		bit[i] += v
		i += i & -i

def modInverse(b, m):
	g = math.gcd(b, m)
	if g != 1:
		return -1
	else:
		return pow(b, m - 2, m)

def primeFactors(n):
	sa = set()
	sa.add(n)
	while n % 2 == 0:
		sa.add(2)
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			sa.add(i)
			n = n // i
	return sa

def seive(n):
	pri = [True] * (n + 1)
	p = 2
	while p * p <= n:
		if pri[p] == True:
			for i in range(p * p, n + 1, p):
				pri[i] = False
		p += 1
	return pri

def check_prim(n):
	if n < 0:
		return False
	for i in range(2, int(sqrt(n)) + 1):
		if n % i == 0:
			return False
	return True

def getZarr(string, z):
	n = len(string)
	(l, r, k) = (0, 0, 0)
	for i in range(1, n):
		if i > r:
			(l, r) = (i, i)
			while r < n and string[r - l] == string[r]:
				r += 1
			z[i] = r - l
			r -= 1
		else:
			k = i - l
			if z[k] < r - i + 1:
				z[i] = z[k]
			else:
				l = i
				while r < n and string[r - l] == string[r]:
					r += 1
				z[i] = r - l
				r -= 1

def search(text, pattern):
	concat = pattern + '$' + text
	l = len(concat)
	z = [0] * l
	getZarr(concat, z)
	ha = []
	for i in range(l):
		if z[i] == len(pattern):
			ha.append(i - len(pattern) - 1)
	return ha

def mergeIntervals(arr):
	arr.sort(key=lambda x: x[0])
	m = []
	s = -10000
	max = -100000
	for i in range(len(arr)):
		a = arr[i]
		if a[0] > max:
			if i != 0:
				m.append([s, max])
			max = a[1]
			s = a[0]
		elif a[1] >= max:
			max = a[1]
	if max != -100000 and [s, max] not in m:
		m.append([s, max])
	return m
t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	if len(set(l)) == 1:
		print('NO')
		continue
	print('YES')
	la = []
	ans = []
	for i in range(n):
		la.append([l[i], i])
	la.sort()
	(a, b) = la.pop(0)
	while la != [] and la[-1][0] != a:
		(c, d) = la.pop()
		ans.append((b, d))
	(a, b) = ans[-1]
	while la != []:
		(c, d) = la.pop()
		ans.append((b, d))
	for (a, b) in ans:
		print(a + 1, b + 1)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	if len(set(arr)) == 1:
		print('NO')
		continue
	else:
		for i in range(1, n):
			if arr[i] != arr[0]:
				diff = i
		edges = []
		for i in range(1, n):
			if arr[i] != arr[0]:
				edges.append([1, i + 1])
			else:
				edges.append([i + 1, diff + 1])
		print('YES')
		for i in range(n - 1):
			print(edges[i][0], edges[i][1])


t = int(input())
from collections import defaultdict as dd, deque
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	d = dd(list)
	for j in range(n):
		d[l[j]].append(j + 1)
	ans = []
	l1 = []
	for j in d:
		d[j].append(len(d[j]))
		(d[j][0], d[j][-1]) = (d[j][-1], d[j][0])
		l1.append(d[j])
	l1.sort()
	if len(l1) == 1:
		print('NO')
	else:
		j = 0
		k = 1
		a = l1[j].pop()
		b = l1[k][-1]
		for z in range(l1[k][0]):
			ans.append([a, l1[k][z + 1]])
		for z in range(l1[j][0] - 1):
			ans.append([b, l1[j][z + 1]])
		k = 2
		while k < len(l1):
			for z in range(l1[k][0]):
				ans.append([a, l1[k][z + 1]])
			k += 1
		print('YES')
		for j in ans:
			print(*j)


q = int(input())
for f in range(q):
	n = int(input())
	arr = [int(x) for x in input().split()]
	eq = True
	for x in range(n - 1):
		if arr[x] != arr[x + 1]:
			eq = False
	if eq:
		print('NO')
	else:
		print('YES')
		j = 0
		for i in range(n):
			if arr[0] != arr[i]:
				print(1, i + 1)
				j = i
		for i in range(n):
			if i == 0:
				continue
			if arr[0] == arr[i]:
				print(j + 1, i + 1)


t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	map = dict()
	for i in range(len(a)):
		if a[i] in map:
			map[a[i]].append(i + 1)
		else:
			map[a[i]] = [i + 1]
	if len(map) == 1:
		print('NO')
	else:
		print('YES')
		band = list(map.keys())
		for i in range(len(band) - 1):
			print(map[band[i]][0], map[band[i + 1]][0])
		for i in range(1, len(band)):
			for j in map[band[i]][1:]:
				print(map[band[0]][0], j)
		for j in map[band[0]][1:]:
			print(map[band[1]][0], j)


import sys, io, os, time
from collections import defaultdict
from collections import Counter
from collections import deque
from itertools import combinations
from itertools import permutations
import bisect, math, heapq
alphabet = 'abcdefghijklmnopqrstuvwxyz'
input = sys.stdin.readline
for ii in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	ans = []
	mapka = defaultdict(list)
	for i in range(n):
		mapka[arr[i]].append(i)
	ele = set(arr)
	if len(ele) == 1:
		print('NO')
		continue
	ans = []
	last = 0
	for i in range(1, n):
		if arr[0] != arr[i]:
			last = i
			ans.append([1, i + 1])
	for i in range(1, n):
		if arr[0] == arr[i]:
			ans.append([last + 1, i + 1])
	print('YES')
	for i in ans:
		print(*i)


import os
from io import BytesIO, IOBase
import sys
from collections import defaultdict, deque, Counter
from bisect import *
from math import sqrt, pi, ceil
import math
from itertools import permutations
from copy import deepcopy
from sys import setrecursionlimit

def main():
	for _ in range(int(input())):
		n = int(input())
		a = list(map(int, input().split()))
		b = set(a)
		if len(b) == 1:
			print('NO')
		else:
			print('YES')
			t = 0
			for i in range(1, n):
				if a[0] != a[i]:
					print(1, i + 1)
					t = i
			for i in range(1, n):
				if a[0] == a[i]:
					print(t + 1, i + 1)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	kk = 0
	for i in range(1, n):
		if a[i] == a[0]:
			a[i] = 0
		else:
			a[i] = 1
			kk = i
	a[0] = 0
	if kk == 0:
		print('NO')
	else:
		print('YES')
		print(1, kk + 1)
		for i in range(1, n):
			if i == kk:
				pass
			elif a[i] == 0:
				print(kk + 1, i + 1)
			else:
				print(1, i + 1)


import sys
from collections import defaultdict, Counter
t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, sys.stdin.readline().split()))
	if len(set(a)) == 1:
		print('NO')
		continue
	d = defaultdict(list)
	for j in range(n):
		d[a[j]].append(j + 1)
	l = Counter(a)
	p = min(l.values())
	for v in l:
		if l[v] == p:
			root = v
	an = []
	p = d[root][0]
	for v in d:
		if v != root:
			while len(d[v]) > 0:
				q = d[v].pop()
				an.append((p, q))
		else:
			continue
	del d[root][0]
	m = 0
	while len(d[root]) > 0:
		q = d[root].pop()
		p = an[m][1]
		an.append((p, q))
		m = m + 1
	print('YES')
	for (u, v) in an:
		print(u, v)


t = int(input())
for j in range(t):
	n = int(input())
	s = list(map(int, input().split()))
	if s.count(s[0]) == len(s):
		print('NO')
	else:
		print('YES')
		root = s[0]
		f = 0
		for i in range(1, n):
			if s[i] != root:
				if f == 0:
					r2 = i
					f = 1
				print(1, i + 1)
		for i in range(1, n):
			if s[i] == s[0]:
				print(r2 + 1, i + 1)


t = int(input())
ans = []
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	edges = []
	idx = -1
	for i in range(1, n):
		if arr[i] != arr[0]:
			idx = i
			edges.append((1, i + 1))
	if idx == -1:
		ans.append(('NO', '\n'))
		continue
	else:
		for i in range(1, n):
			if arr[i] == arr[0]:
				edges.append((idx + 1, i + 1))
		ans.append(('YES', '\n'))
		ans += edges
for (i, j) in ans:
	print(i, j)


def ans(a, n):
	if max(a) == min(a):
		print('NO')
		return
	print('YES')
	connected = [0] * n
	roads = 0
	connected[0] = 1
	j = 0
	for i in range(1, n):
		if roads == n - 1:
			break
		if a[i] != a[0]:
			connected[i] = 1
			j = i
			print(str(1) + ' ' + str(i + 1))
			roads += 1
	for i in range(1, n):
		if roads == n - 1:
			break
		if connected[i] == 0 and a[i] != a[j]:
			connected[i] = 1
			print(str(j + 1) + ' ' + str(i + 1))
	return
m = int(input())
for j in range(m):
	n = int(input())
	arr = input().split()
	a = []
	for i in arr:
		a.append(int(i))
	ans(a, n)


import sys
import math
import bisect
from sys import stdin, stdout
from math import gcd, floor, sqrt, log2, ceil
from collections import defaultdict as dd
from bisect import bisect_left as bl, bisect_right as br
from bisect import insort
from collections import Counter
from collections import deque
from heapq import heappush, heappop, heapify
from itertools import permutations, combinations
mod = int(1000000000.0) + 7
ip = lambda : int(stdin.readline())
inp = lambda : map(int, stdin.readline().split())
ips = lambda : stdin.readline().rstrip()
out = lambda x: stdout.write(str(x) + '\n')
t = ip()
for _ in range(t):
	n = ip()
	arr = list(inp())
	if len(set(arr)) == 1:
		out('NO')
	else:
		ch = list(set(arr))
		ele1 = ch[0]
		ele2 = ch[1]
		pos1 = arr.index(ele1)
		pos2 = arr.index(ele2)
		ans = []
		ans.append([pos1 + 1, pos2 + 1])
		for i in range(n):
			if i == pos1 or i == pos2:
				continue
			if arr[i] == ele1:
				ans.append([i + 1, pos2 + 1])
			else:
				ans.append([i + 1, pos1 + 1])
		out('YES')
		for i in ans:
			print(*i)


for tt in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	if len(set(a)) == 1:
		print('NO')
		continue
	print('YES')
	b = sorted([(a[i], i) for i in range(n)])
	ind = n - 1
	start = b[0][1]
	last = -1
	while b[ind][0] != b[0][0]:
		last = b[ind][1]
		print(start + 1, b[ind][1] + 1)
		ind -= 1
	while ind:
		print(b[ind][1] + 1, last + 1)
		ind -= 1


def read_int():
	return int(input())

def solve(arr):
	max_number = max(arr)
	for i in range(0, n):
		if arr[i] == max_number:
			for x in [i - 1, i + 1]:
				if 0 <= x < n and arr[i] != arr[x]:
					return i + 1
	return -1
t = read_int()
for case in range(t):
	n = read_int()
	arr = [int(i) for i in input().split(' ')]
	dict = {}
	for i in range(n):
		dict[arr[i]] = []
	for i in range(n):
		dict[arr[i]].append(i + 1)
	if len(dict) == 1:
		print('NO')
		continue
	print('YES')
	min_len = len(dict[arr[0]])
	for key in dict:
		min_len = len(dict[key]) if min_len > len(dict[key]) else min_len
	for key in dict:
		if len(dict[key]) == min_len:
			for k in dict:
				if k != key:
					for i in dict[k]:
						print(dict[key][0], i)
			idx = 1
			for k in dict:
				if k != key:
					for i in dict[k]:
						if idx < len(dict[key]):
							print(dict[key][idx], i)
							idx += 1
			break


import sys
import math
from collections import defaultdict, Counter
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	ind = 0
	for j in range(1, n):
		if a[j] != a[0]:
			ind = j + 1
			break
	if ind == 0:
		print('NO')
	else:
		print('YES')
		for j in range(1, n):
			if a[j] != a[0]:
				print(1, j + 1)
			else:
				print(ind, j + 1)


mod = 10 ** 9 + 7
INF = float('inf')

def readInts():
	return list(map(int, input().split()))

def readTuples():
	return tuple(map(int, input().split()))

def I():
	return int(input())

class UnionFind:

	def __init__(self, n):
		self.n = n
		self.parents = [-1] * n

	def find(self, x):
		if self.parents[x] < 0:
			return x
		else:
			self.parents[x] = self.find(self.parents[x])
			return self.parents[x]

	def union(self, x, y):
		x = self.find(x)
		y = self.find(y)
		if x == y:
			return
		if self.parents[x] > self.parents[y]:
			(x, y) = (y, x)
		self.parents[x] += self.parents[y]
		self.parents[y] = x

	def size(self, x):
		return -self.parents[self.find(x)]

	def same(self, x, y):
		return self.find(x) == self.find(y)

	def members(self, x):
		root = self.find(x)
		return [i for i in range(self.n) if self.find(i) == root]

	def roots(self):
		return [i for (i, x) in enumerate(self.parents) if x < 0]

	def group_count(self):
		return len(self.roots())

	def all_group_members(self):
		return {r: self.members(r) for r in self.roots()}

	def __str__(self):
		return '\n'.join(('{}: {}'.format(r, self.members(r)) for r in self.roots()))
q = I()
for _ in range(q):
	n = I()
	A = readInts()
	ans = []
	Uni = UnionFind(n)
	for i in range(n):
		for j in range(i + 1, n):
			if i == j:
				continue
			if Uni.same(i, j):
				continue
			if A[i] == A[j]:
				continue
			Uni.union(i, j)
			ans.append([i + 1, j + 1])
	if len(ans) == 0:
		print('NO')
	else:
		print('YES')
		for a in ans:
			print(*a)


t = int(input())
for i in range(t):
	B = []
	n = int(input())
	A = list(map(int, input().split()))
	if len(set(A)) == 1:
		print('NO')
	else:
		print('YES')
		a = A[0]
		b = -1
		for i in range(1, len(A)):
			if A[i] != a:
				b = i + 1
				print(1, i + 1)
			elif A[i] == a:
				B.append(i + 1)
		for j in B:
			print(b, j)


from pprint import pprint
import sys
import collections

def do():
	n = int(input())
	dat = list(map(int, input().split()))
	c = collections.Counter(dat)
	if len(c) == 1:
		print('NO')
		return
	f = dat[0]
	s = None
	sind = None
	for i in range(n):
		if dat[i] != f:
			s = dat[i]
			sind = i
			break
	print('YES')
	for i in range(1, n):
		if dat[i] == f:
			print(i + 1, sind + 1)
		else:
			print(i + 1, 1)
q = int(input())
for _ in range(q):
	do()


t = int(input())
for test in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	temp = arr[0]
	check = arr.count(temp)
	if check == n:
		print('NO')
	else:
		di = {}
		print('YES')
		for i in range(n):
			if arr[i] in di:
				di[arr[i]].append(i + 1)
			else:
				di[arr[i]] = list()
				di[arr[i]].append(i + 1)
		keyy = list(di.keys())
		temp = di[keyy[0]]
		first = temp[0]
		for i in di.keys():
			if i != keyy[0]:
				for j in di[i]:
					print(first, j)
		if len(temp) > 1:
			temp2 = di[keyy[1]]
			second = temp2[0]
			for i in range(1, len(temp)):
				print(second, temp[i])


import sys
INP = lambda : sys.stdin.readline().strip()
INT = lambda : int(INP())
MAP = lambda : map(int, INP().split())
ARR = lambda : [int(i) for i in INP().split()]

def JOIN(arr, x=' '):
	return x.join([str(i) for i in arr])

def EXIT(x='NO'):
	print(x)
	exit()
for _ in range(INT()):
	(n, arr) = (INT(), ARR())
	d = {x: [] for x in arr}
	for (i, x) in enumerate(arr):
		d[x].append(i + 1)
	ans = []
	s = list(d.keys())
	if len(s) == 1:
		print('NO')
		continue
	print('YES')
	cur = d[s[0]]
	k = cur[0]
	for x in s[1:]:
		for y in d[x]:
			print('%d %d' % (k, y))
		cur = d[x]
		k = cur[0]
	for x in d[s[0]][1:]:
		print('%d %d' % (k, x))


t = int(input())
i = 0
while i < t:
	n = int(input())
	a = list(map(int, input().split()))
	valid = a[0]
	F = []
	N = []
	index = 0
	while index < n:
		if a[index] == a[0]:
			F.append(index + 1)
		else:
			N.append(index + 1)
		index += 1
	if len(N) == 0:
		print('NO')
	else:
		valid = 0
		print('YES')
		index = 0
		V = len(N)
		while index < V:
			answer = '1 ' + str(N[index])
			print(answer)
			valid += 1
			index += 1
		if valid < n - 1:
			index = 1
			V = len(F)
			while index < V:
				S = str(N[0])
				answer = S + ' ' + str(F[index])
				index += 1
				print(answer)
	i += 1


import sys
import math as m

def main():
	pass

def binary(n):
	return bin(n).replace('0b', '')

def decimal(s):
	return int(s, 2)

def pow2(n):
	p = 0
	while n > 1:
		n //= 2
		p += 1
	return p

def isPrime(n):
	if n == 1:
		return False
	else:
		root = int(n ** 0.5)
		root += 1
		for i in range(2, root):
			if n % i == 0:
				return False
		return True

def lts(l):
	s = ''.join(map(str, l))
	return s

def stl(s):
	l = list(s)
	return l

def sq(a, target, arr=[]):
	s = sum(arr)
	if s == target:
		return arr
	if s >= target:
		return
	for i in range(len(a)):
		n = a[i]
		remaining = a[i + 1:]
		ans = sq(remaining, target, arr + [n])
		if ans:
			return ans
mod = int(1000000000.0) + 7

def sinp():
	return sys.stdin.readline().strip()

def iinp():
	return int(input())

def ninp():
	return map(int, sys.stdin.readline().strip().split())

def llinp():
	return list(map(int, sys.stdin.readline().strip().split()))

def p(xyz):
	print(xyz)

def p2(a, b):
	print(a, b)
for _ in range(iinp()):
	n = iinp()
	a = llinp()
	s1 = set(a)
	if len(s1) > 1:
		print('YES')
		s = set()
		for i in range(len(a) - 1):
			for j in range(i + 1, len(a)):
				if a[i] != a[j]:
					if i in s and j in s:
						pass
					else:
						s.add(i)
						s.add(j)
						print(i + 1, j + 1)
	else:
		print('NO')


t = int(input())
while t:
	t -= 1
	n = int(input())
	a = [int(i) for i in input().split()]
	b = [(a[i], i + 1) for i in range(n)]
	b = sorted(b)
	fd = -1
	for i in range(1, n):
		if b[i][0] != b[i - 1][0]:
			fd = i
			break
	if fd == -1:
		print('NO')
	else:
		ans = []
		for i in range(fd, n):
			ans.append((b[0][1], b[i][1]))
		for i in range(1, fd):
			ans.append((b[fd][1], b[i][1]))
		print('YES')
		for q in ans:
			print(q[0], end=' ')
			print(q[1])


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	c = a.count(a[0])
	if c != n:
		print('YES')
		x = a[0]
		k = 1
		while a[k] == x:
			k += 1
		y = [a[k], k + 1]
		for i in range(1, n):
			if x != a[i]:
				print(str(1) + ' ' + str(i + 1))
			elif y[0] != a[i]:
				print(str(y[1]) + ' ' + str(i + 1))
	else:
		print('NO')


from collections import defaultdict
from typing import List

def solve(n: int, a: List[int]) -> List:
	gangs = defaultdict(list)
	for (i, g) in enumerate(a, start=1):
		gangs[g].append(i)
	if len(gangs) == 1:
		return []
	keys = list(gangs.keys())
	mother = gangs[keys[0]][0]
	father = gangs[keys[1]][0]
	r = []
	for key in keys[1:]:
		for e in gangs[key]:
			r.append((mother, e))
	for e in gangs[keys[0]][1:]:
		r.append((father, e))
	return r
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	r = solve(n, a)
	if not r:
		print('NO')
	else:
		print('YES')
		for _ in r:
			print(_[0], _[1])


for __ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	dic = dict()
	ind = 1
	for i in a:
		if i not in dic.keys():
			dic[i] = [ind]
		else:
			dic[i].append(ind)
		ind += 1
	if len(dic) == 1:
		print('NO')
		continue
	else:
		print('YES')
	lis = []
	for i in dic.items():
		lis.append(i)
	for i in lis:
		temp = i[1][0]
		j = lis.index(i) + 1
		if j >= len(lis):
			break
		for k in lis[j][1]:
			print(temp, k)
	temp = lis[len(lis) - 1][1][0]
	for i in lis[0][1][1:]:
		print(temp, i)


from collections import defaultdict
import math
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	d = defaultdict(list)
	for i in range(n):
		d[a[i]].append(i + 1)
	if len(d) == 1:
		print('NO')
		continue
	print('YES')
	x = []
	m = 10 ** 7
	for i in d:
		x.append([len(d[i]), i])
		if m > len(d[i]):
			el = i
			pos = d[i][-1]
			m = len(d[i])
	for i in d:
		if i == el:
			continue
		for j in range(len(d[i])):
			print(pos, d[i][j])
	m -= 1
	d[el].pop()
	for i in range(n):
		if m == 0:
			break
		if a[i] != el:
			print(d[el].pop(), i + 1)
			m -= 1


l = int(input())
while l:
	p = input()
	n = list(map(int, input().split()))
	y = []
	if len(set(n)) == 1:
		print('NO')
	else:
		print('YES')
		ff = 0
		for i in range(1, len(n)):
			if n[0] != n[i]:
				print(1, i + 1)
				f = i + 1
			else:
				y.append(i + 1)
				ff = 1
		if ff == 1:
			for i in range(len(y)):
				print(f, y[i])
	l -= 1


from collections import defaultdict
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	if arr.count(arr[0]) == n:
		print('NO')
	else:
		print('YES')
		dic = defaultdict(lambda : [])
		for i in range(n):
			dic[arr[i]].append(i + 1)
		m = n
		x = -1
		for i in dic:
			if len(dic[i]) < m:
				x = i
				m = len(dic[i])
		if m == 1:
			x = dic[x][0]
			i = 1
			while i <= n:
				if i != x:
					print(x, i)
				i += 1
		else:
			out = set(dic[x])
			m -= 1
			f = dic[x].pop()
			i = 1
			while i <= n:
				if i not in out:
					print(f, i)
					if m > 0:
						t = dic[x].pop()
						print(i, t)
						m -= 1
				i += 1


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from heapq import *
from math import gcd, factorial, floor, ceil
from copy import deepcopy
from collections import deque
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func
mod = 10 ** 9 + 7

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for pp in range(t):
		solve(pp)

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def google(p):
	print('Case #' + str(p) + ': ', end='')

def lcm(a, b):
	return a * b // gcd(a, b)

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True
inf = pow(10, 20)

def bfs(g, st, ans, visited):
	visited[st] = 1
	queue = deque([])
	queue.append(st)
	new = []
	while len(queue) != 0:
		s = queue.popleft()
		new.append(s)
		for i in g[s]:
			if visited[i] == 0:
				visited[i] = 1
				queue.append(i)
				ans.append((s, i))
	return new

def solve(case):
	n = int(inp())
	a = lis()
	freq = {}
	freq[0] = 0
	for i in range(n):
		if a[i] not in freq:
			freq[a[i]] = 1
		else:
			freq[a[i]] += 1
	temp = 0
	for i in freq:
		if freq[i] > freq[temp]:
			temp = i
	if freq[temp] != n:
		print('YES')
		help = [[], []]
		for i in range(n):
			if a[i] != temp:
				help[1].append(i)
			else:
				help[0].append(i)
		for i in help[1]:
			print(i + 1, help[0][0] + 1)
		cnt = 0
		for i in help[0]:
			if cnt == 0:
				cnt += 1
				continue
			print(i + 1, help[1][0] + 1)
	else:
		print('NO')
testcase(int(inp()))


from sys import stdin, stdout

def INPUT():
	return list((int(i) for i in stdin.readline().split()))
import math

def inp():
	return stdin.readline()

def out(x):
	return stdout.write(x)
import math as M
MOD = 10 ** 9 + 7
from random import randint as R
for _ in range(int(input())):
	n = int(input())
	A = INPUT()
	if len(set(A)) == 1:
		print('NO')
		continue
	print('YES')
	prev = A[0]
	prevind = 1
	for i in range(1, n):
		if A[i] != A[0]:
			tempind = i + 1
			temp = A[i]
			break
	for i in range(1, n):
		if A[i] == prev:
			(prev, temp) = (temp, prev)
			(prevind, tempind) = (tempind, prevind)
		print(prevind, i + 1)


for tc in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	temp = arr[0]
	b = [i for i in range(1, n) if arr[i] != arr[0]]
	if len(b) == 0:
		print('NO')
		continue
	print('YES')
	for index in range(1, n):
		if arr[index] != temp:
			print(index + 1, 1)
		else:
			print(index + 1, b[0] + 1)


tests = int(input())
for t in range(tests):
	districts = int(input())
	gangs = [int(k) for k in input().split()]
	for k in range(districts):
		if gangs[k] != gangs[0]:
			break
		if k == districts - 1:
			print('NO')
			break
	if k == districts - 1 and gangs[districts - 1] == gangs[0]:
		continue
	cnt = -1
	print('YES')
	for k in range(districts):
		if gangs[0] != gangs[k]:
			print(1, k + 1)
			gangs[k] = -1
			if cnt == -1:
				cnt = k + 1
	gangs[0] = -1
	for k in range(districts):
		if gangs[k] != -1:
			print(cnt, k + 1)


from sys import stdin, stdout
t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	if len(set(a)) == 1:
		print('NO')
		continue
	print('YES')
	dict = {}
	for i in range(n):
		if a[i] in dict:
			dict[a[i]].append(i + 1)
		else:
			dict[a[i]] = [i + 1]
	m = float('inf')
	p = -1
	for i in dict:
		if len(dict[i]) < m:
			m = len(dict[i])
			p = i
	ans = []
	var = dict[p][0]
	idk = -1
	for i in dict:
		if i != p:
			for j in dict[i]:
				idk = j
				ans.append((j, var))
	for i in dict[p]:
		if i != var:
			ans.append((i, idk))
	for i in ans:
		print(i[0], i[1])


for t in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	m = a[0]
	b = []
	f = -5
	count = 0
	c = []
	add = 0
	for i in range(1, n):
		if a[i] == m:
			b.append(i + 1)
			count += 1
		else:
			c.append(i + 1)
			add += 1
			f = i + 1
	if f == -5:
		print('NO')
		continue
	print('YES')
	for i in range(add):
		print(1, c[i])
	for i in range(count):
		print(f, b[i])


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	if len(set(a)) == 1:
		print('NO')
	elif len(set(a)) == n:
		print('YES')
		for i in range(1, n):
			print(1, i + 1)
	else:
		print('YES')
		p = a[0]
		r = []
		q = 0
		for i in range(1, n):
			if p == a[i]:
				r.append(i + 1)
			else:
				print(1, i + 1)
				q = i + 1
		for x in r:
			print(q, x)


for r in range(int(input())):
	a = int(input())
	b = list(map(int, input().split()))
	s = list(set(b))
	if len(s) == 1:
		print('NO')
		continue
	t = b.index(s[0])
	u = b.index(s[1])
	print('YES')
	print(t + 1, u + 1)
	for i in range(a):
		if i == t or i == u:
			continue
		elif b[i] == s[0]:
			print(i + 1, u + 1)
		else:
			print(i + 1, t + 1)


import sys
num = int(sys.stdin.readline())
for i in range(num):
	t = int(sys.stdin.readline())
	lst = list(map(int, sys.stdin.readline().strip().split(' ')))
	res = set(lst)
	if len(res) == 1:
		print('NO')
		continue
	a = res.pop()
	b = res.pop()
	print('YES')
	for (i, item) in enumerate(lst):
		if item == b:
			break
	for (s, item) in enumerate(lst):
		if item == a:
			break
	for (j, item) in enumerate(lst):
		if item != b:
			print(i + 1, j + 1)
	for t in range(i + 1, len(lst)):
		if lst[t] == b:
			print(t + 1, s + 1)


from collections import Counter
for t in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	ans = 0
	b = Counter(a)
	if len(b) == 1:
		print('NO')
	else:
		print('YES')
		check = 1
		check2 = -1
		for i in range(1, n):
			if a[i] != a[check - 1]:
				check2 = i + 1
				break
		for i in range(1, n):
			if a[i] != a[check - 1]:
				print(str(i + 1) + ' ' + str(check))
			else:
				print(str(check2) + ' ' + str(i + 1))


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	for j in range(n):
		a[j] = (a[j], j)
	a.sort()
	if a[-1][0] == a[0][0]:
		print('NO')
		continue
	else:
		print('YES')
		d = [[a[0][1]]]
		last = a[0][0]
		for j in range(1, n):
			if a[j][0] == last:
				d[-1].append(a[j][1])
			else:
				d.append([a[j][1]])
				last = a[j][0]
		for j in range(len(d) - 1):
			for el in d[j]:
				print(el + 1, d[j + 1][0] + 1)
		if len(d[-1]) > 1:
			for el in d[-1][1:]:
				print(el + 1, d[0][0] + 1)


t = int(input())
while t:
	t -= 1
	n = int(input())
	l = list(map(int, input().split()))
	m = float('inf')
	M = 0
	for (i, v) in enumerate(l):
		if v > M:
			M = v
		if v < m:
			m = v
	if M == m:
		print('NO')
		continue
	visited = [0] * n
	visited[0] = 1
	idx = 0
	while l[idx] == l[0]:
		idx += 1
	visited[idx] = 1
	print('YES')
	print(1, idx + 1)
	for (i, v) in enumerate(l[1:], 1):
		if not visited[i]:
			if v == l[0]:
				print(idx + 1, i + 1)
			else:
				print(1, i + 1)
			visited[i] = 1


from collections import defaultdict
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	vis = {}
	ans = defaultdict(list)
	f = {}
	for i in a:
		if i not in f:
			f[i] = 1
		else:
			f[i] += 1
	ok = 0
	index = defaultdict(list)
	for i in range(n):
		index[a[i]].append(i + 1)
	for i in range(n):
		for j in range(n):
			if a[j] != a[i] and a[j] not in vis:
				ok = 1
				ans[i + 1] += index[a[j]]
				vis[a[j]] = 1
	if ok == 0:
		print('NO')
	else:
		print('YES')
		check = [[0 for i in range(n + 1)] for j in range(n + 1)]
		for i in ans:
			if ans[i] == []:
				continue
			for j in ans[i]:
				if check[i][j] == 0 and check[j][i] == 0:
					print(i, j)
					check[i][j] = 1
					check[j][i] = 1


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	L = [(v, i + 1) for (i, v) in enumerate(map(int, input().split()))]
	L.sort()
	(poss, p) = (False, None)
	for i in range(len(L) - 1):
		if L[i][0] != L[i + 1][0]:
			(poss, p) = (True, i)
			break
	if not poss:
		print('NO')
		continue
	print('YES')
	L += L[:p]
	for i in range(p + 1, len(L)):
		if L[i][0] != L[i - 1][0]:
			p = i - 1
		print(L[p][1], L[i][1])


caseNum = int(input())
for i in range(caseNum):
	districtNum = int(input())
	districtGang = list(map(int, input().split(' ')))
	arrivedGang = []
	arrivedFirstDistrict = []
	for j in range(districtNum):
		gang = districtGang[j]
		if arrivedGang.count(gang) == 0:
			arrivedGang.append(gang)
			arrivedFirstDistrict.append(j + 1)
	if len(arrivedGang) <= 1:
		print('NO')
	else:
		print('YES')
		for j in range(len(arrivedFirstDistrict) - 1):
			print(str(arrivedFirstDistrict[j]) + ' ' + str(arrivedFirstDistrict[j + 1]))
		for j in range(districtNum):
			gang = districtGang[j]
			if j + 1 not in arrivedFirstDistrict:
				if gang == arrivedGang[0]:
					print(str(j + 1) + ' ' + str(arrivedFirstDistrict[1]))
				else:
					print(str(j + 1) + ' ' + str(arrivedFirstDistrict[0]))


import sys
t = int(input())
for _ in range(t):
	n = int(sys.stdin.readline())
	arr = list(map(int, sys.stdin.readline().split()))
	length = len(arr)
	flag = True
	for i in range(length - 1):
		if arr[i] != arr[i + 1]:
			break
		if i == length - 2:
			print('NO')
			flag = False
	if flag:
		print('YES')
		vis = -1
		for i in range(1, length):
			if arr[0] != arr[i]:
				vis = i
				print('1 %d' % (i + 1))
				break
		for i in range(1, length):
			if i == vis:
				continue
			for j in range(length):
				if arr[i] != arr[j]:
					print('%d %d' % (i + 1, j + 1))
					break


import sys
from collections import defaultdict
from collections import deque

def solve():
	return None

def main():
	q = []
	for line in sys.stdin.readlines():
		q.append(line)
	for i in range(len(q)):
		q[i] = q[i].rstrip().split(' ')
		q[i] = [int(x) for x in q[i]]
	for i in range(1, len(q), 2):
		a = q[i + 1]
		d = defaultdict(list)
		m = 0
		for i in range(len(a)):
			d[a[i]].append(i + 1)
			if len(d[a[i]]) > m:
				m = len(d[a[i]])
		if len(d) == 1:
			print('NO')
		else:
			print('YES')
			cur = a[0]
			for k in d.keys():
				if k != cur:
					for i in d[k]:
						print(d[cur][0], i)
			if len(d[a[0]]) > 1:
				for j in range(1, len(d[a[0]])):
					print(i, d[a[0]][j])
main()


def solution():
	n = int(input())
	arr = list(map(int, input().split()))
	MIN = arr[0]
	i = 1
	while i < n:
		if arr[i] != MIN:
			break
		i += 1
	if i == n:
		print('NO')
		return
	roads = []
	remaining = []
	last = 0
	for i in range(1, n):
		if arr[i] != arr[0]:
			roads.append([1, i + 1])
			last = i + 1
			while remaining:
				roads.append([i + 1, remaining.pop()])
		else:
			remaining.append(i + 1)
	if remaining:
		for i in remaining:
			roads.append([last, i])
	print('YES')
	for (i, j) in roads:
		print(i, j)
	return

def main():
	T = int(input())
	for t in range(1, T + 1):
		solution()
main()


from collections import defaultdict, deque
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	if arr.count(arr[0]) == n:
		print('NO')
	else:
		ind = defaultdict(list)
		for i in range(1, n):
			if arr[i] != arr[0]:
				ind[arr[i]] = 1
				ind[arr[0]] = i + 1
		print('YES')
		for (i, x) in enumerate(arr[1:], start=2):
			print(i, ind[x])


t = int(input())
for i in range(t):
	n = int(input())
	b = list(map(int, input().split()))
	if len(set(b)) == 1:
		print('NO')
	else:
		ini = b[0]
		j = 1
		res = []
		while j < n:
			if b[j] != ini:
				res.append([1, j + 1])
				q = j + 1
			j += 1
		j = 1
		while j < n:
			if b[j] == ini:
				res.append([q, j + 1])
			j += 1
		print('YES')
		for j in res:
			print(*j)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	visited = [False for _ in range(n)]
	possible = False
	for i in range(1, n):
		if a[i] != a[0]:
			possible = True
	if not possible:
		print('NO')
	else:
		print('YES')
		for i in range(n - 1):
			for j in range(i + 1, n):
				if a[i] != a[j] and (visited[i] is False or visited[j] is False):
					visited[i] = visited[j] = True
					print(i + 1, j + 1)


for _ in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	d = [[a[i], 0] for i in range(n)]
	if len(set(a)) == 1:
		print('NO')
	else:
		print('YES')
		d[0][1] = 1
		c = 0
		flag = False
		for i in range(n):
			for j in range(n):
				if d[i][0] != d[j][0] and (d[i][1] == 0 or d[j][1] == 0):
					d[i][1] = 1
					d[j][1] = 1
					c += 1
					print(i + 1, j + 1)
				if c == n - 1:
					flag = True
					break
			if flag:
				break


for i in range(int(input())):
	n = int(input())
	lst = list(map(int, input().split()))
	if lst.count(lst[0]) == len(lst):
		print('NO')
	else:
		print('YES')
		idx2 = 1
		for idx in range(1, len(lst)):
			if lst[idx] != lst[0]:
				idx2 = idx
				break
		for idx in range(1, len(lst)):
			if lst[idx] != lst[0]:
				print(idx + 1, 1)
			else:
				print(idx + 1, idx2 + 1)


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__
from collections import defaultdict

def gift():
	for _ in range(t):
		n = int(input())
		gangs = list(map(int, input().split()))
		dic = defaultdict(lambda : [])
		for (i, ele) in enumerate(gangs):
			dic[ele].append(i)
		maxele = max(dic, key=lambda k: len(dic[k]))
		if len(dic[maxele]) == n:
			yield 'NO'
		else:
			yield 'YES'
			topele = gangs[0]
			foundele = None
			toConnec = []
			for i in range(1, n):
				if gangs[i] != topele:
					yield '{} {}'.format(1, i + 1)
					if foundele == None:
						foundele = i + 1
				else:
					toConnec.append(i + 1)
			for ele in toConnec:
				yield '{} {}'.format(foundele, ele)
t = int(input())
ans = gift()
print(*ans, sep='\n')


from math import *
sInt = lambda : int(input())
mInt = lambda : map(int, input().split())
lInt = lambda : list(map(int, input().split()))
t = sInt()
for _ in range(t):
	n = sInt()
	a = lInt()
	if max(a) == min(a):
		print('NO')
	else:
		print('YES')
		left = []
		for i in range(1, n):
			if a[i] != a[0]:
				print(1, i + 1)
			else:
				j = 1
				while a[i] == a[j]:
					j += 1
				print(i + 1, j + 1)


import sys
from sys import stdin as sysstdin
t = int(sysstdin.readline().strip())
for _ in range(0, int(t)):
	n = int(sysstdin.readline().strip())
	a = [int(x) for x in sysstdin.readline().split()]
	if a.count(max(a)) == n:
		print('NO')
	else:
		print('YES')
		for i in range(0, len(a)):
			if a[i] != a[0]:
				print(1, i + 1)
				b = a[i]
				j = i
		for i in range(1, len(a)):
			if a[i] == a[0]:
				print(j + 1, i + 1)


from sys import stdin, stdout

def II():
	return int(stdin.readline())

def LI():
	return list(map(int, stdin.readline().split()))
yes = 'YES\n'
no = 'NO\n'

def solve():
	n = II()
	a = LI()
	sa = set(a)
	if len(sa) == 1:
		stdout.write(no)
	else:
		stdout.write(yes)
		p1 = sa.pop()
		p2 = sa.pop()
		ip1 = a.index(p1) + 1
		ip2 = a.index(p2) + 1
		l = [(ip1, i + 1) for i in range(n) if a[i] != p1]
		l += [(ip2, i + 1) for i in range(n) if a[i] == p1 and i != ip1 - 1]
		for (x, y) in l:
			stdout.write('{} {}\n'.format(x, y))
t = II()
for _ in range(t):
	solve()


t = int(input())
while t:
	t -= 1
	n = int(input())
	l = list(map(int, input().split()))
	kkk = 0
	k = []
	gg = []
	c = 0
	if min(l) == max(l):
		print('NO')
	else:
		print('YES')
		for i in range(0, n):
			if l[i] != l[kkk]:
				print(i + 1, ' ', kkk + 1)
				if c == 0:
					gg.append(i)
					c += 1
			elif l[i] == l[kkk] and i != kkk:
				k.append(i)
		for ii in k:
			print(ii + 1, ' ', gg[0] + 1)


def get_connections(a, n):
	v = [0 for i in range(n)]
	v[0] = 1
	res = []
	for i in range(n):
		if v[i] == 1:
			for j in range(n):
				if v[j] == 0:
					if a[j] != a[i]:
						res.append([i + 1, j + 1])
						v[j] = 1
			if 0 not in v:
				return res
	if 0 not in v:
		return res
for t in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	m = get_connections(a, n)
	if m is not None:
		print('YES')
		for i in m:
			print(i[0], i[1])
	else:
		print('NO')


import os, sys
from collections import defaultdict, Counter
from io import BytesIO, IOBase
from math import ceil

def mode(List):
	counter = 0
	num = List[0]
	for i in List:
		curr_frequency = List.count(i)
		if curr_frequency > counter:
			counter = curr_frequency
			num = i
	return num

def main():
	for _ in range(int(input())):
		n = int(input())
		a = [int(x) for x in input().split()]
		if len(set(a)) == 1:
			print('NO')
		else:
			print('YES')
			d = defaultdict(lambda : [])
			for i in range(1, n):
				if a[i] != a[0]:
					print(i + 1, 1)
					temp = i + 1
			for i in range(1, n):
				if a[i] == a[0]:
					print(temp, i + 1)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	if len(list(set(a))) == 1:
		print('NO')
		continue
	val = 0
	print('YES')
	for i in range(1, n):
		if a[i] != a[0]:
			print(1, i + 1)
			val = i + 1
	for i in range(1, n):
		if a[0] == a[i]:
			print(i + 1, val)


for t in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	if len(set(a)) == 1:
		print('NO')
		continue
	else:
		print('YES')
		x = y = 0
		for i in range(n):
			if a[i] != a[y]:
				y = i
				break
		res = []
		for i in range(1, n):
			if a[i] != a[0]:
				print(1, i + 1)
			else:
				res.append(i + 1)
		for i in res:
			print(y + 1, i)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	if len(set(a)) == 1:
		print('NO')
		continue
	print('YES')
	ans = []
	idx = -1
	for i in range(1, n):
		if a[i] != a[0]:
			idx = i
			ans.append([1, i + 1])
	for i in range(1, n):
		if a[i] == a[0]:
			ans.append([idx + 1, i + 1])
	for i in ans:
		print(*i)


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	aa = list(map(int, input().split()))
	i = 0
	xa = aa[0]
	while i < n and aa[i] == xa:
		i += 1
	if i == n:
		print('NO')
		continue
	print('YES')
	ma = 1
	while aa[ma] == aa[0]:
		ma += 1
	for i in range(1, n):
		if aa[i] != aa[0]:
			print(1, i + 1)
		else:
			print(i + 1, ma + 1)


import sys
from collections import defaultdict as dd
from collections import Counter as cc
from queue import Queue
import math
import itertools
try:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
except:
	pass
input = lambda : sys.stdin.buffer.readline().rstrip()
for _ in range(int(input())):
	q = int(input())
	w = list(map(int, input().split()))
	e = max(w)
	r = []
	t = 0
	if len(set(w)) == 1:
		print('NO')
	else:
		print('YES')
		j = 1
		while w[0] == w[j]:
			j += 1
		for i in range(j - 1):
			r.append([i + 1, j + 1])
		for i in range(j, q):
			if w[i] != w[i - 1]:
				k = i - 1
			r.append([k + 1, i + 1])
		for i in r:
			print(*i)


def read_generator():
	while True:
		tokens = input().split(' ')
		for t in tokens:
			yield t
reader = read_generator()

def readword():
	return next(reader)

def readint():
	return int(next(reader))

def readfloat():
	return float(next(reader))

def readline():
	return input()

def solve(a):
	m = {a[0]: 0}
	u = [False] * len(a)
	e = []
	u[0] = True
	for _ in range(len(a)):
		updated = False
		for i in range(len(a)):
			if not u[i]:
				if len(m) > 1 or a[i] not in m:
					for k in m.keys():
						if k != a[i]:
							e.append((m[k], i))
							m[a[i]] = i
							break
					updated = True
					u[i] = True
		if len(e) == len(a) - 1:
			break
		if not updated:
			print('NO')
			return
	print('YES')
	for v in e:
		print(v[0] + 1, v[1] + 1)
tests = readint()
for t in range(tests):
	n = readint()
	a = [readint() for _ in range(n)]
	solve(a)


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	arr = [int(x) for x in input().split()]
	if len(set(arr)) > 1:
		print('YES')
		index1 = []
		index2 = []
		a = arr[0]
		for i in range(1, n):
			if a != arr[i]:
				print(1, i + 1)
				index2.append(i)
			else:
				index1.append(i)
		for item in index1:
			print(index2[0] + 1, item + 1)
	else:
		print('NO')


t = int(input())
for q in range(t):
	n = int(input())
	lst = list(map(int, input().split()))
	if lst.count(lst[0]) == n:
		print('NO')
		continue
	else:
		print('YES')
		f1 = lst[0]
		i1 = 0
		for i in range(1, n):
			if lst[i] != f1:
				s1 = lst[i]
				i2 = i
				break
	for i in range(n):
		if lst[i] == f1:
			print(i2 + 1, i + 1)
		elif i == i2:
			continue
		else:
			print(i1 + 1, i + 1)


from collections import Counter
for _ in ' ' * int(input()):
	n = int(input())
	a = list(map(int, input().split()))
	if len(set(a)) == 1:
		print('NO')
	else:
		lst = Counter(a)
		minn = min(lst.keys(), key=lambda k: lst[k])
		ind = lst[minn]
		innn = a.index(minn)
		x = 0
		for i in range(n):
			if a[i] != minn:
				x = i
				break
		print('YES')
		for i in range(n):
			if a[i] != minn:
				print(innn + 1, i + 1)
				x = i
			elif i != innn:
				print(x + 1, i + 1)


import sys, math
t = int(input())
for i in range(t):
	n = int(input())
	c_typ = list(map(int, sys.stdin.readline().strip().split()))
	(c1, c1_typ) = (0, c_typ[0])
	c2 = -1
	r_map1 = []
	for i in range(1, n):
		if c_typ[i] != c1_typ:
			r_map1.append(i)
			if c2 == -1:
				c2 = i
	if c2 > -1:
		print('YES')
		for i in range(1, n):
			if c_typ[i] == c1_typ:
				sys.stdout.write('{} {}\n'.format(c2 + 1, i + 1))
		for i in r_map1:
			sys.stdout.write('{} {}\n'.format(c1 + 1, i + 1))
	else:
		print('NO')


import sys, os
from io import BytesIO, IOBase
import collections, itertools, bisect, heapq, math, string
from decimal import *
BUFSIZE = 8192
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		a = list(map(int, input().split()))
		idx = -1
		res = []
		for i in range(1, n):
			if a[i] != a[0]:
				idx = i
				res.append((1, i + 1))
		if idx == -1:
			print('NO')
			continue
		for i in range(1, n):
			if a[i] == a[0]:
				res.append((idx + 1, i + 1))
		print('YES')
		for r in res:
			print(r[0], r[1])
main()


t = int(input())
for i in range(t):
	n = int(input())
	A = list(map(int, input().split()))
	d = A[0]
	B = []
	x = 0
	f = True
	for j in range(1, n):
		if A[j] != d:
			if f:
				print('YES')
				f = False
			print(1, j + 1)
			x = j + 1
		else:
			B.append(j + 1)
	if f:
		print('NO')
	else:
		for j in B:
			print(x, j)


for _ in range(int(input())):
	n = int(input())
	a = [x for x in map(int, input().split())]
	ans = []
	idx = -1
	for i in range(1, n):
		if a[0] != a[i]:
			idx = i
			ans.append([1, i + 1])
	if idx == -1:
		print('NO')
		continue
	for i in range(1, n):
		if a[0] == a[i]:
			ans.append([idx + 1, i + 1])
	print('YES')
	for i in ans:
		print(*i)


t = int(input())
for z in range(t):
	num = int(input())
	block = input().split()
	for a in range(num):
		block[a] = int(block[a])
	indieZero = block[0]
	sameness = True
	for a in range(num):
		if not block[a] == indieZero:
			sameness = False
			break
	if sameness:
		print('NO')
		continue
	else:
		print('YES')
	list1 = []
	list2 = []
	discovered = False
	x = -1
	for i in range(1, num):
		if x == -1 and (not block[i] == indieZero):
			x = i
			list1.append(x)
		elif block[i] != indieZero:
			list1.append(i)
		else:
			list2.append(i)
	for a in list1:
		print(1, a + 1)
	for a in list2:
		print(x + 1, a + 1)


import sys as _sys

def main():
	t = int(input())
	for i_t in range(t):
		(n,) = _read_ints()
		a = tuple(_read_ints())
		assert n >= 2
		if len(set(a)) == 1:
			print('NO')
			continue
		print('YES')
		vertex_a = 0
		vertex_b = 1
		while a[vertex_b] == a[vertex_a]:
			vertex_b += 1
		for vertex in range(1, len(a)):
			second_vertex = vertex_a if a[vertex] != a[vertex_a] else vertex_b
			print(vertex + 1, second_vertex + 1)

def _read_line():
	result = _sys.stdin.readline()
	assert result[-1] == '\n'
	return result[:-1]

def _read_ints():
	return map(int, _read_line().split())
main()


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')
t = int(input())
for ti in range(t):
	n = int(input())
	li = [int(i) for i in input().split()]
	ans = []
	d = {}
	for (p, i) in enumerate(li):
		d.setdefault(i, []).append(p)
	res = sorted(d.items())
	if len(res) > 1:
		for i in res[0][1][1:]:
			ans.append((i + 1, res[-1][1][0] + 1))
	for (p, i) in enumerate(res[1:]):
		for j in i[1]:
			ans.append((res[p][1][0] + 1, j + 1))
	if len(ans) == n - 1:
		print('YES')
		for k in ans:
			print(*k)
	else:
		print('NO')


import os
import sys
import math
import collections
import itertools

def get_int():
	return int(input())

def get_ints():
	return map(int, input().split())

def get_strs():
	return input().split()

def get_float():
	return float(input())

def get_floats():
	return map(float, input().split())

def list_strs():
	return list(input().split())

def list_ints():
	return list(map(int, input().split()))

def list_floats():
	return list(map(float, input.split()))

def post(x):
	print(x, end=' ')
T = int(input())
for t in range(1, T + 1):
	n = get_int()
	a = list_ints()
	if len(set(a)) == 1:
		print('NO')
	else:
		print('YES')
		same = []
		diff = []
		for i in range(n):
			if a[i] == a[0]:
				same.append(i + 1)
			else:
				diff.append(i + 1)
		for i in range(1, len(same)):
			print(diff[0], same[i])
		for i in diff:
			print(same[0], i)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	if len(set(a)) == 1:
		print('NO')
	else:
		print('YES')
		for i in range(n):
			if a[i] != a[0]:
				b = i + 1
				break
		c = []
		for i in range(1, n):
			if a[i] != a[0]:
				c.append([1, i + 1])
			else:
				c.append([b, i + 1])
		for i in range(len(c)):
			print(*c[i])


for _ in range(int(input())):
	n = int(input())
	c = 0
	x = []
	a = list(map(int, input().split()))
	if len(set(a)) == 1:
		print('NO')
	else:
		print('YES')
		h = a[0]
		x = 0
		for i in range(1, n):
			if a[i] != h:
				x = i
				break
		for i in range(1, n):
			if a[i] != h:
				print(1, i + 1)
				c += 1
			else:
				print(x + 1, i + 1)


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	a = l[0]
	ind = -1
	for i in range(1, n):
		if l[i] != a:
			ind = i
			break
	if ind == -1:
		print('NO')
		continue
	print('YES')
	for i in range(1, n):
		if l[i] == a:
			print(ind + 1, i + 1)
		else:
			print(1, i + 1)


for i in range(int(input())):
	n = int(input())
	alef = []
	sigma = list(map(int, input().split()))
	if len(set(sigma)) == 1:
		print('NO')
		continue
	for i in range(1, n):
		if sigma[0] != sigma[i]:
			alef.append('1' + ' ' + str(i + 1))
		else:
			for j in range(1, n):
				if sigma[j] != sigma[i]:
					alef.append(str(i + 1) + ' ' + str(j + 1))
					break
	else:
		print('YES')
		for i in alef:
			print(i)


from sys import stdin
input = stdin.readline
from collections import Counter

def solve():
	n = int(input())
	a = list(map(int, input().split()))
	c = Counter(a)
	mn = min(c.values())
	if mn == n:
		print('NO')
		return
	k = min(c.keys(), key=lambda x: c[x])
	rootindex = [i + 1 for (i, v) in enumerate(a) if v == k]
	leafindex = [i + 1 for (i, v) in enumerate(a) if v != k]
	root = rootindex[0]
	leaf = leafindex[0]
	res = [str(root) + ' ' + str(i) for i in leafindex]
	res.extend([str(i) + ' ' + str(leaf) for i in rootindex[1:]])
	print('YES')
	print('\n'.join(res))
t = int(input())
for _ in range(t):
	solve()


from collections import defaultdict
test_count = int(input())
tests = []
for _ in range(test_count):
	x = int(input())
	y = list(map(int, input().split()))
	tests.append((x, y))
for test in tests:
	(x, districts) = test
	dis_dict = defaultdict(set)
	dis_gang = []
	for (idx, district) in enumerate(districts):
		dis_dict[district].add(idx + 1)
		dis_gang.append((idx + 1, district))
	sizes = [len(v) for v in dis_dict.values()]
	road_count = x * (x - 1) // 2 - sum([s * (s - 1) // 2 for s in sizes])
	if road_count < x - 1:
		print('NO')
	else:
		print('YES')
		(init, init_dis) = dis_gang[0]
		next_end = -1
		for dg in dis_gang:
			if dg[1] != init_dis:
				print(f'{init} {dg[0]}')
				next_end = dg[0]
		for idx in dis_dict[init_dis]:
			if idx != init:
				print(f'{idx} {next_end}')


import sys
sys.setrecursionlimit(10 ** 5)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep='\n')

def II():
	return int(sys.stdin.buffer.readline())

def MI():
	return map(int, sys.stdin.buffer.readline().split())

def LI():
	return list(map(int, sys.stdin.buffer.readline().split()))

def LLI(rows_number):
	return [LI() for _ in range(rows_number)]

def BI():
	return sys.stdin.buffer.readline().rstrip()

def SI():
	return sys.stdin.buffer.readline().rstrip().decode()
for _ in range(II()):
	n = II()
	aa = LI()
	if aa.count(aa[0]) == n:
		print('NO')
		continue
	print('YES')
	a0 = aa[0]
	u = a1 = -1
	for (i, a) in enumerate(aa):
		if a != a0:
			a1 = a
			u = i
			break
	print(1, u + 1)
	for (i, a) in enumerate(aa[1:], 1):
		if i == u:
			continue
		if a == a0:
			print(u + 1, i + 1)
		else:
			print(1, i + 1)


from sys import stdin, stdout
input = stdin.readline
print = stdout.write
from random import sample
t = int(input())
from collections import Counter
from math import sqrt, ceil

def find_gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def factorials(n, r):
	slr = n
	dpr = r
	qrr = 1
	qs = 1
	mod = 10 ** 9 + 7
	for ip in range(slr - dpr + 1, slr + 1):
		qlr = qlr * ip % mod
	for ij in range(1, dpr + 1):
		qs = qs * ip % mod
	ans = qlr * modInverse(qs) % mod
	return ans

def ps(n):
	cp = 0
	while n % 2 == 0:
		n = n // 2
		cp += 1
	for ps in range(3, ceil(sqrt(n)) + 1, 2):
		while n % ps == 0:
			n = n // ps
			cp += 1
	if n != 1:
		return False
	return True

def modInverse(b):
	qr = 10 ** 9 + 7
	return pow(b, qr - 2, qr)
for jj in range(t):
	n = int(input())
	arr = [int(x) for x in input().strip().split()]
	pl = Counter(arr)
	qr = min(pl.values())
	tr = 0
	for zz in pl:
		if pl[zz] == qr:
			tr = zz
			break
	lp = []
	qqq = []
	for pp in range(n):
		if arr[pp] == tr:
			lp.append(pp)
		else:
			qqq.append(pp)
	if len(lp) == n:
		print('NO\n')
		continue
	print('YES\n')
	tt = len(lp)
	ill = lp[0]
	for ql in range(n - tt):
		print(str(ill + 1) + ' ' + str(qqq[ql] + 1) + '\n')
	for pr in range(1, tt):
		print(str(lp[pr] + 1) + ' ' + str(qqq[0] + 1) + '\n')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	if len(set(a)) == 1:
		print('NO')
	else:
		print('YES')
		k = a[0]
		for i in range(n):
			if a[i] != k:
				k1 = a[i]
				pos = i
				break
		for i in range(1, n):
			if a[i] != k:
				print(1, i + 1)
			elif a[i] != k1:
				print(pos + 1, i + 1)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	if len(list(set(l))) == 1:
		print('NO')
	else:
		print('YES')
		first = 1
		for i in range(1, n):
			if l[i] != l[0]:
				second = i + 1
				break
		for i in range(1, n):
			if l[i] == l[0]:
				print(second, i + 1)
			else:
				print(first, i + 1)


for _ in range(int(input())):
	n = int(input())
	data = [int(x) for x in input().split()]
	if len(set(data)) == 1:
		print('NO')
	else:
		print('YES')
		visited = [0] * (n + 1)
		visited[1] = 1
		temp = data[0]
		for q in range(2, n + 1):
			if data[q - 1] != temp:
				visited[q] = 1
				pos = q
				print(1, q)
		visited[pos] = 1
		for q in range(2, n + 1):
			if visited[q] == 0:
				print(pos, q)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	s = set(arr)
	if len(s) <= 1:
		print('NO')
	else:
		print('YES')
		s = []
		o = []
		for i in range(len(arr)):
			if arr[i] == arr[0]:
				s.append(i + 1)
			else:
				o.append(i + 1)
		for i in range(1, len(s)):
			print(s[i], o[0])
		for x in o:
			print(s[0], x)


def solver(arr, n):
	if len(set(arr)) == 1:
		print('NO')
		return
	first = arr[0]
	second = 0
	for temp in range(n):
		if arr[temp] != first:
			second = temp
			break
	print('YES')
	for x in range(1, n):
		if arr[x] != first:
			print(1, x + 1)
		else:
			print(second + 1, x + 1)
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	solver(arr, n)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	a0 = a[0]
	k = []
	if len(set(a)) == 1:
		print('NO')
	else:
		print('YES')
		for j in range(1, n):
			if a[j] != a0:
				print(1, j + 1, end='\n')
				a1 = j + 1
			else:
				k.append(j + 1)
		for p in k:
			print(p, a1, end='\n')


from sys import stdin, stdout
import math, bisect
from collections import Counter, deque, defaultdict
L = lambda : list(map(int, stdin.readline().strip().split()))
M = lambda : map(int, stdin.readline().strip().split())
I = lambda : int(stdin.readline().strip())
S = lambda : stdin.readline().strip()
C = lambda : stdin.readline().strip().split()

def pr(a):
	return ''.join(list(map(str, a)))

def solve():
	n = I()
	a = L()
	if a.count(a[0]) == n:
		print('NO')
	else:
		x = -1
		print('YES')
		b = []
		for i in range(1, n):
			if a[0] != a[i]:
				print(1, i + 1)
				x = i + 1
			else:
				b += [i + 1]
		for i in b:
			print(i, x)
for _ in range(I()):
	solve()


import math
from decimal import *
import random
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	mp = {}
	mppos = {}
	ok = False
	err = False
	for i in range(n):
		if arr[i] not in mp:
			mp[arr[i]] = 0
			mppos[arr[i]] = []
		mp[arr[i]] += 1
		mppos[arr[i]].append(i + 1)
	for x in mp:
		if mp[x] == 1:
			ok = True
			print('YES')
			pos = arr.index(x)
			for i in range(n):
				if arr[i] != x:
					print(pos + 1, i + 1)
			break
		if mp[x] == n:
			err = True
	if not ok:
		if err:
			print('NO')
		else:
			print('YES')
			tot = []
			valmppos = sorted(mppos.values(), key=lambda x: len(x))
			for x in valmppos:
				tot += x
			pnt1 = 1
			d = 0
			for i in range(len(tot)):
				if arr[tot[i] - 1] != arr[tot[0] - 1]:
					print(tot[i], tot[0])
					d = int(tot[i])
			while arr[tot[pnt1] - 1] == arr[tot[0] - 1]:
				print(tot[pnt1], d)
				pnt1 += 1


for _ in range(int(input())):
	n = int(input())
	ar = list(map(int, input().split()))
	flag = 0
	visit = [False] * n
	ans = []
	visit[0] = True
	for i in range(n):
		if visit[i] == True:
			visit[i] = True
		else:
			continue
		for j in range(n):
			if visit[j] == False and ar[i] != ar[j]:
				visit[j] = True
				ans.append([i + 1, j + 1])
	for i in visit:
		if i == False:
			flag = 1
			break
	if flag == 0:
		print('YES')
		for j in ans:
			print(*j)
	else:
		print('NO')


def testcase():
	n = int(input())
	arr = list(map(int, input().split()))
	if arr.count(arr[0]) == n:
		print('NO')
		return
	fi = 0
	si = 1
	while si < n and arr[si] == arr[fi]:
		si += 1
	print('YES')
	print(fi + 1, si + 1)
	for i in range(n):
		if i == fi or i == si:
			continue
		if arr[i] == arr[fi]:
			print(i + 1, si + 1)
		else:
			print(i + 1, fi + 1)
	return
import sys, os
if os.path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
t = int(input())
for _ in range(t):
	testcase()


tests = int(input())
for _ in range(tests):
	n = int(input())
	arr = list(map(int, input().strip().split()))
	visited = [False] * n
	if arr.count(arr[0]) == n:
		print('NO')
	else:
		print('YES')
		for i in range(n):
			if not visited[i]:
				for j in range(n):
					if arr[i] != arr[j]:
						print(i + 1, j + 1)
						visited[i] = True
						visited[j] = True
						break


n = int(input())
dist = []
paths = [[]] * n
done = [0] * n
for i in range(n):
	length = int(input())
	test = input().split()
	for i in range(length):
		test[i] = int(test[i])
	dist.append(test)
for i in range(len(dist)):
	path = []
	connected = [0] * len(dist[i])
	for j in range(len(dist[i])):
		for k in range(j + 1, len(dist[i])):
			if dist[i][j] != dist[i][k] and (not (connected[j] and connected[k])):
				connected[j] = 1
				connected[k] = 1
				path.append([j + 1, k + 1])
				paths[i] = path
				if sum(connected) == len(connected):
					done[i] = 1
			if done[i]:
				break
		if done[i]:
			break
for i in range(len(dist)):
	if done[i]:
		print('YES')
		for path in paths[i]:
			print(f'{path[0]} {path[1]}')
	else:
		print('NO')


from sys import stdin, stdout
import math
import heapq
import collections
input = stdin.readline

def inputnum():
	return int(input())

def inputnums():
	return map(int, input().split())

def inputlist():
	return list(map(int, input().split()))

def inputstring():
	return [x for x in input()]

def inputstrings():
	return [x for x in input().split()]

def inputstringnum():
	return [ord(x) - ord('a') for x in input()]

def inputmatrixchar(rows):
	arr2d = [[j for j in input().strip()] for i in range(rows)]
	return arr2d

def inputmatrixint(rows):
	arr2d = []
	for _ in range(rows):
		arr2d.append([int(i) for i in input().split()])
	return arr2d
t = int(input())
for q in range(t):
	n = inputnum()
	a = inputlist()
	if max(a) == min(a):
		print('NO')
		continue
	else:
		print('YES')
	x = 0
	for i in range(1, n):
		if a[i] != a[0]:
			x = i + 1
			print(1, i + 1)
	for i in range(1, n):
		if a[i] == a[0]:
			print(x, i + 1)


t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(i) for i in input().split()]
	if len(set(a)) == 1:
		print('NO')
	else:
		print('YES')
		start = a[0]
		m = []
		z = 0
		for i in range(1, n):
			if a[i] != start:
				print(1, i + 1)
				z = i + 1
			else:
				m.append(i + 1)
		for i in m:
			print(z, i)


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	if len(set(l)) == 1:
		print('NO')
	else:
		dic = {}
		dicindex = {}
		for i in l:
			if i in dic:
				dic[i] = dic[i] + 1
			else:
				dic[i] = 1
		for i in range(n):
			if l[i] in dicindex:
				dicindex[l[i]].append(i)
			else:
				dicindex[l[i]] = []
		min = 9999999999
		for i in dic:
			if dic[i] < min:
				mini = i
				min = dic[i]
		x = l.index(mini)
		print('YES')
		for i in range(n):
			if l[i] != mini:
				y = i
				print(x + 1, i + 1)
		for i in dicindex[mini]:
			print(i + 1, y + 1)


import collections
from heapq import *
for t in range(int(input())):
	n = int(input())
	nums = list(map(int, input().split()))
	k = collections.Counter(nums)
	if len(set(nums)) == 1:
		print('NO')
		continue
	val = min(k.values())
	out = 0
	for i in k:
		if k[i] == val:
			out = i
			break
	l = []
	r = []
	for (i, j) in enumerate(nums):
		if j == out:
			l.append(i)
		else:
			r.append(i)
	print('YES')
	cur = r.pop() + 1
	for i in l:
		print(i + 1, cur)
	cur = l[-1] + 1
	for i in r:
		print(cur, i + 1)


def cal(n, a):
	a = sorted([[a[i], i + 1] for i in range(n)])
	if a[0][0] == a[-1][0]:
		print('NO')
	else:
		print('YES')
		for i in range(n - 1):
			if a[i][0] != a[i - 1][0]:
				t = a[i - 1][1]
			print(t, a[i][1])
N = int(input())
for i in range(N):
	n = int(input())
	a = list(map(int, input().split()))
	cal(n, a)


import os, sys
from io import IOBase, BytesIO
py2 = round(0.5)
if py2:
	from future_builtins import ascii, filter, hex, map, oct, zip
	range = xrange
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.getvalue())
			(self.truncate(0), self.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			self.write = lambda s: self.buffer.write(s.encode('ascii'))
			self.read = lambda : self.buffer.read().decode('ascii')
			self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import sys

class ostream:

	def __lshift__(self, a):
		sys.stdout.write(str(a))
		return self
cout = ostream()
endl = '\n'

def get_input(a=str):
	return a(input())

def get_int_input():
	return get_input(int)

def get_input_arr(a):
	return list(map(a, input().split()))

def get_int_input_arr():
	return get_input_arr(int)
from collections import defaultdict

def solve():
	t = get_int_input()
	for _ in range(t):
		n = get_int_input()
		arr = get_int_input_arr()
		idx_map = defaultdict(lambda : [])
		for i in range(n):
			idx_map[arr[i]].append(i + 1)
		tples = []
		for i in idx_map:
			tples.append((len(idx_map[i]), i))
		tples.sort()
		if len(tples) == 1:
			cout << 'NO' << endl
			continue
		adj_list = defaultdict(lambda : [])
		for l in range(len(tples) - 1):
			curr_1 = tples[l]
			curr_2 = tples[l + 1]
			num_1 = curr_1[1]
			num_2 = curr_2[1]
			for i in range(curr_1[0] - 1):
				adj_list[idx_map[num_1][i]].append(idx_map[num_2][i])
			for i in range(curr_1[0] - 1, curr_2[0]):
				adj_list[idx_map[num_1][-1]].append(idx_map[num_2][i])
			if l == 0:
				for i in range(curr_1[0] - 1):
					adj_list[idx_map[num_1][i]].append(adj_list[idx_map[num_1][i + 1]][0])
		cout << 'YES' << endl
		for i in adj_list:
			for j in adj_list[i]:
				cout << i << ' ' << j << endl

def main():
	solve()
main()


from sys import stdin, stdout
from math import gcd, sqrt, factorial, pi, inf
from collections import deque, defaultdict
input = stdin.readline
R = lambda : map(int, input().split())
I = lambda : int(input())
S = lambda : input().rstrip('\n')
L = lambda : list(R())
P = lambda x: stdout.write(str(x) + '\n')
lcm = lambda x, y: x * y // gcd(x, y)
hg = lambda x, y: (y + x - 1) // x * x
pw = lambda x: 1 if x == 1 else 1 + pw(x // 2)
chk = lambda x: chk(x // 2) if not x % 2 else True if x == 1 else False
sm = lambda x: (x ** 2 + x) // 2
N = 10 ** 6 + 6
for _ in range(I()):
	n = I()
	v = []
	p = -1
	for (i, j) in sorted(enumerate(R(), 1), key=lambda x: x[1]):
		if p != j:
			v += ([],)
			p = j
		v[-1] += (i,)
	v.sort(reverse=True, key=lambda x: len(x))
	if len(v[0]) == n:
		print('NO')
		continue
	print('YES')
	p = v.pop()
	ln = len(v)
	y = v[-1].pop()
	for i in range(1, n):
		if p:
			x = p.pop()
			print(x, y)
		else:
			if not v[-1]:
				del v[-1]
			y = v[-1].pop()
			print(x, y)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	if len(set(a)) == 1:
		print('NO')
		continue
	print('YES')
	rem = []
	for i in range(1, n):
		if a[i] != a[0]:
			print(1, i + 1)
			last = i + 1
		else:
			rem.append(i + 1)
	for i in range(len(rem)):
		print(rem[i], last)


import collections

def solve():
	districts = int(input().strip())
	gangs = [int(x) for x in input().strip().split()]
	cgangs = collections.defaultdict(list)
	for g in range(districts):
		cgangs[gangs[g]].append(1 + g)
	if len(list(cgangs.keys())) < 2:
		print('NO')
		return
	print('YES')
	lk = list(cgangs.keys())
	for (pos, k) in enumerate(lk):
		dest = cgangs[lk[0]][0]
		if pos < len(lk) - 1:
			dest = cgangs[lk[pos + 1]][0]
			for x in cgangs[k]:
				print(x, dest)
		if pos == len(lk) - 1:
			if len(cgangs[k]) > 1:
				for x in cgangs[k][1:]:
					print(x, dest)
for _ in range(int(input().strip())):
	solve()


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	l = list(map(int, input().split()))
	ans = []
	ind = -1
	for i in range(1, n):
		if l[i] != l[0]:
			ans.append([1, i + 1])
			ind = i
	if ind == -1:
		print('NO')
	else:
		for i in range(1, n):
			if l[i] == l[0]:
				ans.append([ind + 1, i + 1])
		print('YES')
		for i in ans:
			print(i[0], i[1])


from sys import stdin, stdout
from collections import defaultdict
ans = []

def main():
	n = int(stdin.readline())
	arr = list(map(int, stdin.readline().split()))
	dictt = defaultdict(list)
	semians = []
	for i in range(n):
		dictt[arr[i]].append(i + 1)
	if len(dictt) == 1:
		ans.append('NO')
		return
	ans.append('YES')
	keys = list(dictt.keys())
	head = dictt[keys[0]][0]
	for key in keys[1:]:
		for i in dictt[key]:
			semians.append(str(head) + ' ' + str(i))
	if len(dictt[keys[0]]) > 1:
		for i in dictt[keys[0]][1:]:
			semians.append(str(dictt[keys[1]][0]) + ' ' + str(i))
	ans.append('\n'.join(semians))
for i in range(int(stdin.readline())):
	main()
stdout.write('\n'.join(ans))


t = int(input())
while t != 0:
	t -= 1
	n = int(input())
	l = list(map(int, input().split()))
	d = {}
	for i in range(n):
		if l[i] in d:
			d[l[i]].append(i + 1)
		else:
			d[l[i]] = [i + 1]
	if len(d) == 1:
		print('NO')
	else:
		print('YES')
		mn = 5001
		gang = 0
		for i in d:
			if len(d[i]) < mn:
				mn = len(d[i])
				gang = i
		node = d[gang][-1]
		dif = 0
		for i in range(n):
			if l[i] != gang:
				dif = i
				break
		for i in range(n):
			if l[i] != gang:
				print(node, i + 1)
		for i in range(len(d[gang]) - 1):
			print(d[gang][i], dif + 1)


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	maximum = max(arr)
	for i in range(n):
		if arr[i] != maximum:
			break
	else:
		print('NO')
		continue
	connected = {i: False for i in range(n)}
	edges = []
	for elem in connected:
		if not connected[elem]:
			for i in range(n):
				if arr[i] != arr[elem]:
					edges.append((i + 1, elem + 1))
					connected[elem] = True
					connected[i] = True
					break
	print('YES')
	for edge in edges:
		print(edge[0], edge[1])


t = int(input())
for z in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	freq = {}
	for i in range(n):
		if arr[i] in freq:
			freq[arr[i]] += 1
		else:
			freq[arr[i]] = 1
	arrvalues = list(freq.values())
	if len(arrvalues) == 1:
		print('NO')
		continue
	print('YES')
	key = arr[0]
	min = 0
	for i in range(n):
		if arr[i] != key:
			print(1, i + 1)
			min = i
	for i in range(1, n):
		if arr[i] == key:
			print(min + 1, i + 1)


t = int(input())

def calc():
	n = int(input())
	arr = [(0, 0)] * n
	inparr = str(input()).split(' ')
	for j in range(n):
		arr[j] = (int(inparr[j]), j + 1)
	arr.sort()
	first = arr[0]
	second = arr[-1]
	if first[0] == second[0]:
		print('NO')
		return
	print('YES')
	for j in range(1, n):
		if first[0] == arr[j][0]:
			print(str(second[1]) + ' ' + str(arr[j][1]))
		else:
			print(str(first[1]) + ' ' + str(arr[j][1]))
for i in range(t):
	calc()


from collections import deque
for t in range(int(input())):
	n = int(input())
	(*a,) = map(int, input().split())
	used = [False] * n
	used[0] = True
	q = deque([0])
	ans = []
	while q:
		v = q.popleft()
		for u in range(n):
			if a[v] != a[u] and (not used[u]):
				ans.append([v, u])
				q.appendleft(u)
				used[u] = True
	if len(ans) == n - 1:
		print('YES')
		for (u, v) in ans:
			print(u + 1, v + 1)
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(s) for s in input().split(' ')]
	first = a[0]
	no = True
	for el in a:
		if el != first:
			no = False
	if no:
		print('NO')
	else:
		print('YES')
		center = a[0]
		for i in range(n):
			if a[i] != center:
				tail = i + 1
				break
		for i in range(1, n):
			if a[i] != center:
				print(1, i + 1)
			else:
				print(tail, i + 1)


import sys, os, io
input = sys.stdin.readline

class UnionFind:

	def __init__(self, n):
		self.n = n
		self.parents = [-1] * n

	def find(self, x):
		if self.parents[x] < 0:
			return x
		else:
			self.parents[x] = self.find(self.parents[x])
		return self.parents[x]

	def union(self, x, y):
		x = self.find(x)
		y = self.find(y)
		if x == y:
			return
		if self.parents[x] > self.parents[y]:
			(x, y) = (y, x)
		self.parents[x] += self.parents[y]
		self.parents[y] = x

	def same(self, x, y):
		return self.find(x) == self.find(y)

	def roots(self):
		return [i for (i, x) in enumerate(self.parents) if x < 0]

	def num_roots(self):
		return len([i for (i, x) in enumerate(self.parents) if x < 0])

	def members(self, x):
		root = self.find(x)
		return [i for i in range(self.n) if self.find(i) == root]

	def num_members(self, x):
		return abs(self.parents[self.find(x)])

	def __str__(self):
		return '\n'.join(('{}: {}'.format(r, self.members(r)) for r in self.roots()))
T = int(input())
ans = [0] * T
for t in range(T):
	n = int(input())
	A = list(map(int, input().split()))
	uf = UnionFind(n)
	ans = []
	cnt = 0
	for i in range(n):
		for j in range(n):
			if A[i] != A[j] and (not uf.same(i, j)):
				uf.union(i, j)
				ans.append((i + 1, j + 1))
				cnt += 1
	if cnt == n - 1:
		print('YES')
		for a in ans:
			print(*a)
	else:
		print('NO')


t = int(input())
while t:
	n = int(input())
	a = input()
	a = [int(x) for x in a.split()]
	se = set(a)
	q = []
	if len(se) == 1:
		print('NO')
		t -= 1
		continue
	print('YES')
	se = list(se)
	se.append(se[0])
	for i in se:
		q.append(a.index(i) + 1)
	for i in range(n):
		if i != 0:
			b = se.index(a[i])
			print(i + 1, q[b + 1])
	t -= 1


for i in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	if len(set(a)) > 1:
		print('YES')
		for i in range(1, n):
			if a[i] != a[0]:
				q = i + 1
				break
		for i in range(1, n):
			if a[i] != a[0]:
				print(i + 1, 1)
			else:
				print(i + 1, q)
	else:
		print('NO')


from sys import stdin, stdout
import math, sys, heapq
from itertools import permutations, combinations
from collections import defaultdict, deque, OrderedDict
from os import path
import random
import bisect as bi

def yes():
	print('YES')

def no():
	print('NO')
if path.exists('input.txt'):
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

	def I():
		return int(input())

	def In():
		return map(int, input().split())
else:

	def I():
		return int(stdin.readline())

	def In():
		return map(int, stdin.readline().split())

def dict(a):
	d = {}
	for x in a:
		if d.get(x, -1) != -1:
			d[x] += 1
		else:
			d[x] = 1
	return d

def find_gt(a, x):
	i = bi.bisect_left(a, x)
	if i != len(a):
		return i
	else:
		return -1

def main():
	try:
		n = I()
		l = list(In())
		ans = []
		temp = l[0]
		same = []
		for x in range(1, n):
			if l[x] != temp:
				ans.append([1, x + 1])
			else:
				same.append(x)
		if len(same) == n - 1:
			no()
		else:
			temp = ans[0][1]
			for x in same:
				ans.append([temp, x + 1])
			yes()
			for x in ans:
				print(*x)
	except:
		pass
M = 998244353
P = 1000000007
for _ in range(I()):
	main()


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	if len(set(a)) == 1:
		print('NO')
		continue
	print('YES')
	lst = []
	for i in range(1, len(a)):
		if a[i] != a[0]:
			print(1, i + 1)
		else:
			lst.append(i + 1)
	for i in range(len(a)):
		if a[i] != a[0]:
			for j in range(len(lst)):
				print(lst[j], i + 1)
			break


import os
from heapq import heapify, heappop, heappush
import sys
import math
import operator
import bisect
from collections import defaultdict
from io import BytesIO, IOBase
sys.setrecursionlimit(10 ** 5)

def inpt():
	return [int(k) for k in input().split()]

def main():
	for _ in range(int(input())):
		n = int(input())
		ar = inpt()
		st = set(ar)
		if len(st) == 1:
			print('NO')
			continue
		u = ar[0]
		ans = []
		nt = -1
		for i in range(1, n):
			if ar[i] != u:
				ans.append((1, i + 1))
				nt = i + 1
		for i in range(1, n):
			if ar[i] == u:
				ans.append((nt, i + 1))
		print('YES')
		for i in ans:
			print(i[0], i[1])
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


import sys
inp = sys.stdin.buffer.readline
inar = lambda : list(map(int, inp().split()))
inin = lambda : int(inp())
inst = lambda : inp().decode().strip()
wrt = sys.stdout.write
pr = lambda *args, end='\n': wrt(' '.join([str(x) for x in args]) + end)
enum = enumerate
inf = float('inf')
cdiv = lambda x, y: -(-x // y)
mod = 1000000007
_T_ = inin()
for _t_ in range(_T_):
	n = inin()
	a = inar()
	(mx, mn) = (max(a), min(a))
	if mx == mn:
		print('NO')
	else:
		print('YES')
		(mxi, mni) = (-1, -1)
		fmi = -1
		for i in range(n):
			if a[i] == mx and fmi == -1:
				fmi = i + 1
			if a[i] == mx:
				mxi = i + 1
			if a[i] == mn:
				mni = i + 1
		for i in range(n):
			if i + 1 == fmi:
				continue
			if a[i] == mx:
				print(mni, i + 1)
			else:
				print(fmi, i + 1)


tc = int(input())
for _ in range(tc):
	n = int(input())
	arr = list(map(int, input().split()))
	x = arr[0]
	flag = 0
	for i in arr:
		if x != i:
			flag = 1
			y = arr.index(i)
			z = i
			break
	if flag == 0:
		print('NO')
	else:
		print('YES')
		for i in range(n):
			if i != y:
				if arr[i] != z:
					print(min(y + 1, i + 1), max(y + 1, i + 1))
				else:
					print(1, i + 1)


for _ in range(int(input())):
	n = int(input())
	ar = list(map(int, input().split()))
	if len(set(ar)) == 1:
		print('NO')
	else:
		print('YES')
		d = {}
		for i in ar:
			try:
				d[i] += 1
			except:
				d[i] = 1
		center = -1
		for i in d:
			if d[i] == 1:
				center = i
				break
		if center == -1:
			mini = 10000000000
			for i in d:
				if d[i] < mini:
					miniV = i
					mini = d[i]
			toMatch = []
			for i in range(n):
				if ar[i] != miniV:
					toMatch.append(i)
				else:
					untouch = i
			current = 0
			for i in range(n):
				if ar[i] != miniV:
					print(untouch + 1, i + 1)
				elif i != untouch:
					print(i + 1, toMatch[current] + 1)
					current += 1
		else:
			for i in range(n):
				if ar[i] == center:
					untouch = i
			for i in range(n):
				if i != untouch:
					print(untouch + 1, i + 1)


T = int(input())
for _ in range(0, T):
	n = int(input())
	s = [int(x) for x in input().split()]
	if len(set(s)) == 1:
		print('NO')
	else:
		print('YES')
		kk = dict()
		ele1 = -1
		ele2 = -1
		p1 = -1
		p2 = -1
		for i in range(0, len(s)):
			if ele1 == -1:
				ele1 = s[i]
				p1 = i
			elif s[i] != ele1:
				ele2 = s[i]
				p2 = i
		for i in range(1, len(s)):
			if s[i] == ele1:
				print(p2 + 1, i + 1)
			else:
				print(p1 + 1, i + 1)


for u in range(int(input())):
	n = int(input())
	x = [int(w) for w in input().split()]
	if len(set(x)) == 1:
		print('NO')
	else:
		print('YES')
		d = {}
		for i in x:
			d[i] = d.get(i, 0) + 1
		ans = 1
		m = 10 ** 20
		for i in d:
			if m > d[i]:
				m = d[i]
				ans = i
		t = 0
		z = 0
		l = []
		p = 1 + x.index(ans)
		for i in range(n):
			if x[i] != ans:
				z = x[i]
				print(i + 1, p)
			else:
				l.append(i + 1)
		p1 = x.index(z) + 1
		for i in range(1, len(l)):
			print(p1, l[i])


t = int(input())
for _ in range(t):
	num = int(input())
	a = list(map(int, input().split()))
	s = list(set(a))
	if len(s) == 1:
		print('NO')
	else:
		print('YES')
		for i in range(1, num):
			if a[i] != a[0]:
				c = a[i]
				u = i
				break
		for i in range(1, num):
			if a[i] != a[0]:
				print(1, i + 1)
			elif a[i] != c:
				print(u + 1, i + 1)


from math import sqrt
from sys import stdin, stdout
for _ in range(int(stdin.readline())):
	n = int(stdin.readline())
	l = list(map(int, stdin.readline().split()))
	shan = 0
	sree = l[0]
	siri = []
	mps = []
	for i in range(1, n):
		if l[i] != sree:
			shan = i + 1
			mps.append([1, i + 1])
		else:
			siri.append(i + 1)
	if shan > 0:
		print('YES')
		for i in siri:
			mps.append([shan, i])
		for e in mps:
			print(*e)
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	if a.count(a[0]) == len(a):
		print('NO')
	else:
		print('YES')
		root = []
		leaf_root = []
		for i in range(n):
			if a[i] == a[0]:
				root.append(i + 1)
			else:
				leaf_root.append(i + 1)
		for i in range(1, len(root)):
			print(root[i], leaf_root[0])
		for j in leaf_root:
			print(j, root[0])


from collections import defaultdict
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	set_ = set(l)
	if len(set_) == 1:
		print('NO')
	else:
		d = defaultdict(list)
		start = l[0]
		start_idx = 0
		r = False
		extra = []
		for i in range(1, n):
			if l[i] != start:
				d[start_idx + 1].append(i + 1)
			elif len(d[start_idx + 1]) != 0:
				d[d[start_idx + 1][-1]].append(i + 1)
			else:
				r = True
				extra.append(i + 1)
		if r:
			for j in extra:
				d[d[start_idx + 1][-1]].append(j)
		print('YES')
		for k in d:
			for p in d[k]:
				print(k, p)


def apt(n, arr):
	H = {}
	for c in arr:
		H[c] = H.get(c, 0) + 1
	Count = 0
	for c in H:
		Count += H[c] * (H[c] - 1) // 2
	if n * (n - 1) // 2 - Count < n - 1:
		return []
	s1 = 0
	for i in range(n):
		if arr[i] != arr[0]:
			s2 = i
			break
	edges = [[1, s2 + 1]]
	for i in range(n):
		if i == s1 or i == s2:
			continue
		if arr[i] != arr[s1]:
			edges.append([s1 + 1, i + 1])
		else:
			edges.append([s2 + 1, i + 1])
	return edges
t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	temp = apt(n, arr)
	if not temp:
		print('NO')
	else:
		print('YES')
		for L in temp:
			print(*L)


from collections import defaultdict

def solution():
	n = int(input())
	A = list(map(int, input().split()))
	a = defaultdict(list)
	for (i, v) in enumerate(A):
		a[v].append(i + 1)
	if len(a.keys()) == 1:
		print('NO')
		return
	else:
		ans = []
		groups = list(a.keys())
		(u, v) = (groups[0], groups[1])
		base = a[u][0]
		secbase = a[v][0]
		for i in range(1, len(groups)):
			for node in a[groups[i]]:
				ans.append((base, node))
		for i in range(1, len(a[u])):
			ans.append((secbase, a[u][i]))
		print('YES')
		for (x, y) in ans:
			print(x, y)
		return

def main():
	testcase = int(input())
	for i in range(testcase):
		solution()
	return
main()


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	k = [[], []]
	for i in range(1, len(l)):
		if l[0] != l[i]:
			k[0].append(i + 1)
		else:
			k[1].append(i + 1)
	if len(k[0]) > 0:
		print('YES')
		for i in k[0]:
			print(1, i)
		if len(k[1]) > 0:
			for i in k[1]:
				print(k[0][0], i)
	else:
		print('NO')


from sys import stdin
input = lambda : stdin.readline().strip()
lin = lambda : list(map(int, input().split()))
iin = lambda : int(input())
main = lambda : map(int, input().split())
from math import ceil, sqrt, factorial, log
from collections import deque
from bisect import bisect_left

def gcd(a, b):
	(a, b) = (max(a, b), min(a, b))
	while a % b != 0:
		(a, b) = (b, a % b)
	return b
mod = 998244353

def solve(we):
	n = int(input())
	l = lin()
	ma = 0
	d = {}
	for i in range(n):
		if l[i] in d:
			d[l[i]].append(i + 1)
		else:
			d[l[i]] = [i + 1]
		ma = max(ma, len(d[l[i]]))
	if len(d) == 1:
		print('NO')
	else:
		print('YES')
		t = 0
		for i in d:
			if t == 0:
				x = d[i].pop()
				x1 = i
			elif t == 1:
				y = d[i].pop()
				y1 = i
			else:
				break
			t += 1
		print(x, y)
		for i in d:
			if i == x1:
				for j in d[i]:
					print(y, j)
			else:
				for j in d[i]:
					print(x, j)
qwe = 1
qwe = int(input())
for _ in range(qwe):
	solve(_ + 1)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	st = set(a)
	if len(st) == 1:
		ans = -1
	else:
		l = []
		rt = a[0]
		sec = -1
		for i in range(1, n):
			if a[i] != rt:
				l.append((1, i + 1))
				sec = i + 1
		for i in range(1, n):
			if rt == a[i]:
				l.append((sec, i + 1))
		ans = 1
	if ans == -1:
		print('NO')
	else:
		print('YES')
		for i in l:
			print(i[0], i[1])


for _ in range(int(input())):
	a = int(input())
	b = list(map(int, input().split()))
	if len(list(set(b))) == 1:
		print('NO')
	else:
		print('YES')
		for i in range(a):
			b[i] = (b[i], i + 1)
		b.sort()
		i = a - 1
		while i > 0 and b[i][0] != b[0][0]:
			print(b[0][1], b[i][1])
			i -= 1
		j = i + 1
		while i >= 1:
			print(b[i][1], b[j][1])
			i -= 1


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	x = a[0]
	k = 0
	kk = 0
	gg = 0
	if a.count(x) == n:
		print('NO')
	else:
		print('YES')
		if len(set(a)) == n:
			for i in range(1, n):
				print(i, i + 1)
		else:
			for i in range(n):
				if a[i] != x:
					y = a[i]
					ind = i
			for i in range(1, n):
				if a[i] != x:
					print(1, i + 1)
				elif a[i] != y:
					print(ind + 1, i + 1)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	res = 0
	axx = []
	if min(a) == max(a):
		print('NO')
	else:
		print('YES')
		for i in range(1, len(a)):
			if a[i] != a[0]:
				print(1, i + 1)
				res = i
			else:
				axx.append(i)
		for k in range(len(axx)):
			print(res + 1, axx[k] + 1)


import sys, os
from math import sqrt, gcd, ceil, log, floor
from bisect import bisect, bisect_left
from collections import defaultdict, Counter, deque
from heapq import heapify, heappush, heappop
input = sys.stdin.readline
read = lambda : list(map(int, input().strip().split()))
MOD = 10 ** 9 + 7

def main():
	ans_ = []
	for _ in range(int(input())):
		n = int(input())
		arr = read()
		if len(set(arr)) == 1:
			ans_.append('NO')
			continue
		dic = defaultdict(list)
		for i in range(n):
			dic[arr[i]].append(i + 1)
		(x, y) = list(dic.keys())[:2]
		ans_.append('YES')
		for i in dic:
			if i != x:
				for j in dic[i]:
					ans_.append(str(dic[x][-1]) + ' ' + str(j))
		for i in dic[x][:-1]:
			ans_.append(str(i) + ' ' + str(dic[y][0]))
	print('\n'.join(ans_))
main()


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	b = []
	q = -1
	if max(a) * n == sum(a):
		print('NO')
		continue
	print('YES')
	for i in range(1, n):
		if a[0] != a[i]:
			print(1, i + 1)
			q = i + 1
		else:
			b.append(i + 1)
	for i in range(len(b)):
		print(q, b[i])


from collections import Counter
t = int(input())
for z in range(t):
	n = int(input())
	a = [int(q) for q in input().split()]
	d = Counter(a)
	index = 0
	ans = True
	for i in d:
		if d[i] == 1:
			index = a.index(i)
			break
	if len(d) == 1:
		print('NO')
		ans = False
	else:
		print('YES')
	if ans:
		for j in range(n):
			if j != index and a[j] != a[index]:
				print(index + 1, j + 1)
				rest = j
		for k in range(n):
			if a[k] == a[index] and k != index:
				print(rest + 1, k + 1)


from collections import defaultdict
t = int(input())
while t > 0:
	n = int(input())
	d = defaultdict(list)
	arr = [int(i) for i in input().split()]
	for i in range(n):
		k = arr[i]
		d[k] += [i + 1]
	min_ = n
	idx = 0
	key = 0
	for (k, v) in d.items():
		if len(v) < min_:
			min_ = len(v)
			idx = v[0]
			key = k
	if min_ == n:
		print('NO')
	else:
		print('YES')
		s = 0
		for (k, v) in d.items():
			if k != key:
				while len(v):
					print(idx, ' ', v[0])
					s = v[0]
					v.pop(0)
		d[key].pop(0)
		while len(d[key]):
			print(s, ' ', d[key][0])
			d[key].pop(0)
	t -= 1


from collections import *
import sys
input = sys.stdin.readline

def ri():
	return int(input())

def rl():
	return list(map(int, input().split()))
t = ri()
for _ in range(t):
	n = ri()
	aa = rl()
	myCounter = Counter(aa)
	(least_common_node, mini) = myCounter.most_common()[-1]
	if mini == n:
		print('NO')
		continue
	print('YES')
	done = [0] * n
	j = 0
	first = True
	first_node = -1
	for i in range(n):
		if aa[i] == least_common_node:
			if first == False:
				print(i + 1, j + 1)
				j += 1
			else:
				first_node = i
				first = False
			while aa[j] == least_common_node:
				j += 1
			print(i + 1, j + 1)
			done[j] = 1
	for j in range(n):
		if aa[j] != least_common_node and done[j] == 0:
			print(first_node + 1, j + 1)


t = int(input())
for p in range(t):
	n = int(input())
	array = list(map(int, input().split()))
	first_type = array[0]
	x = True
	for i in range(n):
		if array[i] != first_type:
			index_of_second_type = i
			x = False
			break
	if x:
		print('NO')
	else:
		print('YES')
		for i in range(1, n):
			if array[i] != first_type:
				print('1 %s' % (i + 1))
			else:
				print('%s %s' % (i + 1, index_of_second_type + 1))


t = int(input())
ans = []
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	if max(a) == min(a):
		ans.append('NO')
	else:
		ans.append('YES')
		m = min(a)
		indm = a.index(m)
		indma = a.index(max(a))
		for i in range(len(a)):
			if a[i] != m:
				ans.append(str(indm + 1) + ' ' + str(i + 1))
			elif a[i] == m and i != indm:
				ans.append(str(indma + 1) + ' ' + str(i + 1))
for x in ans:
	print(x)


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	A = list(map(int, input().split(' ')))
	if A.count(A[0]) == n:
		print('NO')
	else:
		print('YES')
		d1 = A[0]
		for i in range(1, n):
			if A[i] != d1:
				d2 = A[i]
				d2_in = i
		check = [1] * n
		check[0] = 0
		for i in range(1, n):
			if A[i] != d1:
				print(1, i + 1)
				check[i] = 0
		for i in range(n):
			if A[i] != d2 and check[i] == 1:
				print(d2_in + 1, i + 1)
				check[i] = 0


for _ in ' ' * int(input()):
	a = int(input())
	b = list(map(int, input().split()))
	if len(set(b)) == 1:
		print('NO')
	else:
		print('YES')
		o = list(set(b))
		(p1, p2) = (o[0], o[1])
		(z1, z2) = (b.index(p1), b.index(p2))
		print(z1 + 1, z2 + 1)
		for i in range(a):
			if i == z1 or i == z2:
				continue
			if p1 != b[i]:
				print(z1 + 1, i + 1)
			else:
				print(z2 + 1, i + 1)


def R():
	return map(int, input().split())

def L():
	return list(map(int, input().split()))

def I():
	return int(input())
for _ in range(I()):
	n = I()
	a = L()
	s = set()
	for i in range(1, n):
		if a[i] == a[0]:
			s.add(i)
			continue
		rr = i
	if min(a) == max(a):
		print('NO')
	else:
		print('YES')
		for i in range(n):
			if a[i] != a[0]:
				print(i + 1, 1)
		for j in s:
			print(rr + 1, j + 1)


t = int(input())
for p in range(t):
	n = int(input())
	seq = input().split()
	resp = 'NO'
	sobrou = seq[1:]
	sobrouInd = [i + 1 for i in range(len(sobrou))]
	resp = []
	for i in range(n):
		aux = []
		auxInd = []
		for j in range(len(sobrou)):
			if seq[i] != sobrou[j]:
				resp.append(str(i + 1) + ' ' + str(sobrouInd[j] + 1))
			else:
				aux.append(sobrou[j])
				auxInd.append(sobrouInd[j])
		if len(aux) == 0:
			break
		sobrou = aux
		sobrouInd = auxInd
	if len(resp) == n - 1:
		print('YES')
		for e in resp:
			print(e)
	else:
		print('NO')


from itertools import permutations
from collections import defaultdict
from math import *
import os
import sys
from io import BytesIO, IOBase
from heapq import nlargest
from bisect import *
import copy
import itertools
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')
t = int(input())
while t:
	t -= 1
	n = int(input())
	arr = list(map(int, input().split()))
	if len(set(arr)) == 1:
		print('NO')
	else:
		print('YES')
		pos = n
		for i in range(n - 1):
			for j in range(i + 1, n):
				isPrinted = False
				if arr[i] != arr[j]:
					isPrinted = True
					print(i + 1, j + 1)
					break
			if isPrinted == False:
				pos = i + 1
				break
		for i in range(pos, n):
			for j in range(i):
				if arr[i] != arr[j]:
					print(i + 1, j + 1)
					break


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	ans = []
	root = arr[0]
	visited = [False] * n
	visited[0] = True
	temp = 0
	for i in range(1, n):
		if arr[i] != root:
			ans.append([1, i + 1])
			visited[i] = True
			temp = i
	if len(ans) == 0:
		print('NO')
		continue
	for i in range(n):
		if visited[i] is False:
			ans.append([temp + 1, i + 1])
	print('YES')
	for i in ans:
		print(*i)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	if max(a) == min(a):
		print('NO')
	else:
		print('YES')
		for j in range(len(a) - 1):
			r = len(a) - 1
			while a[j] == a[r]:
				r -= 1
			print(j + 1, r + 1)


T = int(input())
for t in range(T):
	n = int(input())
	a = list(map(int, input().split()))
	ans = set()
	setA = set()
	firstocc = dict()
	for i in range(n):
		if a[i] not in setA:
			setA.add(a[i])
			firstocc[a[i]] = i
	if len(setA) == 1:
		print('NO')
		continue
	print('YES')
	for i in range(n):
		for k in firstocc.keys():
			if k != a[i]:
				m = firstocc[k]
				ans.add((min(m, i), max(m, i)))
				break
	for x in ans:
		print(x[0] + 1, x[1] + 1)


t = int(input())
for test_case in range(t):
	n = [int(x) for x in input().split()]
	n = n[0]
	a = [int(y) for y in input().split()]
	res = 0
	dict = {}
	for i in range(n):
		if a[i] not in dict:
			dict[a[i]] = [i]
		else:
			dict[a[i]].append(i)
	for i in dict.keys():
		mylen = [len(dict[i]), dict[i]]
		break
	for (key, value) in dict.items():
		if len(dict[key]) < mylen[0]:
			mylen = [len(dict[key]), dict[key]]
	route2 = -1
	for i in range(n):
		for j in range(len(mylen[1])):
			if i == mylen[1][j]:
				break
		else:
			route2 = i
	myband = a[mylen[1][0]]
	route1 = mylen[1][0]
	if route2 == -1:
		res = 'NO'
	else:
		res = []
		for i in range(n):
			if i != route1:
				if a[i] == myband:
					res.append([route2 + 1, i + 1])
				else:
					res.append([route1 + 1, i + 1])
	print()
	if res == 'NO':
		print(res)
	else:
		print('YES')
		for i in res:
			print(*i)
	print()


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	cur = a[0]
	if a.count(a[0]) == n:
		print('NO')
	else:
		print('YES', end='\n')
		b = [0 for j in range(n)]
		b[0] = 1
		for i in range(1, n):
			if a[i] != a[0]:
				b[i] = 1
				flag = i + 1
				print(1, i + 1, end='\n')
		for i in range(n):
			if a[i] == a[0] and b[i] == 0:
				print(flag, i + 1, end='\n')


def f():
	n = int(input())
	a = list(map(int, input().split()))
	try:
		j = 0
		while a[j] == a[0]:
			j += 1
	except:
		print('NO')
		return 0
	print('YES')
	for k in range(1, n):
		item = a[k]
		if item == a[0]:
			print(str(j + 1) + ' ' + str(k + 1))
		else:
			print(str(k + 1) + ' 1')
t = int(input())
for i in range(t):
	f()


import sys

def read(func=int):
	return func(sys.stdin.readline().strip())

def readList(func=int):
	return list(map(func, sys.stdin.readline().strip().split()))
t = read()
for _ in range(t):
	n = read()
	A = readList()
	d = set()
	m = {}
	k = []
	for i in range(n):
		num = A[i]
		if not num in d:
			d.add(num)
			k.append(num)
		m[num] = m.get(num, []) + [i + 1]
	if len(d) == 1:
		print('NO')
	else:
		print('YES')
		for i in range(len(d)):
			neig = k[i]
			elem = m[k[i]]
			if i == 0:
				for j in range(1, len(elem)):
					print(elem[j], m[k[-1]][0])
			elif i == 1:
				to = i + 1
				if len(d) == 2:
					to = i - 1
				for j in range(len(elem)):
					print(elem[j], m[k[to]][0])
			else:
				for j in range(len(elem)):
					print(elem[j], m[k[0]][0])


from collections import Counter
from collections import OrderedDict
from collections import defaultdict
import bisect

def freq_count(mylist):
	return Counter(mylist)
t = int(input())
for _ in range(t):
	n = int(input())
	arr = [int(x) for x in input().split()]
	set1 = set(arr)
	if len(set1) < 2:
		print('NO')
		continue
	print('YES')
	c = n - 1
	for i in range(1, n):
		if arr[i] != arr[0]:
			print(1, i + 1)
			get = i + 1
			c -= 1
	i = 1
	while c > 0:
		if arr[i] == arr[0]:
			print(get, i + 1)
			c -= 1
		i += 1


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	d = {}
	for i in range(n):
		if arr[i] not in d:
			d[arr[i]] = []
		d[arr[i]].append(i + 1)
	if len(d) == 1:
		print('NO')
	else:
		print('YES')
		keys = list(d.keys())
		k1 = keys[0]
		x = d[k1][0]
		for k2 in keys[1:]:
			for y in d[k2]:
				print(x, y)
		for x in d[k1][1:]:
			print(x, y)


for _ in range(int(input()) if True else 1):
	n = int(input())
	a = list(map(int, input().split()))
	if len(set(a)) == 1:
		print('NO')
		continue
	print('YES')
	p = list(set(a))
	i1 = a.index(p[0])
	i2 = a.index(p[1])
	for i in range(n):
		if a[i] == p[0]:
			if i != i1:
				print(i + 1, i2 + 1)
		else:
			print(i + 1, i1 + 1)


from collections import defaultdict
t = int(input())
for _ in range(t):
	n = int(input())
	d = defaultdict(lambda : 0)
	s = list(map(int, input().split()))
	for i in range(n):
		d[s[i]] += 1
	q = max(d, key=d.get)
	p = max(d.values())
	if n == p:
		print('NO')
	else:
		print('YES')
		a = None
		i = 0
		while i < n - 1:
			if s[i] != s[i + 1]:
				print(str(i + 1) + ' ' + str(i + 2))
				a = i + 1
				i += 1
			elif a == None:
				j = i
				while j < n:
					if s[j] != s[j + 1]:
						break
					j += 1
				a = j + 1
				for k in range(i, j + 1):
					print(str(j + 2) + ' ' + str(k + 1))
				i = j + 1
			else:
				print(str(a) + ' ' + str(i + 2))
				i += 1


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	i = 0
	x = a[0]
	while i < n and a[i] == x:
		i += 1
	if i == n:
		print('NO')
		continue
	print('YES')
	m = 1
	while a[m] == a[0]:
		m += 1
	for i in range(1, n):
		if a[i] != a[0]:
			print(1, i + 1)
		else:
			print(min(i + 1, m + 1), end=' ')
			print(max(i + 1, m + 1), end=' ')
			print()


import array
T = int(input())
for Tid in range(T):
	n = int(input())
	a = array.array('i', map(int, input().split()))
	(f1, f2) = (0, -1)
	for i in range(n):
		if a[i] != a[0]:
			f2 = i
	if f2 == -1:
		print('NO')
	else:
		print('YES')
		print(0 + 1, f2 + 1)
		for i in range(1, n):
			if i != f2:
				if a[i] != a[0]:
					print(0 + 1, i + 1)
				else:
					print(f2 + 1, i + 1)


T = int(input())
for i in range(T):
	N = int(input())
	l = list(map(int, input().split()))
	m = 0
	s = -1
	dicti = {}
	for j in range(N):
		if l[j] in dicti:
			dicti[l[j]] += 1
		else:
			dicti[l[j]] = 1
		m = max(m, dicti[l[j]])
	if m == N:
		print('NO')
		continue
	print('YES')
	for t in range(1, N):
		if l[t] != l[0]:
			s = t
			break
	for k in range(1, N):
		if l[k] != l[0]:
			print(1, k + 1)
		else:
			print(s + 1, k + 1)


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	x = l[0]
	for i in range(1, n):
		if i == n - 1 and l[i] == x:
			print('NO')
			break
		elif l[i] == x:
			continue
		else:
			y = l[i]
			print('YES')
			print('1', i + 1)
			for j in range(1, i):
				print(j + 1, i + 1)
			for j in range(i + 1, n):
				if x == l[j]:
					print(i + 1, j + 1)
				else:
					print('1', j + 1)
			break


from collections import defaultdict
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	d = defaultdict(list)
	for i in range(n):
		d[l[i]].append(i + 1)
	ansgfbhw = []
	count = 0
	for i in d.keys():
		count += 1
	if count == 1:
		print('NO')
		continue
	for i in d.keys():
		ansgfbhw.append(d[i])
	ansgfbhw = sorted(ansgfbhw, key=len)[::-1]
	if len(ansgfbhw) == 1:
		print('NO')
		continue
	x = ansgfbhw[-1]
	bshabfbkaskn = []
	s = []
	for i in range(len(ansgfbhw) - 1):
		for j in ansgfbhw[i]:
			bshabfbkaskn.append([ansgfbhw[-1][0], j])
			s.append(j)
	j = 0
	for i in range(1, len(ansgfbhw[-1])):
		bshabfbkaskn.append([s[j], ansgfbhw[-1][i]])
		j += 1
	print('YES')
	for i in bshabfbkaskn:
		print(*i)


import sys, math, cmath, time
start_time = time.time()

def solve():
	n = inp()
	a = inlt()
	if len(set(a)) == 1:
		print('NO')
	else:
		print('YES')
		q = dict()
		for i in range(len(a)):
			if a[i] in q:
				q[a[i]] = q[a[i]] + 1
			else:
				q[a[i]] = 1
		w = min(q.values())
		qw = [key for key in q if q[key] == w][0]
		for i in range(len(a)):
			if a[i] != qw:
				w = i + 1
				break
		q = a.index(qw) + 1
		for i in range(len(a)):
			if i + 1 != q and a[i] != qw:
				print(q, i + 1)
			elif i + 1 != q and a[i] == qw:
				print(w, i + 1)

def main():
	global tt
	if not ONLINE_JUDGE:
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	t = 1
	t = inp()
	for tt in range(1, t + 1):
		solve()
	if not ONLINE_JUDGE:
		print('Time Elapsed :', time.time() - start_time, 'seconds')
		sys.stdout.close()

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	return input().strip()

def invr():
	return map(int, input().split())

def counter(a):
	q = [0] * max(a)
	for i in range(len(a)):
		q[a[i] - 1] = q[a[i] - 1] + 1
	return q

def counter_elements(a):
	q = dict()
	for i in range(len(a)):
		if a[i] not in q:
			q[a[i]] = 0
		q[a[i]] = q[a[i]] + 1
	return q

def string_counter(a):
	q = [0] * 26
	for i in range(len(a)):
		q[ord(a[i]) - 97] = q[ord(a[i]) - 97] + 1
	return q

def factorial(n, m=1000000007):
	q = 1
	for i in range(n):
		q = q * (i + 1) % m
	return q

def factors(n):
	q = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			q.append(i)
			q.append(n // i)
	return list(sorted(list(set(q))))

def prime_factors(n):
	q = []
	while n % 2 == 0:
		q.append(2)
		n = n // 2
	for i in range(3, int(n ** 0.5) + 1, 2):
		while n % i == 0:
			q.append(i)
			n = n // i
	if n > 2:
		q.append(n)
	return list(sorted(q))

def transpose(a):
	(n, m) = (len(a), len(a[0]))
	b = [[0] * n for i in range(m)]
	for i in range(m):
		for j in range(n):
			b[i][j] = a[j][i]
	return b

def power_two(x):
	return x and (not x & x - 1)

def ceil(a, b):
	return -(-a // b)

def seive(n):
	a = [1]
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p ** 2, n + 1, p):
				prime[i] = False
		p = p + 1
	for p in range(2, n + 1):
		if prime[p]:
			a.append(p)
	return a
ONLINE_JUDGE = __debug__
if ONLINE_JUDGE:
	input = sys.stdin.readline
main()


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	d = {}
	for i in l:
		if i in d:
			d[i] += 1
		else:
			d[i] = 1
	m = max(d.values())
	mi = min(d.values())
	for i in l:
		if d[i] == m:
			m = i
			d[m] = 0
			break
	for i in l:
		if d[i] == mi:
			mi = i
			d[m] = 0
			break
	if len(set(l)) == 1:
		print('NO')
	else:
		print('YES')
		idx1 = l.index(m)
		idx2 = l.index(mi)
		c = 0
		for i in l:
			if i != mi:
				t = l.index(i)
				print(idx2 + 1, t + 1)
				l[t] = 0
			elif c != 0:
				t = l.index(i)
				print(t + 1, idx1 + 1)
				l[t] = 0
			else:
				c = 1
				l[idx2] = 0


class Node:

	def __init__(self, gang, district):
		self.gang = gang
		self.district = district
		self.connected_districts = []

	def add_district(self, gang, district):
		if self.gang == gang:
			for connected_district in self.connected_districts:
				if connected_district.add_district(gang, district):
					return True
			return False
		self.connected_districts.append(Node(gang, district))
		return True

	def print_connections(self):
		for connected_district in self.connected_districts:
			print('{} {}'.format(self.district, connected_district.district))
			connected_district.print_connections()
t = int(input())
for _ in range(t):
	number_districts = int(input())
	districts = [(district + 1, gang) for (district, gang) in enumerate(map(int, input().split()))]
	districts = sorted(districts, key=lambda x: x[1])
	if districts[0][1] == districts[-1][1]:
		print('NO')
	else:
		print('YES')
		node = Node(districts[0][1], districts[0][0])
		node.add_district(districts[-1][1], districts[-1][0])
		if number_districts > 2:
			for district in districts[1:-1]:
				node.add_district(district[1], district[0])
		node.print_connections()


from sys import stdin
nii = lambda : map(int, stdin.readline().split())
lnii = lambda : list(map(int, stdin.readline().split()))
t = int(input())
for tt in range(t):
	n = int(input())
	a = lnii()
	if len(set(a)) == 1:
		print('NO')
		continue
	print('YES')
	t1 = a[0]
	t2 = -1
	ans = []
	same = []
	for i in range(1, n):
		if a[i] != t1:
			if t2 == -1:
				t2 = i + 1
			ans.append([1, i + 1])
		else:
			same.append(i + 1)
	for i in same:
		ans.append([t2, i])
	for i in ans:
		print(*i)


def main():
	n = int(input())
	arr = list(map(int, input().split()))
	x = arr[0]
	if n == arr.count(x):
		print('NO')
		return
	print('YES')
	(y, z) = (0, [])
	for i in range(1, n):
		if arr[i] != x:
			print('{} {}'.format(1, i + 1))
			if not y:
				y = i + 1
		else:
			z.append(i + 1)
	for i in range(len(z)):
		print(y, z[i])
for _ in range(int(input())):
	main()


import sys, os, io

def rs():
	return sys.stdin.readline().rstrip()

def ri():
	return int(sys.stdin.readline())

def ria():
	return list(map(int, sys.stdin.readline().split()))

def ws(s):
	sys.stdout.write(s + '\n')

def wi(n):
	sys.stdout.write(str(n) + '\n')

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
import math, datetime, functools, itertools, operator, bisect, fractions, statistics
from collections import deque, defaultdict, OrderedDict, Counter
from fractions import Fraction
from decimal import Decimal
from sys import stdout

def main():
	starttime = datetime.datetime.now()
	if os.path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	for _ in range(ri()):
		n = ri()
		a = ria()
		d = Counter(a)
		ind = {}
		for i in range(n):
			if a[i] in ind:
				ind[a[i]].append(i + 1)
			else:
				ind[a[i]] = [i + 1]
		z = []
		kind = 0
		for i in a:
			if i != a[0]:
				kind = ind[i][-1]
				break
		for i in a:
			if i != a[0]:
				z.append([1, ind[i][-1]])
				ind[i].pop()
		if kind == 0:
			print('NO')
		else:
			print('YES')
			for i in range(d[a[0]] - 1):
				z.append([kind, ind[a[0]][-1]])
				ind[a[0]].pop()
			for i in range(len(z)):
				print(z[i][0], z[i][1])
	endtime = datetime.datetime.now()
	time = (endtime - starttime).total_seconds() * 1000
	if os.path.exists('input.txt'):
		print('Time:', time, 'ms')

class FastReader(io.IOBase):
	newlines = 0

	def __init__(self, fd, chunk_size=1024 * 8):
		self._fd = fd
		self._chunk_size = chunk_size
		self.buffer = io.BytesIO()

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self, size=-1):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size if size == -1 else size))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

class FastWriter(io.IOBase):

	def __init__(self, fd):
		self._fd = fd
		self.buffer = io.BytesIO()
		self.write = self.buffer.write

	def flush(self):
		os.write(self._fd, self.buffer.getvalue())
		(self.buffer.truncate(0), self.buffer.seek(0))

class FastStdin(io.IOBase):

	def __init__(self, fd=0):
		self.buffer = FastReader(fd)
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

class FastStdout(io.IOBase):

	def __init__(self, fd=1):
		self.buffer = FastWriter(fd)
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.flush = self.buffer.flush
sys.stdin = FastStdin()
sys.stdout = FastStdout()
main()


T = int(input())
for i in range(T):
	n = int(input())
	a = list(map(int, input().split()))
	x = -1
	if len(set(a)) == 1:
		print('NO')
	else:
		print('YES')
		for i in range(1, n):
			if a[i] != a[0]:
				x = i
				break
		for i in range(1, n):
			if a[i] == a[0]:
				print(str(x + 1) + ' ' + str(i + 1))
			else:
				print(str(1) + ' ' + str(i + 1))


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	if max(a) == min(a):
		print('NO')
		continue
	for i in range(len(a)):
		a[i] = [a[i], i + 1]
	a.sort()
	print('YES')
	for i in range(n - 1):
		if a[i][0] != a[0][0]:
			print(a[i][1], a[0][1])
		else:
			print(a[i][1], a[-1][1])


t = int(input())
for i in range(t):
	n = int(input())
	l = sorted(enumerate(list(map(int, input().split()))), key=lambda x: x[1])
	if l[0][1] == l[-1][1]:
		print('NO')
		continue
	print('YES')
	ptr = l[0]
	for j in range(1, n):
		if l[j][1] != ptr[1]:
			print(l[j][0] + 1, ptr[0] + 1)
		else:
			print(l[j][0] + 1, l[-1][0] + 1)


from collections import Counter
import string
import math
import sys
from fractions import Fraction

def array_int():
	return [int(i) for i in sys.stdin.readline().split()]

def vary(arrber_of_variables):
	if arrber_of_variables == 1:
		return int(sys.stdin.readline())
	if arrber_of_variables >= 2:
		return map(int, sys.stdin.readline().split())

def makedict(var):
	return dict(Counter(var))

def printDivisors(n):
	divisors = []
	i = 1
	while i <= math.sqrt(n):
		if n % i == 0:
			if n // i == i:
				divisors.append(i)
			else:
				divisors.extend((i, n // i))
		i = i + 1
	return divisors

def countTotalBits(num):
	binary = bin(num)[2:]
	return len(binary)

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True
for _ in range(vary(1)):
	n = vary(1)
	num = array_int()
	if len(set(num)) == 1:
		print('NO')
	else:
		print('YES')
		z = 0
		for i in range(1, n):
			if num[z] != num[i]:
				pos = i
				print(z + 1, i + 1)
		indi = []
		for i in range(1, n):
			if num[0] == num[i]:
				indi.append(i)
			else:
				pos = i
		if len(indi) == 0:
			continue
		else:
			for i in indi:
				print(pos + 1, i + 1)


from collections import defaultdict
T = int(input())
for t in range(T):
	n = int(input())
	A = [int(i) for i in input().split()]
	set_A = set(A)
	if len(set_A) == 1:
		print('NO')
		continue
	print('YES')
	d = defaultdict(list)
	for i in range(n):
		d[A[i]].append(i + 1)
	unique_A = list(set_A)
	(first_key, second_key) = (unique_A[0], unique_A[1])
	for i in d:
		if i != first_key:
			for j in d[i]:
				print(d[first_key][0], j)
	for i in range(1, len(d[first_key])):
		print(d[first_key][i], d[second_key][0])


12164510040883200
import os
import sys
from io import BytesIO, IOBase
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())

def main():
	try:
		for _ in range(inp()):
			n = inp()
			a = inlt()
			if len(set(a)) == 1:
				print('NO')
				continue
			else:
				print('YES')
			ans = []
			temp = []
			for i in range(1, n):
				if a[i] == a[0]:
					temp.append(i)
				else:
					t = i
					print('1', i + 1)
					if temp != []:
						for j in range(len(temp)):
							print(i + 1, temp[j] + 1)
						temp = []
			if temp != []:
				for j in range(len(temp)):
					print(t + 1, temp[j] + 1)
				temp = []
	except Exception as e:
		print(e)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


from collections import defaultdict
t = int(input())
for z in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	dist = defaultdict(list)
	for i in range(n):
		dist[l[i]].append(i + 1)
	if len(dist.keys()) == 1:
		print('NO')
		continue
	print('YES')
	first_dist_bang = l[0]
	second_dist_bang = -1
	for i in dist.keys():
		if i != first_dist_bang:
			second_dist_bang = i
			break
	for i in dist.keys():
		if i != first_dist_bang:
			for j in dist[i]:
				print(dist[first_dist_bang][0], j)
	if len(dist[first_dist_bang]) > 1:
		for i in range(1, len(dist[first_dist_bang])):
			print(dist[first_dist_bang][i], dist[second_dist_bang][0])


for _ in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	if len(list(set(a))) == 1:
		print('NO')
	else:
		print('YES')
		for i in range(0, n - 1):
			if a[i] != a[i + 1]:
				k1 = i
				k2 = i + 1
				break
		for j in range(0, n):
			if j == k1:
				continue
			if a[j] == a[k1]:
				print(k2 + 1, j + 1)
			else:
				print(k1 + 1, j + 1)


def main():
	t = int(input())
	for _ in range(t):
		n = int(input())
		a = list(map(int, input().split()))
		s = set(a)
		if len(s) == 1:
			print('NO')
			continue
		print('YES')
		(x, y) = (s.pop(), s.pop())
		(i, j) = (a.index(x), a.index(y))
		for k in range(n):
			if k == i:
				continue
			if a[k] == x:
				print(k + 1, j + 1)
			else:
				print(k + 1, i + 1)
main()


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	check = 0
	m = a[0]
	for i in range(1, n):
		if a[i] != m:
			check = 1
			break
	if check == 0:
		print('NO')
	else:
		print('YES')
		k = a[0]
		k1 = 1
		for i in range(1, n):
			if a[i] != k:
				print(1, i + 1)
				if check == 1:
					k1 = i + 1
					check = 0
		for i in range(1, n):
			if a[i] == k:
				print(k1, i + 1)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	index = -1
	ans = []
	for i in range(1, n):
		if a[0] != a[i]:
			ans.append((1, i + 1))
			a[i] = -1
			index = i
	for i in range(1, n):
		if a[i] != -1:
			if index > -1:
				ans.append((i + 1, index + 1))
			else:
				break
	if index > -1:
		print('YES')
		for i in range(n - 1):
			print(ans[i][0], ans[i][1])
	else:
		print('NO')


t = int(input())
for _ in range(t):
	n = int(input())
	gng = [int(x) for x in input().split()]
	count = 0
	for i in range(n):
		if gng[i] == gng[0]:
			count += 1
	if count == n:
		print('NO')
	else:
		print('YES')
		start = gng[0]
		end = 0
		for i in range(n):
			if gng[i] != start:
				print(1, ' ', i + 1)
				end = i + 1
		for j in range(1, n):
			if gng[j] == start:
				print(end, ' ', j + 1)


t = int(input())
for k in range(t):
	n = int(input())
	ls = list(map(int, input().split()))
	x = ls[0]
	i = 1
	while i < n and ls[i] == x:
		i += 1
	if i == n:
		print('NO')
	else:
		print('YES')
		y = ls[i]
		for j in range(1, n):
			if ls[j] != x:
				print(j + 1, 1)
			else:
				print(j + 1, i + 1)


def solve(a, n):
	if len(set(a)) == 1:
		return -1
	mat = []
	p = 0
	for i in range(1, n):
		if a[i] != a[0]:
			p = i
			break
	for i in range(1, n):
		if a[i] != a[0]:
			mat.append([i + 1, 1])
		else:
			mat.append([i + 1, p + 1])
	return mat
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	q = solve(a, n)
	if q == -1:
		print('NO')
	else:
		print('YES')
		for j in q:
			print(*j)


def solve(arr):
	if arr.count(arr[0]) == len(arr):
		print('NO')
	else:
		print('YES')
		master = -1
		counter = 0
		for i in range(len(arr)):
			if arr.count(arr[i]) == 1:
				master = i
		if master != -1:
			for i in range(len(arr)):
				if i != master:
					print('{} {}'.format(master + 1, i + 1))
		else:
			first = arr[0]
			other = 0
			for k in range(len(arr)):
				if arr[k] != first:
					other = k + 1
					break
			for i in range(1, len(arr)):
				if arr[i] != first:
					print('{} {}'.format(1, i + 1))
				else:
					print('{} {}'.format(other, i + 1))
i = int(input())
for j in range(i):
	k = input()
	r = input().split(' ')
	arr = list(map(int, r))
	solve(arr)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	b = set(a)
	if len(b) == 1:
		print('NO')
	else:
		print('YES')
		f = -1
		for i in range(0, n):
			if a[i] != a[0]:
				f = i + 1
				print(1, i + 1)
		for i in range(1, n):
			if a[i] == a[0]:
				print(f, i + 1)


for _ in range(int(input())):
	n = int(input())
	a = [int(t) for t in input().split()]
	used = [False for _ in range(n)]
	result = []
	for i in range(n):
		for j in range(n):
			if a[i] != a[j] and (not used[j]):
				used[i] = used[j] = True
				result.append((i, j))
	if any([not used_item for used_item in used]):
		print('NO')
	else:
		print('YES')
		for (x, y) in result:
			print(x + 1, y + 1)


import sys

def main():
	t = Iint()
	for _ in range(t):
		n = Iint()
		a = Ilist()
		if a == [a[0]] * n:
			print('NO')
		else:
			print('YES')
			i1 = a[0]
			a = [ai == i1 for (i, ai) in en(a)]
			other = a.index(0) + 1
			for i in range(1, n):
				if a[i] == 0:
					print(1, i + 1)
				elif a[i] == 1:
					print(other, i + 1)
en = enumerate
FIO = 10

def debug(*args, c=6):
	pass
BUFSIZE = 8 * 1024

def Istr():
	return input()

def Iint():
	return int(input())

def Ilist():
	return list(map(int, input().split()))

def Imap():
	return map(int, input().split())

def Plist(li, s=' '):
	print(s.join(map(str, li)))
if not FIO:
	if __name__ == '__main__':
		main()
		exit()
else:
	from io import BytesIO, IOBase
	import os

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')
main()


from math import *
from collections import *
from itertools import *
from functools import *
from bisect import *
from heapq import *
from operator import *
from sys import *
setrecursionlimit(100000000)
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	d = defaultdict(list)
	for (i, x) in enumerate(l):
		d[x].append(i + 1)
	l = list(d.values())
	if len(l) == 1:
		print('NO')
		continue
	print('YES')
	t = l[0].pop(0)
	for x in l[1]:
		print(t, x)
	t = l[1][0]
	for i in range(len(l)):
		if i == 1:
			continue
		for x in l[i]:
			print(t, x)


for t in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	mn = min(a)
	mx = max(a)
	if mn == mx:
		print('NO')
	else:
		print('YES')
		l = a.index(mn)
		r = a.index(mx)
		print(l + 1, r + 1)
		for i in range(n):
			if i == l or i == r:
				pass
			elif a[i] != a[l]:
				print(l + 1, i + 1)
			else:
				print(r + 1, i + 1)


from sys import stdin, stdout
from os import path
if path.exists('input.txt'):
	stdin = open('input.txt', 'r')
for _ in range(int(stdin.readline())):
	x = int(stdin.readline())
	mylist = list(map(int, stdin.readline().strip().split()))
	out = []
	idx = -1
	for i in range(1, x):
		if mylist[i] != mylist[0]:
			idx = i + 1
			out.append((1, i + 1))
	if idx == -1:
		print('NO')
		continue
	for i in range(1, x):
		if mylist[i] == mylist[0]:
			out.append((idx, i + 1))
	print('YES')
	for (f, l) in out:
		stdout.write(str(f) + ' ' + str(l) + '\n')


import sys
import os
from math import sqrt, log, log2, log10, gcd, floor, pow, sin, cos, tan, pi, inf, factorial
from copy import copy, deepcopy
from sys import exit, stdin, stdout
from collections import Counter, defaultdict, deque
from itertools import permutations
import heapq
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
mod = 1000000007
iinp = lambda : int(sys.stdin.readline())
inp = lambda : sys.stdin.readline().strip()
strl = lambda : list(inp().strip().split(' '))
intl = lambda : list(map(int, inp().split(' ')))
mint = lambda : map(int, inp().split())
flol = lambda : list(map(float, inp().split(' ')))
flush = lambda : stdout.flush()

def permute(nums):

	def fun(arr, nums, cur, v):
		if len(cur) == len(nums):
			arr.append(cur.copy())
		i = 0
		while i < len(nums):
			if v[i]:
				i += 1
				continue
			else:
				cur.append(nums[i])
				v[i] = 1
				fun(arr, nums, cur, v)
				cur.pop()
				v[i] = 0
				i += 1
		return arr
	res = []
	nums.sort()
	v = [0] * len(nums)
	return fun(res, nums, [], v)

def subsets(res, index, arr, cur):
	res.append(cur.copy())
	for i in range(index, len(arr)):
		cur.append(arr[i])
		subsets(res, i + 1, arr, cur)
		cur.pop()
	return res

def sieve(N):
	root = int(sqrt(N))
	primes = [1] * (N + 1)
	(primes[0], primes[1]) = (0, 0)
	for i in range(2, root + 1):
		if primes[i]:
			for j in range(i * i, N + 1, i):
				primes[j] = 0
	return primes

def bs(arr, l, r, x):
	if x < arr[0] or x > arr[len(arr) - 1]:
		return -1
	while l <= r:
		mid = l + (r - l) // 2
		if arr[mid] == x:
			return mid
		elif arr[mid] < x:
			l = mid + 1
		else:
			r = mid - 1
	return -1

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	p = int(sqrt(n))
	for i in range(5, p + 1, 6):
		if n % i == 0 or n % (i + 2) == 0:
			return False
	return True

def solve():
	n = iinp()
	arr = intl()
	d = {}
	for i in range(n):
		if arr[i] in d.keys():
			d[arr[i]] += 1
		else:
			d[arr[i]] = 1
	if len(d.keys()) == 1:
		print('NO')
		return
	print('YES')
	a = max(arr)
	b = min(arr)
	idxa = arr.index(a)
	idxb = arr.index(b)
	print(idxa + 1, idxb + 1)
	for i in range(n):
		if i != idxa and i != idxb:
			if arr[i] == a:
				print(i + 1, idxb + 1)
			else:
				print(i + 1, idxa + 1)
for _ in range(iinp()):
	solve()


for _ in range(int(input())):
	n = int(input())
	a = [*map(int, input().split())]
	t = a[0]
	if len(a) == a.count(t):
		print('NO')
	else:
		print('YES')
		ans = []
		for i in range(1, n):
			if a[i] != t:
				print(1, i + 1)
				x = i + 1
			else:
				ans.append(i + 1)
		for i in range(len(ans)):
			print(x, ans[i])


import sys
sys.setrecursionlimit(3 * 10 ** 5)
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	par = [i for i in range(n)]
	sz = [1] * n

	def find(x):
		if par[x] == x:
			return x
		par[x] = find(par[x])
		return par[x]
	res = []
	for u in range(n):
		for v in range(u + 1, n):
			if a[u] == a[v]:
				continue
			x = find(u)
			y = find(v)
			if x == y:
				continue
			if sz[x] > sz[y]:
				(x, y) = (y, x)
			sz[y] += sz[x]
			par[x] = y
			res.append([u + 1, v + 1])
	cnt = -1
	for i in range(n):
		if par[i] == i:
			cnt += 1
	if cnt:
		print('NO')
	else:
		print('YES')
		for i in res:
			print(*i)


TC = int(input())
for __ in range(TC):
	n = int(input())
	a = list(map(int, input().split()))
	ans = []
	mark = [False] * n
	for i in range(n):
		if i == 0:
			mark[i] = True
		for j in range(i + 1, n):
			if mark[i] ^ mark[j] and a[i] != a[j]:
				mark[i] = mark[j] = True
				ans.append((i + 1, j + 1))
				if len(ans) == n - 1:
					break
		if mark[i] == False:
			ans = []
			break
		if len(ans) == n - 1:
			break
	if len(ans) == n - 1:
		print('YES')
		for x in ans:
			print(x[0], x[1])
	else:
		print('NO')


import sys
import math
import collections
input = sys.stdin.readline

def algo(n, arr):
	ans = []
	idx = -1
	for i in range(1, n):
		if arr[i] != arr[0]:
			idx = i
			ans.append((1, i + 1))
	if idx == -1:
		print('NO')
		return
	for i in range(1, n):
		if arr[i] == arr[0]:
			ans.append((idx + 1, i + 1))
	print('YES')
	for item in ans:
		print(*item)
for _ in range(int(input())):
	n = int(input().strip())
	arr = list(map(int, input().split()))
	res = algo(n, arr)


import sys, bisect, string, math, time, functools, random, fractions
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
from itertools import permutations, combinations, groupby
rep = range
R = range

def Golf():
	(n, *t) = map(int, open(0).read().split())

def I():
	return int(input())

def S_():
	return input()

def IS():
	return input().split()

def LS():
	return [i for i in input().split()]

def MI():
	return map(int, input().split())

def LI():
	return [int(i) for i in input().split()]

def LI_():
	return [int(i) - 1 for i in input().split()]

def NI(n):
	return [int(input()) for i in range(n)]

def NI_(n):
	return [int(input()) - 1 for i in range(n)]

def NLI(n):
	return [[int(i) for i in input().split()] for i in range(n)]

def NLI_(n):
	return [[int(i) - 1 for i in input().split()] for i in range(n)]

def StoLI():
	return [ord(i) - 97 for i in input()]

def ItoS(n):
	return chr(n + 97)

def LtoS(ls):
	return ''.join([chr(i + 97) for i in ls])

def RA():
	return map(int, open(0).read().split())

def RLI(n=8, a=1, b=10):
	return [random.randint(a, b) for i in range(n)]

def RI(a=1, b=10):
	return random.randint(a, b)

def INP():
	N = 10
	A = 10
	n = random.randint(1, N)
	a = [random.randint(1, A) for i in range(n)]
	return (n, a)

def Rtest(T):
	(case, err) = (0, 0)
	for i in range(T):
		inp = INP()
		a1 = naive(*inp)
		a2 = solve(*inp)
		if a1 != a2:
			print((a1, a2), inp)
			err += 1
		case += 1
	print('Tested', case, 'case with', err, 'errors')

def GI(V, E, ls=None, Directed=False, index=1):
	org_inp = []
	g = [[] for i in range(V)]
	FromStdin = True if ls == None else False
	for i in range(E):
		if FromStdin:
			inp = LI()
			org_inp.append(inp)
		else:
			inp = ls[i]
		if len(inp) == 2:
			(a, b) = inp
			c = 1
		else:
			(a, b, c) = inp
		if index == 1:
			a -= 1
			b -= 1
		aa = (a, c)
		bb = (b, c)
		g[a].append(bb)
		if not Directed:
			g[b].append(aa)
	return (g, org_inp)

def GGI(h, w, search=None, replacement_of_found='.', mp_def={'#': 1, '.': 0}, boundary=1):
	mp = [boundary] * (w + 2)
	found = {}
	for i in R(h):
		s = input()
		for char in search:
			if char in s:
				found[char] = (i + 1) * (w + 2) + s.index(char) + 1
				mp_def[char] = mp_def[replacement_of_found]
		mp += [boundary] + [mp_def[j] for j in s] + [boundary]
	mp += [boundary] * (w + 2)
	return (h + 2, w + 2, mp, found)

def TI(n):
	return GI(n, n - 1)

def accum(ls):
	rt = [0]
	for i in ls:
		rt += [rt[-1] + i]
	return rt

def bit_combination(n, base=2):
	rt = []
	for tb in R(base ** n):
		s = [tb // base ** bt % base for bt in R(n)]
		rt += [s]
	return rt

def gcd(x, y):
	if y == 0:
		return x
	if x % y == 0:
		return y
	while x % y != 0:
		(x, y) = (y, x % y)
	return y

def YN(x):
	print(['NO', 'YES'][x])

def Yn(x):
	print(['No', 'Yes'][x])

def show(*inp, end='\n'):
	if show_flg:
		print(*inp, end=end)
mo = 10 ** 9 + 7
inf = float('inf')
FourNb = [(-1, 0), (1, 0), (0, 1), (0, -1)]
EightNb = [(-1, 0), (1, 0), (0, 1), (0, -1), (1, 1), (-1, -1), (1, -1), (-1, 1)]
compas = dict(zip('WENS', FourNb))
cursol = dict(zip('LRUD', FourNb))
l_alp = string.ascii_lowercase
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
input = lambda : sys.stdin.readline().rstrip()
show_flg = False
show_flg = True
ans = 0
for _ in range(I()):
	ans = 0
	n = I()
	a = LI()
	M = max(a)
	m = min(a)
	if M == m:
		Yn(0)
		continue
	Yn(1)
	c = a[0]
	for i in range(n):
		if a[i] != c:
			x = i + 1
	ans = []
	for i in range(n):
		if i + 1 == x:
			continue
		if a[i] != c:
			ans += ((1, i + 1),)
		else:
			ans += ((x, i + 1),)
	for i in ans:
		print(*i)


import sys
import os
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
mod = 10 ** 9 + 7

def lcm(x, y):
	return x * y / gcd(x, y)

def fact(x, mod=mod):
	ans = 1
	for i in range(1, x + 1):
		ans = ans * i % mod
	return ans

def arr2D(n, m, default=0):
	return [[default for j in range(m)] for i in range(n)]

def arr3D(n, m, r, default=0):
	return [[[default for k in range(r)] for j in range(m)] for i in range(n)]

def sortDictV(x):
	return {k: v for (k, v) in sorted(x.items(), key=lambda item: item[1])}

class DSU:

	def __init__(self, length):
		self.length = length
		self.parent = [-1] * self.length

	def getParent(self, node, start):
		if node >= self.length:
			return False
		if self.parent[node] < 0:
			if start != node:
				self.parent[start] = node
			return node
		return self.getParent(self.parent[node], start)

	def union(self, node1, node2):
		parent1 = self.getParent(node1, node1)
		parent2 = self.getParent(node2, node2)
		if parent1 == parent2:
			return False
		elif self.parent[parent1] <= self.parent[parent2]:
			self.parent[parent1] += self.parent[parent2]
			self.parent[parent2] = parent1
		else:
			self.parent[parent2] += self.parent[parent1]
			self.parent[parent1] = parent2
		return True

	def getCount(self, node):
		return -self.parent[self.getParent(node, node)]

def solve(n, lst):
	if len(set(lst)) == 1:
		print('NO')
		return
	print('YES')
	naming = {}
	cnt = 0
	for i in lst:
		if naming.get(i) == None:
			naming[i] = cnt
			cnt += 1
	for i in range(len(lst)):
		lst[i] = naming[lst[i]]
	dsu = DSU(n)
	group = {}
	for i in range(len(lst)):
		if group.get(lst[i]) == None:
			group[lst[i]] = [i + 1]
		else:
			group[lst[i]].append(i + 1)
	for i in group:
		for j in range(len(group[i]) - 1):
			dsu.union(group[i][j] - 1, group[i][j + 1] - 1)
	dsu1 = DSU(n)
	m = len(group)
	cnt = 0
	for i in range(n):
		for j in range(n):
			if cnt >= n - 1:
				break
			if dsu.getParent(i, i) != dsu.getParent(j, j) and dsu1.getParent(i, i) != dsu1.getParent(j, j):
				print(i + 1, j + 1)
				cnt += 1
				dsu1.union(i, j)
for _ in range(int(input())):
	n = int(input())
	lst = list(map(int, input().split()))
	solve(n, lst)


from collections import Counter

def printG(g):
	for (i, j) in g.items():
		if j != []:
			print(i, j[0])

def proD(arr):
	dic = Counter(arr)
	if len(dic) == 1:
		print('NO')
		return
	else:
		graph = {}
		grp = {}
		for (j, i) in enumerate(arr):
			graph[j + 1] = []
			if i in grp:
				grp[i].append(j + 1)
			else:
				grp[i] = [j + 1]
		v1 = grp[arr[0]][0]
		for (i, j) in grp.items():
			if i == arr[0]:
				continue
			for k in j:
				graph[k].append(v1)
				v2 = k
		for i in grp[arr[0]][1:]:
			graph[i].append(v2)
		print('YES')
		printG(graph)
t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	proD(arr)


import collections
t = int(input())
for _ in range(t):
	n = int(input())
	gangByDistricts = [int(i) for i in input().split()]

	def graph(u, v):
		if u == v:
			return False
		low_gang = gangByDistricts[u]
		hi_gang = gangByDistricts[v]
		if low_gang == hi_gang:
			return False
		else:
			return True

	def bfs():
		visited = [False] * n
		forest_edges = []
		q = collections.deque()
		visited[0] = True
		q.append(0)
		while len(q):
			node = q.popleft()
			for neighbor in range(n):
				if not visited[neighbor] and graph(node, neighbor):
					q.append(neighbor)
					visited[neighbor] = True
					forest_edges.append((node, neighbor))
		return forest_edges
	edges = bfs()
	if len(edges) == n - 1:
		print('YES')
		for edge in edges:
			print(edge[0] + 1, edge[1] + 1)
	else:
		print('NO')


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	d = {}
	f = 0
	for j in range(1, n + 1):
		if a[j - 1] in d:
			d[a[j - 1]].append(j)
		else:
			d[a[j - 1]] = [j]
	if len(d) == 1:
		print('NO')
		f = 1
	else:
		print('YES')
		l = []
		for j in d:
			l.append(d[j][0])
		l1 = []
		for j in d:
			if len(d[j]) > 1:
				for k in d:
					if k != j:
						for x in range(1, len(d[j])):
							l1.append([d[k][0], d[j][x]])
						break
	if f == 0:
		for h in range(len(l) - 1):
			print(l[h], l[h + 1], sep=' ')
		for h in range(len(l1)):
			print(l1[h][0], l1[h][1], sep=' ')


import sys
import math
from collections import Counter
from collections import OrderedDict
from functools import reduce
sys.setrecursionlimit(10 ** 6)

def inputt():
	return sys.stdin.readline().strip()

def printt(n):
	sys.stdout.write(str(n) + '\n')

def listt():
	return [int(i) for i in inputt().split()]

def gcd(a, b):
	return math.gcd(a, b)

def lcm(a, b):
	return a * b // gcd(a, b)

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))
t = int(inputt())
for _ in range(t):
	n = int(inputt())
	s = listt()
	g = set(s)
	k = 0
	if len(g) < 2:
		printt('NO')
	else:
		printt('YES')
		for i in range(1, n):
			if s[0] != s[i]:
				print(1, i + 1)
				k = i
		for i in range(1, n):
			if s[0] == s[i]:
				print(k + 1, i + 1)


import sys
input = sys.stdin.readline
(inp, ip) = (lambda : int(input()), lambda : [int(w) for w in input().split()])
for _ in range(inp()):
	n = inp()
	x = ip()
	mn = min(x)
	mx = max(x)
	if mn == mx:
		print('NO')
		continue
	print('YES')
	mni = x.index(mn)
	mxi = x.index(mx)
	print(mni + 1, mxi + 1)
	for i in range(n):
		if i not in [mni, mxi]:
			if x[i] == mx:
				print(i + 1, mni + 1)
			else:
				print(i + 1, mxi + 1)


for iiii in range(int(input())):
	n = int(input())
	lst = list(map(int, input().split()))
	k = 0
	tmp = lst[0]
	two = 0
	answer = set()
	for i in range(1, n):
		if lst[i] != tmp:
			answer.add((1, i + 1))
			k += 1
			two = i + 1
	if k == 0:
		print('NO')
		continue
	else:
		print('YES')
		for (i, j) in answer:
			print(i, j)
	for i in range(1, n):
		if lst[i] == tmp:
			print(two, i + 1)


t = int(input())
for _ in range(t):
	n = int(input())
	A = list(map(int, input().split()))
	if A.count(max(A)) == n:
		print('NO')
		continue
	print('YES')
	ans = []
	d = None
	el = None
	tmp = []
	for (i, a) in enumerate(A):
		if d == None:
			d = a
			continue
		if a != d:
			if el == None:
				el = i + 1
			ans.append((1, i + 1))
		elif el != None:
			ans.append((i + 1, el))
		else:
			tmp.append(i + 1)
	for t in tmp:
		ans.append((t, el))
	for (p, q) in ans:
		print(p, q)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	b = set(a)
	d = {}
	if len(b) == 1:
		print('NO')
	else:
		x = a[0]
		print('YES')
		for i in range(n):
			if a[i] != x:
				y = i + 1
				d[1, y] = 0
				print(1, y)
		for i in range(n):
			if a[i] == x and (i + 1, y) not in d:
				print(y, i + 1)


t = int(input())
for i in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	b = {}
	for gang in range(n):
		if arr[gang] in b:
			b[arr[gang]].append(gang + 1)
		else:
			b[arr[gang]] = [gang + 1]
	if len(b) == 1:
		print('NO')
	else:
		print('YES')
		newlist = sorted(b.values(), key=len)
		for k in newlist[1:]:
			for j in k:
				print(newlist[0][0], j)
		for k in range(len(newlist[0]) - 1):
			print(newlist[-1][0], newlist[0][k + 1])


def is_availaible(lst):
	if max(lst) == min(lst):
		print('NO')
		return False
	else:
		return True

def solve():
	n = int(input())
	lst = list(map(int, input().split()))
	if is_availaible(lst):
		print('YES')
		for j in range(1, n):
			if lst[j] != lst[0]:
				dist = j
				break
		for i in range(1, n):
			if lst[i] != lst[0]:
				print(1, i + 1)
			else:
				print(dist + 1, i + 1)
t = int(input())
for _ in range(t):
	solve()


import sys
input = sys.stdin.readline
from collections import Counter
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	if len(Counter(a).items()) == 1:
		print('NO')
		continue
	print('YES')
	u = list(Counter(a).items())
	d = dict()
	for i in range(n):
		if a[i] not in d:
			d[a[i]] = [i]
		else:
			d[a[i]].append(i)
	u.sort(key=lambda x: x[1], reverse=True)
	if u[-1][1] == 1:
		vert = d[u[-1][0]][0] + 1
		for i in range(1, n + 1):
			if i != vert:
				print(vert, i)
	else:
		nouse = set()
		for i in d[u[-1][0]]:
			nouse.add(i + 1)
		vert = d[u[-1][0]][0] + 1
		for i in range(1, n + 1):
			if i not in nouse:
				print(vert, i)
		nouse = list(nouse)
		for i in range(len(nouse)):
			if nouse[i] != vert:
				print(d[u[0][0]][0] + 1, nouse[i])


from typing import List

def build(k: int, gangs: List[int]) -> List[List[int]]:
	first = (gangs[0], 1)
	second = None
	for i in range(k):
		if gangs[i] != first[0]:
			second = (gangs[i], i + 1)
			break
	roads = []
	for i in range(k):
		if i == second[1] - 1:
			continue
		elif gangs[i] == first[0]:
			roads.append([i + 1, second[1]])
		else:
			roads.append([i + 1, first[1]])
	return roads
n = int(input())
for _ in range(n):
	k = int(input())
	gangs = list(map(int, input().split()))
	if len(set(gangs)) == 1:
		print('NO')
	else:
		roads = build(k, gangs)
		print('YES')
		for road in roads:
			print(*road)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().strip().split(' ')))
	if len(list(set(a))) == 1:
		print('NO')
	else:
		x = list(set(a))
		p = x[0]
		p1 = x[1]
		pk = -1
		pkj = -1
		for j in range(n):
			if a[j] == p:
				pk = j
				break
		for j in range(n):
			if a[j] == p1:
				pkj = j
				break
		print('YES')
		for j in range(n):
			if j == pk:
				pass
			elif a[j] == p:
				print(pkj + 1, j + 1)
			else:
				print(pk + 1, j + 1)


from math import *
from collections import deque
from copy import deepcopy
import sys

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def multi():
	return map(int, input().split())

def strmulti():
	return map(str, inp().split())

def lis():
	return list(map(int, inp().split()))

def lcm(a, b):
	return a * b // gcd(a, b)

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def stringlis():
	return list(map(str, inp().split()))

def out(var):
	sys.stdout.write(str(var))

def printlist(a):
	print(' '.join((str(a[i]) for i in range(len(a)))))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True
t = int(input())
for _ in range(t):
	n = int(input())
	a = lis()
	ans = []
	connected = []
	hashy = {}
	hashy2 = {}
	for i in range(n):
		for j in range(n):
			if i != j and a[i] != a[j] and (i not in hashy2 or j not in hashy2):
				ans.append([i + 1, j + 1])
				hashy2[i] = 1
				hashy2[j] = 1
				break
		if len(ans) == n - 1:
			break
	if len(ans) == n - 1:
		print('YES')
		for i in ans:
			print(i[0], i[1])
	else:
		print('NO')


import sys
import math
import bisect
from sys import stdin, stdout
from math import floor, sqrt, log
from collections import defaultdict
from bisect import bisect_left as bl, bisect_right as br
mod = 1000000007

def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a

def mod_inverse(a, n):
	N = n
	xx = 0
	yy = 1
	y = 0
	x = 1
	while n > 0:
		q = a // n
		t = n
		n = a % n
		a = t
		t = xx
		xx = x - q * xx
		x = t
		t = yy
		yy = y - q * yy
		y = t
	x %= N
	x += N
	x %= N
	return x

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 1
	prime[0] = False
	prime[1] = False
	return prime

def solve():
	n = int(input())
	l = [int(i) for i in input().split()][:n]
	x = set(l)
	if len(x) == 1:
		print('NO')
	else:
		d = defaultdict(list)
		arr = [False] * n
		arr[0] = True
		for i in range(1, n):
			if l[i] != l[0]:
				d[1].append(i + 1)
				arr[i] = True
		z = d[1][0]
		for i in range(n):
			if not arr[i]:
				d[z].append(i + 1)
		print('YES')
		key = d.keys()
		for i in key:
			for j in d[i]:
				print(i, j)
testcase = int(sys.stdin.readline())
for _ in range(testcase):
	solve()


for t in range(int(input())):
	n = int(input())
	l1 = list(map(int, input().split()))
	res = []
	idx = -1
	if len(set(l1)) == 1:
		print('NO')
	else:
		imp = l1[0]
		for i in range(1, n):
			if l1[i] != l1[0]:
				tup = (1, i + 1)
				res.append(tup)
		for i in range(1, n):
			if l1[i] != l1[0]:
				idx = i
				break
		for i in range(1, n):
			if l1[i] == l1[0]:
				tup = (idx + 1, i + 1)
				res.append(tup)
		print('YES')
		for i in res:
			print('%d %d' % (i[0], i[1]))


t = int(input())
while t:
	t -= 1
	n = int(input())
	a = list(map(int, input().split()))
	m = max(a)
	if a.count(m) == n:
		print('NO')
		continue
	j = -1
	print('YES')
	for i in range(n):
		if a[i] == a[0]:
			continue
		j = i
		print(1, i + 1)
	for i in range(1, n):
		if a[i] == a[0]:
			print(j + 1, i + 1)


import sys
input = lambda : sys.stdin.readline().rstrip()
from collections import deque
from queue import LifoQueue

def binary_search(a, n):
	L = 0
	R = len(a) - 1
	while L <= R:
		mid = L + (R - L) // 2
		if a[mid] == n:
			return mid
		elif a[mid] < n:
			L = mid + 1
		else:
			R = mid - 1
	return -1
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	ch = [True] * n
	ch[0] = False
	if max(a) == min(a):
		print('NO')
	else:
		print('YES')
		fl = a[0]
		for i in range(1, n):
			if a[i] != fl:
				print(1, i + 1)
				ch[i] = False
		jj = 0
		for i in range(n):
			if a[i] != fl:
				jj = i + 1
				break
		for i in range(n):
			if ch[i]:
				print(i + 1, jj)


for test in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	solution = []
	idx = -1
	for i in range(1, len(arr)):
		if arr[0] != arr[i]:
			solution.append((1, i + 1))
			idx = i
	if idx == -1:
		print('NO')
		continue
	for i in range(1, len(arr)):
		if arr[i] == arr[0]:
			solution.append((idx + 1, i + 1))
	print('YES')
	for (i, j) in solution:
		print(str(i) + ' ' + str(j))


import sys
import math
from collections import defaultdict, deque
input = sys.stdin.readline

def inar():
	return [int(el) for el in input().split()]

def main():
	for _ in range(int(input())):
		n = int(input())
		arr = inar()
		sttt = set(arr)
		if len(sttt) == 1:
			print('NO')
			continue
		take = arr[0]
		result = []
		total = -1
		for i in range(1, n):
			if arr[i] != take:
				result.append((1, i + 1))
				total = i + 1
		for i in range(1, n):
			if arr[i] == take:
				result.append((total, i + 1))
		print('YES')
		for i in result:
			print(i[0], i[1])
main()


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	(mx, mn) = (max(arr), min(arr))
	if mx == mn:
		print('NO')
		continue
	print('YES')
	md = {}
	for i in range(1, n + 1):
		md[i] = []
	for i in range(n):
		for j in range(n):
			if arr[j] != arr[i] and i != j:
				md[i + 1].append(j + 1)
	swt = [False] * (n + 1)
	for i in range(1, n + 1):
		if not swt[i]:
			for item in md[i]:
				print(i, item)
				swt[item] = True
				if swt[item]:
					break


for i in range(int(input())):
	n = int(input())
	data = list(map(int, input().split()))
	data = [[data[i], i + 1] for i in range(n)]
	window = [data[0]]
	data = data[1:]
	result = []
	while len(window) > 0:
		temp = window.pop(0)
		num = 0
		for j in range(len(data)):
			if data[num][0] != temp[0]:
				pop_node = data.pop(num)
				result.append([temp[1], pop_node[1]])
				window.append(pop_node)
				num -= 1
			num += 1
	if len(data) != 0:
		print('NO')
	else:
		print('YES')
		for j in result:
			print(str(j[0]) + ' ' + str(j[1]))


import sys
input = sys.stdin.buffer.readline
t = int(input())
for _ in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	aset = set(a)
	if len(aset) == 1:
		print('NO')
	else:
		it = iter(aset)
		gang1 = next(it)
		gang2 = next(it)
		for i in range(n):
			if a[i] == gang1:
				district1 = i
			if a[i] == gang2:
				district2 = i
		ans = [[district1 + 1, district2 + 1]]
		for i in range(n):
			if i == district1 or i == district2:
				pass
			elif a[i] != gang1:
				ans.append([i + 1, district1 + 1])
			else:
				ans.append([i + 1, district2 + 1])
		ans2 = []
		for x in ans:
			ans2.append(' '.join([str(y) for y in x]))
		ans3 = '\n'.join(ans2)
		print('YES')
		print(ans3)


t = int(input())
for i in range(t):
	n = int(input())
	a = input().split()
	for x in range(n):
		a[x] = int(a[x])
	asorted = sorted(a)
	if asorted[0] == asorted[n - 1]:
		print('NO')
	else:
		roads = []
		exc = []
		for x in range(1, n):
			if a[x] != a[0]:
				roads.append([1, x + 1])
			else:
				exc.append(x)
		if len(exc) > 0:
			for x in range(1, n):
				if a[x] != a[0]:
					for element in exc:
						roads.append([x + 1, element + 1])
					break
		print('YES')
		for element in roads:
			print(*element, sep=' ')


import itertools
import math
import sys
from collections import defaultdict

def is_debug():
	return '--debug' in sys.argv

def stdin_wrapper():
	data = '6\n0\n1 1 2 2 3 3 3 3 3 3\n0\n1 1 2 2 3 3\n5\n1 2 2 1 3\n3\n1 1 1\n4\n1 1000 101 1000\n4\n1 2 3 4\n\n'
	for line in data.split('\n'):
		yield line
if not is_debug():

	def stdin_wrapper():
		while True:
			yield sys.stdin.readline()
inputs = stdin_wrapper()

def input_wrapper():
	return next(inputs)

def get_str():
	if is_debug():
		return input_wrapper()
	return input()

def get(_type):
	if _type == str:
		return get_str()
	return _type(input_wrapper())

def get_arr(_type):
	return [_type(x) for x in input_wrapper().split()]

def tuplerize(method):

	def wrap(*args, **kwargs):
		res = method(*args, **kwargs)
		if not isinstance(res, (tuple, list)):
			res = (res,)
		return res
	return wrap

@tuplerize
def solve(nodes):
	chain = []
	node_info = defaultdict(list)
	for i in range(len(nodes)):
		node_info[nodes[i]].append(i + 1)
	if len(set(nodes)) == 1:
		return 'NO'
	result_lines = ['YES']
	result_edges = []
	current_group = next(iter(node_info))
	current_node = node_info[current_group].pop()
	for x in list(node_info):
		if x == current_group:
			continue
		vertices = node_info[x]
		while vertices:
			result_edges.append((current_node, vertices.pop()))
		del node_info[x]
	second = result_edges[0][1]
	while node_info[current_group]:
		result_edges.append((second, node_info[current_group].pop()))
	result_lines += ['{} {}'.format(*x) for x in result_edges]
	return '\n'.join(result_lines)
t = get(int)
for _ in range(t):
	l = get(int)
	nodes = get_arr(int)
	print(*solve(nodes))


from bisect import bisect_left as bl
from bisect import bisect_right as br
from heapq import heappush, heappop
import math
from collections import *
from functools import reduce, cmp_to_key
import sys
input = sys.stdin.readline
M = mod = 998244353

def factors(n):
	return sorted(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0))))

def inv_mod(n):
	return pow(n, mod - 2, mod)

def li():
	return [int(i) for i in input().rstrip('\n').split()]

def st():
	return input().rstrip('\n')

def val():
	return int(input().rstrip('\n'))

def li2():
	return [i for i in input().rstrip('\n')]

def li3():
	return [int(i) for i in input().rstrip('\n')]
for _ in range(val()):
	n = val()
	l = li()
	if max(l) == min(l):
		print('NO')
		continue
	print('YES')
	root = l[0]
	same = set()
	other = -1
	for i in range(1, n):
		if l[i] == root:
			same.add(i)
		else:
			other = i
			print(1, i + 1)
	for i in same:
		print(i + 1, other + 1)


for _ in range(int(input())):
	N = int(input())
	array = [int(x) for x in input().split()]
	if len(set(array)) == 1:
		print('NO')
	else:
		print('YES')
		something = sorted(set(array))
		(a, b) = (something[0], something[1])
		(c, d) = (0, 0)
		for i in range(N):
			if array[i] == a:
				c = i
				break
		for i in range(N):
			if array[i] == b:
				d = i
				break
		for i in range(N):
			if array[i] != a:
				print(c + 1, i + 1)
			elif i != c:
				print(d + 1, i + 1)


for i in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	v = [0] * n
	v[0] = 1
	d = {}
	k = []
	k.append(1)
	if len(set(l)) == 1:
		print('NO')
	else:
		print('YES')
		d[1] = []
		for j in range(1, n):
			if l[j] != l[0]:
				d[1].append(j + 1)
				v[j] = 1
		a = d[1]
		b = a[0]
		k.append(b)
		d[b] = []
		for j in range(n):
			if v[j] == 0:
				d[b].append(j + 1)
		for j in k:
			for k in d[j]:
				print(j, k)


from sys import stdin, stdout
input = stdin.readline
from collections import defaultdict as dd
import math

def geti():
	return map(int, input().strip().split())

def getl():
	return list(map(int, input().strip().split()))

def gets():
	return input()

def geta():
	return int(input())

def print_s(s):
	stdout.write(s + '\n')

def solve():
	for _ in range(geta()):
		n = geta()
		a = getl()
		if len(set(a)) == 1:
			print('NO')
			continue
		print('YES')
		edges = dd(list)
		count = dd(int)
		index = dd(list)
		for i in range(n):
			count[a[i]] += 1
			index[a[i]].append(i + 1)
		root = min(count.keys(), key=lambda x: count[x])
		val = index[root][0]
		left = count[root] - 1
		for i in count.keys():
			if i == root:
				continue
			for j in index[i]:
				edges[val].append(j)
		for i in count.keys():
			if i == root:
				continue
			for j in range(1, len(index[root])):
				edges[index[i][0]].append(index[root][j])
			break
		for i in edges.keys():
			for j in edges[i]:
				print(i, j)
solve()


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	a = list(map(int, input().split(' ')))
	b = a.copy()
	b.sort()
	ok = False
	for i in range(1, n):
		if b[i] != b[i - 1]:
			ok = True
	if ok == False:
		print('NO')
		continue
	print('YES')
	cur = 0
	for i in range(1, n):
		if a[i] != a[0]:
			print(1, i + 1)
			cur = i
	for i in range(1, n):
		if a[i] == a[0]:
			print(i + 1, cur + 1)


for j in range(int(input())):
	n = int(input())
	vals = list(map(int, input().split()))
	dis = {}
	for s in range(n):
		if not vals[s] in dis:
			dis[vals[s]] = [s + 1]
		else:
			dis[vals[s]].append(s + 1)
	keys = [x for x in dis.keys()]
	if len(keys) == 1:
		print('NO')
	else:
		ans = []
		for s in range(n):
			if vals[s] != keys[0]:
				ans.append((dis[keys[0]][0], s + 1))
		for s in range(n):
			if vals[s] == keys[0] and s + 1 != dis[keys[0]][0]:
				ans.append((dis[keys[1]][0], s + 1))
		print('YES')
		for i in ans:
			print(*i)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	A = a[0]
	flag = False
	for i in range(n):
		if a[i] != A:
			flag = True
			break
	if flag:
		print('YES')
		f = True
		B = -1
		idx = 0
		for i in range(1, n):
			if a[i] != A:
				print(1, i + 1)
				if f:
					B = a[i]
					idx = i
					f = False
		if f == False:
			for i in range(1, n):
				if a[i] == A:
					print(idx + 1, i + 1)
	else:
		print('NO')


import operator
import itertools
from collections import defaultdict

def test(cnts, vtx):
	if len(cnts.keys()) == 1:
		return ('NO',)
	else:
		(key_value, value_min) = min(cnts.items(), key=operator.itemgetter(1))
		res = []
		if value_min == 1:
			res = [f'{vtx[key_value][0]} {value}' for value in itertools.chain(*[val for (key, val) in vtx.items() if key != key_value])]
		else:
			res.extend([f'{vtx[key_value][0]} {value}' for value in itertools.chain(*[val for (key, val) in vtx.items() if key != key_value])])
			z = sorted(cnts.keys())
			k_max = z[-1]
			if k_max == key_value:
				k_max = z[-2]
			res.extend([f'{vtx[k_max][0]} {value}' for value in vtx[key_value][1:]])
		return ('YES', *res)
n = int(input())
for _ in range(n):
	cnts = defaultdict(int)
	vtx = defaultdict(list)
	_ = int(input())
	items = tuple(map(int, input().split()))
	for (idx, item) in enumerate(items):
		cnts[item] += 1
		vtx[item].append(idx + 1)
	print(*test(cnts, vtx), sep='\n')


t = int(input())
while t:
	t -= 1
	n = int(input())
	a = list(map(int, input().split()))
	lst = list(set(a))
	if len(lst) == 1:
		print('NO')
		continue
	last = -1
	print('YES')
	for i in range(1, n):
		if a[i] != a[0]:
			last = i
			print(i + 1, 1)
	for i in range(1, n):
		if a[i] == a[0]:
			print(i + 1, last + 1)


from sys import stdin, stdout
from collections import defaultdict
for _ in range(int(stdin.readline())):
	n = int(stdin.readline())
	a = [0] + list(map(int, stdin.readline().split()))
	if len(set(a[1:])) == 1:
		print('NO')
		continue
	g = defaultdict(list)
	print('YES')
	for i in range(1, n + 1):
		g[a[i]] += [i]
	d = sorted(g.items(), key=lambda x: -len(x[1]))
	gg = defaultdict(list)
	for ([k, l1], [k, l2]) in zip(d, d[1:]):
		for v in l1:
			print(v, l2[0])
	rem = d[-1][1]
	if len(rem) > 1:
		p = 1
		for v in rem[1:]:
			print(v, d[0][1][p])
			p += 1


T = int(input())
for t in range(T):
	n = int(input())
	nodes = input().split(' ')
	if all([nodes[i] == nodes[i + 1] for i in range(n - 1)]):
		print('NO')
		continue
	(A, B) = (0, 0)
	while nodes[A] == nodes[B]:
		B += 1
	print('YES')
	for i in range(n):
		if i == A or i == B:
			continue
		if nodes[i] == nodes[A]:
			print(i + 1, B + 1)
		else:
			print(i + 1, A + 1)
	print(A + 1, B + 1)


import bisect

def solve(arr, n):
	if len(set(arr)) == 1:
		return ['NO']
	res = ['YES']
	nodes = []
	for j in range(n):
		nodes.append([arr[j], j + 1])
	diff = None
	for j in range(1, n):
		if nodes[j][0] != nodes[0][0]:
			res.append([nodes[j][1], nodes[0][1]])
			if diff == None:
				diff = nodes[j][1]
	for z in range(1, n):
		if nodes[z][0] == nodes[0][0]:
			res.append([diff, nodes[z][1]])
	return res
	pass
t = int(input())
ans = []
for i in range(t):
	n = int(input())
	arr = [int(x) for x in input().split()]
	ans.append(solve(arr, n))
for test in ans:
	print(test[0])
	test.remove(test[0])
	for ele in test:
		for num in ele:
			print(num, end=' ')
		print()


import sys
input = sys.stdin.readline

def get_two_unique(n, gangs):
	(g_i, i) = (gangs[0], 0)
	j = None
	for x in range(1, n):
		if gangs[i] != gangs[x]:
			j = x
			break
	return (i, j)

def solve(n, gangs):
	(i, j) = get_two_unique(n, gangs)
	if j == None:
		print('NO')
		return
	else:
		(gi, gj) = (gangs[i], gangs[j])
	print('YES')
	print(i + 1, j + 1)
	for x in range(n):
		if x == i or x == j:
			continue
		elif gi != gangs[x]:
			print(i + 1, x + 1)
		elif gj != gangs[x]:
			print(j + 1, x + 1)
t = int(input())
for _ in range(t):
	n = int(input())
	gangs = list(map(int, input().split()))
	solve(n, gangs)


import sys
import math
import itertools
import functools
import collections
import operator
import fileinput
import copy
import string
ORDA = 97

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return [int(i) for i in input().split()]

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def revn(n):
	return str(n)[::-1]

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=2):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base):
	new_number = 0
	while number > 0:
		new_number += number % base
		number //= base
	return new_number

def cdiv(n, k):
	return n // k + (n % k != 0)

def ispal(s):
	for i in range(len(s) // 2 + 1):
		if s[i] != s[-i - 1]:
			return False
	return True
for _ in range(ii()):
	n = ii()
	a = li()
	d = {}
	for i in range(n):
		if a[i] not in d:
			d[a[i]] = [i + 1]
		else:
			d[a[i]].append(i + 1)
	if len(d.keys()) == 1:
		print('NO')
	else:
		print('YES')
		dk = list(d.keys())
		ans = []
		for k in d:
			if k != dk[0]:
				for item in d[k]:
					ans.append([d[dk[0]][0], item])
		for i in d[dk[0]][1:]:
			ans.append([i, d[dk[-1]][0]])
		for i in range(n - 1):
			print(*ans[i])


ans = []
for t in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	if len(set(a)) == 1:
		ans += [['NO']]
	else:
		ans += [['YES']]
		bad = []
		for i in range(1, n):
			if a[i] != a[0]:
				ans += [(1, i + 1)]
			else:
				bad += [i + 1]
		for i in range(n - 1, -1, -1):
			if a[i] != a[0]:
				for el in bad:
					ans += [(i + 1, el)]
				break
[print(*i) for i in ans]


from sys import stdin, stdout

def INI():
	return int(stdin.readline())

def INL():
	return [int(_) for _ in stdin.readline().split()]

def INS():
	return stdin.readline()

def OPS(ans):
	stdout.write(str(ans) + '\n')

def OPL(ans):
	[stdout.write(str(_) + ' ') for _ in ans]
	stdout.write('\n')
from collections import Counter
import operator
for _ in range(INI()):
	n = INI()
	A = INL()
	C = Counter(A)
	C = sorted(C.items(), key=operator.itemgetter(1))
	m = C[0][0]
	M = []
	for _ in range(n):
		if A[_] == m:
			M.append(_ + 1)
	if [A[0] for _ in range(n)] == A:
		OPS('NO')
	else:
		OPS('YES')
		for _ in range(n):
			if A[_] != m:
				print(M[0], _ + 1)
		M = M[1:]
		i = 0
		j = len(M)
		_ = 0
		while i < j:
			if A[_] != m:
				print(_ + 1, M[i])
				i += 1
			_ += 1


import math
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	if a.count(a[0]) == n:
		print('NO')
		continue
	print('YES')
	ind = [a.index(x) for x in set(a)]
	x = n - 1
	roads = []
	for i in range(len(ind) - 1):
		roads.append((ind[i] + 1, ind[i + 1] + 1))
		x -= 1
	for i in range(n):
		if i in ind:
			continue
		else:
			temp = -1
			for j in ind:
				if a[j] != a[i]:
					temp = j
					break
			roads.append((temp + 1, i + 1))
			x -= 1
	for ele in roads:
		print(ele[0], ele[1])


a = input()
for x in range(int(a)):
	b = input()
	c = input().split(' ')
	dict = {}
	list2 = []
	tag = 0
	buffer = 0
	for i in range(len(c)):
		if int(c[i]) not in dict:
			dict[int(c[i])] = [i]
			list2.append(int(c[i]))
		else:
			dict[int(c[i])].append(i)
			tag = max(tag, len(dict[int(c[i])]))
	if tag == len(c):
		print('NO')
	else:
		print('YES')
		p = dict[list2[0]][0]
		for i in range(1, len(list2)):
			for j in dict[list2[i]]:
				print(p + 1, j + 1)
		p = dict[list2[1]][0]
		for i in range(1, len(dict[list2[0]])):
			print(p + 1, dict[list2[0]][i] + 1)


for _ in range(int(input())):
	n = int(input())
	mx = 0
	dm = True
	arr = list(map(int, input().split()))
	arr2 = arr.copy()
	arr2.sort()
	if len(set(arr)) == 1:
		print('NO')
	else:
		print('YES')
		for k in arr2:
			if k != arr[0]:
				x = k
			if arr.count(k) == 1:
				dm = False
				zzz = arr.index(k)
				for kk in range(0, n):
					if kk != zzz:
						print(zzz + 1, kk + 1)
				break
		if dm:
			mm = arr.index(x)
			print(1, mm + 1)
			for hj in range(0, n):
				if arr[hj] != arr[0]:
					if (hj + 1, 1) != (mm + 1, 1):
						print(hj + 1, 1)
				elif (mm + 1, hj + 1) != (mm + 1, 1):
					print(mm + 1, hj + 1)


from collections import Counter

def solve_bridges(arr):
	cnt = Counter(arr)
	if len(cnt) == 1:
		return []
	root_group = min(cnt.keys(), key=lambda x: cnt[x])
	first_level = []
	roots_level = []
	for (i, a) in enumerate(arr):
		if a == root_group:
			roots_level.append(i)
		else:
			first_level.append(i)
	res = []
	for i in first_level:
		res.append((roots_level[0], i))
	for i in roots_level[1:]:
		res.append((first_level[0], i))
	return res
import sys
t = int(sys.stdin.readline())
for _ in range(t):
	n = int(sys.stdin.readline())
	arr = [int(a) for a in sys.stdin.readline().split()]
	res = solve_bridges(arr)
	if not res:
		print('NO')
	else:
		print('YES')
		for (f, s) in res:
			print(str(f + 1) + ' ' + str(s + 1))


import os, sys
from io import BytesIO, IOBase

def main():
	for _ in range(int(input())):
		n = int(input())
		arr = list(map(int, input().split()))
		if len(set(arr)) == 1:
			print('NO')
			continue
		print('YES')
		xx = -1
		for (ind, val) in enumerate(arr):
			if val != arr[0]:
				xx = ind + 1
				print(1, ind + 1)
		for (ind, val) in enumerate(arr):
			if val == arr[0] and ind:
				print(xx, ind + 1)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


def solve():
	n = int(input())
	arr = list(map(int, input().split()))
	d = {}
	for i in range(n):
		if arr[i] in d:
			d[arr[i]].append(i + 1)
		else:
			d[arr[i]] = [i + 1]
	if len(d) == 1:
		print('NO')
	else:
		print('YES')
		k = list(d.keys())
		x = k.pop(0)
		x = d[x]
		t = x.pop(0)
		for i in k:
			for j in d[i]:
				print(t, j)
		for i in x:
			print(j, i)

def main():
	t = int(input())
	for _ in range(t):
		solve()
main()


def solve(n, a):
	temp = []
	it1 = max(a)
	it2 = min(a)
	if it1 == it2:
		print('NO')
	else:
		print('YES')
		p1 = a.index(it1)
		p2 = a.index(it2)
		for i in range(n):
			if i == p1:
				continue
			if a[i] == a[p1]:
				print('{} {}'.format(i + 1, p2 + 1))
			else:
				print('{} {}'.format(i + 1, p1 + 1))
t = int(input())
while t:
	n = int(input())
	a = list(map(int, input().split()))
	solve(n, a)
	t -= 1


ns = lambda : input()
ni = lambda : int(input())
nm = lambda : map(int, input().split())
nl = lambda : list(map(int, input().split()))
for _ in range(ni()):
	n = ni()
	a = nl()
	d = {}
	for i in range(n):
		d.setdefault(a[i], [])
		d[a[i]].append(i + 1)
	l = len(d.keys())
	if l == 1:
		print('NO')
		continue
	print('YES')
	k = list(d.keys())
	fi = d[k[0]][0]
	for i in range(1, l):
		for j in d[k[i]]:
			print(fi, j)
	if len(d[k[0]]) > 1:
		la = d[k[l - 1]][0]
		for j in range(1, len(d[k[0]])):
			print(la, d[k[0]][j])


def solve(arr, n):
	res = []
	root = arr[0]
	idx = -1
	for i in range(1, n):
		if arr[i] != root:
			idx = i
			res.append([1, i + 1])
	if idx == -1:
		print('NO')
		return
	for i in range(1, n):
		if arr[i] == root:
			res.append([idx + 1, i + 1])
	print('YES')
	for (k, v) in res:
		print('{} {}'.format(k, v))

def main():
	t = int(input())
	for q_itr in range(t):
		n = int(input())
		arr = list(map(int, input().split()))
		solve(arr, n)
main()


t = int(input())
for test in range(t):
	n = int(input())
	a = list(map(int, input().rstrip().split()))
	M = max(a)
	m = min(a)
	if M == m:
		print('NO')
	else:
		print('YES')
		indiceM = -1
		indicem = -1
		for (i, el) in enumerate(a):
			if el == M:
				indiceM = i
			if el == m:
				indicem = i
		for (i, el) in enumerate(a):
			if i != indicem:
				if el == M:
					print('{} {}'.format(i + 1, indicem + 1))
				else:
					print('{} {}'.format(i + 1, indiceM + 1))


tc = int(input())
for i in range(tc):
	N = int(input())
	dis_str = input()
	dis = list((int(n) for n in dis_str.split()))
	maindis = []
	if min(dis) != max(dis):
		print('YES')
		flag = 1
		pos = -1
		while flag:
			try:
				pos = dis.index(dis[0], pos + 1)
				maindis.append(pos)
			except:
				flag = 0
		lens = len(dis)
		for (ii, d) in enumerate(dis):
			if ii in maindis:
				pass
			else:
				print(1, ii + 1)
				temp = ii
		for (ii, d) in enumerate(maindis):
			if d != 0:
				print(d + 1, temp + 1)
	else:
		print('NO')


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	if len(set(a)) == 1:
		print('NO')
		continue
	print('Yes')
	last = -1
	for i in range(1, n):
		if a[i] != a[0]:
			print(1, i + 1)
			last = i
	for i in range(1, n):
		if a[i] == a[0]:
			print(i + 1, last + 1)


for _ in range(int(input())):
	n = int(input())
	li = [int(i) for i in input().split()]
	ans = []
	d = {}
	for (p, i) in enumerate(li):
		d.setdefault(i, []).append(p)
	res = sorted(d.items())
	if len(res) > 1:
		for i in res[0][1][1:]:
			ans.append((i + 1, res[-1][1][0] + 1))
	for (p, i) in enumerate(res[1:]):
		for j in i[1]:
			ans.append((res[p][1][0] + 1, j + 1))
	if len(ans) == n - 1:
		print('YES')
		for k in ans:
			print(*k)
	else:
		print('NO')


def dfs(v, visited, ans):
	visited[v] = 0
	next_ans = ans
	for u in range(n):
		if visited[u] and a[v] != a[u]:
			next_ans = dfs(u, visited, ans)
			next_ans.append((v + 1, u + 1))
	return next_ans
for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	if len(set(a)) < 2:
		print('NO')
	else:
		print('YES')
		comp = -1
		i = 1
		while a[i] == a[0]:
			i += 1
		comp = i + 1
		for i in range(1, n):
			if a[i] != a[0]:
				print(i + 1, 1)
			else:
				print(i + 1, comp)


a = int(input())
for b in range(a):
	int(input())
	listg = list(map(int, input().split()))
	counter = 1
	for c in range(len(listg) - 1):
		if listg[0] == listg[c + 1]:
			counter += 1
		else:
			continue
	if counter == len(listg):
		print('NO')
	else:
		min1 = min(listg)
		max1 = max(listg)
		listg2 = listg[:]
		listg2[listg.index(min1)] = 99999999999
		listg2[listg.index(max1)] = 99999999999
		print('YES')
		print(str(listg.index(min1) + 1) + ' ' + str(listg.index(max1) + 1))
		for i in range(len(listg)):
			if listg2[i] == 99999999999:
				continue
			elif min1 != listg2[i]:
				print(str(listg.index(min1) + 1) + ' ' + str(listg2.index(listg2[i]) + 1))
			else:
				print(str(listg.index(max1) + 1) + ' ' + str(listg2.index(listg2[i]) + 1))
			listg2[i] = 99999999999


def ass(a, b):
	print(f'Assertion error: {a} != {b}' if a != b else 'OK')

def rx():
	return [s.rstrip() for s in open(0)]

def nrxs(s):
	return [int(i) for i in s.split()]

def f(a):
	k = -1
	res = []
	b = []
	for i in range(1, len(a)):
		if a[0] != a[i]:
			res.append([1, i + 1])
			k = i
		else:
			b.append(i)
	if k != -1:
		for item in b:
			res.append([k + 1, item + 1])
	return res
for s in rx()[2::2]:
	res = f(nrxs(s))
	print('NO' if res == [] else 'YES')
	for item in res:
		print(*item)


cases = int(input())
for t in range(cases):
	n = int(input())
	a = list(map(int, input().split()))
	a1 = {}
	for i in range(n):
		if a[i] in a1:
			a1[a[i]].append(i)
		else:
			a1[a[i]] = [i]
	if len(a1) == 1:
		print('NO')
	else:
		print('YES')
		p = [(len(v), k) for (k, v) in a1.items()]
		p = sorted(p)
		(_, start) = p[0]
		spos = a1[start].pop()
		f = 0
		for (_, i) in p[1:]:
			while a1[i]:
				epos = a1[i].pop()
				print(spos + 1, epos + 1)
		spos = epos
		while a1[start]:
			epos = a1[start].pop()
			print(spos + 1, epos + 1)


import math
import string
import random
from random import randrange
from collections import deque
from collections import defaultdict

def solve(n, arr):
	ans = []
	if max(arr) == min(arr):
		print('NO')
		return
	ind = 0
	ind1 = 0
	mx = max(arr)
	mn = min(arr)
	for i in range(n):
		if mx == arr[i]:
			ind = i
		elif mn == arr[i]:
			ind1 = i
	print('YES')
	for i in range(n):
		if i == ind:
			continue
		if arr[i] == mx and i != ind:
			print(i + 1, ind1 + 1)
		elif arr[i] == mx:
			print(i + 1, ind1 + 1)
		else:
			print(i + 1, ind + 1)
	return

def main():
	t = int(input())
	while t > 0:
		t -= 1
		n = int(input())
		arr = list(map(int, input().strip().split(' ')))
		solve(n, arr)
	return

def test():
	arr_size = 25
	test_cases = 100
	min_range = -100
	max_range = 100
	str_size = 30
	step = 1
	for i in range(test_cases):
		k = []
		for j in range(arr_size):
			num = randrange(min_range, max_range, step)
			k.append(num)
		solve(n, arr)
		print('<-------- DEBUG ----------->')
	return
main()


import sys
import math
input = sys.stdin.readline

def inp():
	return int(input())

def inara():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
t = inp()
for _ in range(t):
	n = inp()
	a = inara()
	done = [0] * n
	edge = []
	for i in range(n):
		for j in range(n):
			if a[i] != a[j] and (not done[j]):
				done[j] = 1
				done[i] = 1
				edge.append([i + 1, j + 1])
	if len(edge) == n - 1:
		print('YES')
		for [u, v] in edge:
			print(u, v)
	else:
		print('NO')


import os
import sys
from math import factorial
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
readint = lambda : int(sys.stdin.readline().rstrip('\r\n'))
readints = lambda : map(int, sys.stdin.readline().rstrip('\r\n').split())
readstr = lambda : sys.stdin.readline().rstrip('\r\n')
readstrs = lambda : map(str, sys.stdin.readline().rstrip('\r\n').split())
readarri = lambda : [int(_) for _ in sys.stdin.readline().rstrip('\r\n').split()]
readarrs = lambda : [str(_) for _ in sys.stdin.readline().rstrip('\r\n').split()]

def main():
	for _ in range(readint()):
		n = readint()
		a = readarri()
		res = []
		idx = -1
		for i in range(1, n):
			if a[i] != a[0]:
				idx = i
				res.append([1, i + 1])
		if idx == -1:
			print('NO')
			continue
		for i in range(1, n):
			if a[i] == a[0]:
				res.append([idx + 1, i + 1])
		print('YES')
		for i in res:
			print(*i)
main()


from collections import defaultdict

def solve(A):
	N = len(A)
	reached = set()
	idx = defaultdict(list)
	for (i, n) in enumerate(A):
		idx[n].append(i)
	ans = []
	start = min(idx, key=lambda x: len(idx[x]))
	start = idx[start][0]
	can = [start]
	reached.add(start)
	while can:
		pnd = set()
		for n in can:
			for i in range(N):
				if i == n:
					continue
				if A[i] == A[n]:
					continue
				if i in reached:
					continue
				ans.append([i + 1, n + 1])
				reached.add(i)
				pnd.add(i)
		can = pnd
	if len(ans) == N - 1:
		print('YES')
		for (s, e) in ans:
			print('{} {}'.format(s, e))
	else:
		print('NO')
for _ in range(int(input())):
	input()
	A = [int(x) for x in input().split()]
	solve(A)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	ans = []
	b = []
	b += a
	b.sort()
	if b[0] == b[n - 1]:
		print('NO')
	else:
		y = 0
		for i in range(1, n):
			if a[0] != a[i]:
				ans += [0 + 1, i + 1]
				y = i
		for i in range(1, n):
			if a[i] == a[0]:
				ans += [y + 1, i + 1]
		print('YES')
		for i in range(int(len(ans) / 2)):
			print(ans[i * 2], ans[i * 2 + 1])


for _ in range(int(input())):
	n = int(input())
	ls = list(map(int, input().split()))
	a1 = ls[0]
	if len(ls) == ls.count(a1):
		print('NO')
	else:
		print('YES')
		c = []
		ind = 0
		for i in range(1, n):
			if ls[i] != a1:
				print(1, i + 1)
				ind = i + 1
			else:
				c.append(i + 1)
		for i in range(len(c)):
			print(ind, c[i])


def solve():
	n = int(input())
	lst = list(map(int, input().split()))
	path = []
	for i in range(n):
		path.append([lst[i], i + 1])
	path.sort()
	isbrk = 0
	ans = []
	if path[0][0] == path[-1][0]:
		print('NO')
		isbrk = 1
	else:
		ans.append([path[0][1], path[-1][1]])
		for i in range(1, n - 1):
			if path[i][0] != path[0][0]:
				ans.append([path[0][1], path[i][1]])
			else:
				ans.append([path[-1][1], path[i][1]])
	if isbrk == 0:
		print('YES')
		for item in ans:
			print(item[0], item[1])
	return
t = int(input())
while t != 0:
	solve()
	t -= 1


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush, nsmallest
from math import ceil, floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
from decimal import Decimal
from copy import deepcopy
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(var, end='\n'):
	sys.stdout.write(str(var) + end)

def outa(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def l():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return list(map(int, data().split()))

def ssp():
	return list(map(str, data().split()))

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
for _ in range(int(data())):
	n = int(data())
	arr = l()
	if len(set(arr)) == 1:
		out('NO')
		continue
	out('YES')
	(no, L) = (-1, [])
	for i in range(1, n):
		if arr[i] == arr[0]:
			L.append(i + 1)
		else:
			no = i + 1
			outa(1, i + 1)
	for i in L:
		outa(no, i)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	gangs = list(set(a))
	if len(gangs) < 2:
		print('NO')
		continue
	(g1, g2) = (gangs[0], gangs[1])
	v1 = a.index(g1)
	v2 = a.index(g2)
	edges = []
	for (i, g) in enumerate(a):
		if g == g1:
			edges.append((v2, i))
		elif i != v2:
			edges.append((v1, i))
	print('YES')
	for (u, v) in edges:
		print(u + 1, v + 1)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from math import gcd, ceil

def prod(a, mod=10 ** 9 + 7):
	ans = 1
	for each in a:
		ans = ans * each % mod
	return ans

def lcm(a, b):
	return a * b // gcd(a, b)

def binary(x, length=16):
	y = bin(x)[2:]
	return y if len(y) >= length else '0' * (length - len(y)) + y
for _ in range(int(input()) if True else 1):
	n = int(input())
	a = list(map(int, input().split()))
	if len(set(a)) == 1:
		print('NO')
		continue
	print('YES')
	p = list(set(a))
	i1 = a.index(p[0])
	i2 = a.index(p[1])
	for i in range(n):
		if a[i] == p[0]:
			if i != i1:
				print(i + 1, i2 + 1)
		else:
			print(i + 1, i1 + 1)


t = 1
t = int(input())
while t:
	t -= 1
	n = int(input())
	a = list(map(int, input().split()))
	cnt = {}
	for (i, el) in enumerate(a):
		if el in cnt:
			cnt[el].append(i)
		else:
			cnt[el] = [i]
	if len(cnt) == 1:
		print('NO')
		continue
	visited = [False] * n
	edges = []
	curr_parent = 0
	parent = 0
	parent_gang = a[0]
	gang_towns = cnt[parent_gang]
	del cnt[parent_gang]
	for val in cnt.values():
		child = -1
		for c in val:
			edges.append((parent + 1, c + 1))
			child = c
		parent = child
	for c in gang_towns[1:]:
		edges.append((parent + 1, c + 1))
	print('YES')
	for edge in edges:
		print(*edge)


t = int(input(''))
for _ in range(t):
	n = int(input(''))
	arr = list(map(int, input().split()))
	sol = []
	for i in range(n):
		sol.append([arr[i], i + 1])
	sol.sort()
	if sol[0][0] == sol[n - 1][0]:
		print('NO')
		continue
	print('YES')
	ans = []
	x = sol[0][0]
	ind = -1
	for i in range(n - 1):
		if sol[i][0] != sol[n - 1][0]:
			print(sol[i][1], sol[n - 1][1])
	for i in range(n - 2, -1, -1):
		if sol[i][0] == sol[n - 1][0]:
			print(sol[i][1], sol[0][1])


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	ar = list(map(int, input().split()))
	if len(set(ar)) == 1:
		print('NO')
	else:
		dic = {}
		for i in range(n):
			if ar[i] in dic:
				dic[ar[i]].append(i)
			else:
				dic[ar[i]] = [i]
		ma = max(list(dic.keys()), key=lambda x: len(dic[x]))
		mai = dic[ma][0]
		print('YES')
		for j in dic:
			if j != ma:
				for k in dic[j]:
					print(mai + 1, k + 1)
		for i in range(n):
			if ar[i] != ma:
				break
		le = len(dic[ma])
		if le > 1:
			for j in range(1, le):
				print(i + 1, dic[ma][j] + 1)


t = int(input())
for i in range(t):
	n = int(input())
	dist = list(map(int, input().split(' ')))
	unused_idx = []
	a1 = dist[0]
	ans = []
	idx = -1
	for i in range(1, n):
		if dist[i] != a1:
			ans.append((1, i + 1))
			idx = i + 1
		else:
			unused_idx.append(i + 1)
	if idx == -1:
		print('NO')
		continue
	for i in unused_idx:
		ans.append((idx, i))
	print('YES')
	for i in ans:
		print(f'{i[0]} {i[1]}')


import typing

def rl(*args) -> typing.Iterable:
	(func, funcs) = (int, (int, float, str))
	(itr, itrs) = (iter, (iter, list, tuple, set))
	sep = ' '
	for a in args:
		if a in funcs:
			func = a
		elif a in itrs:
			itr = a
		elif isinstance(a, str):
			sep = a
	return itr(map(func, input().strip().split(sep)))
T = int(input())
while T:
	T -= 1
	n = int(input())
	xs = rl(tuple)
	set_xs = set(xs)
	if len(set_xs) == 1:
		print('NO')
	else:
		print('YES')
		leads = []
		for (x, _) in zip(set_xs, range(2)):
			leads.append(x)
		(x0, x1) = leads
		i0 = xs.index(x0) + 1
		i1 = xs.index(x1) + 1
		for (i, x) in enumerate(xs, 1):
			if x != x0:
				print(f'{i0} {i}')
			elif i != i0:
				print(f'{i1} {i}')


from sys import stdin, stdout

def input():
	return stdin.readline().strip()
from collections import defaultdict

def back_of(gangs):
	for i in range(len(gangs)):
		if gangs[i] != gangs[0]:
			return i

def ans(gangs):
	if len(set(gangs)) == 1:
		print('NO')
		return
	gs = set()
	for i in range(len(gangs)):
		gs.add(gangs[i])
	print('YES')
	for i in range(len(gangs)):
		if gangs[i] != gangs[0]:
			print(1, i + 1)
	back = back_of(gangs)
	for i in range(1, len(gangs)):
		if gangs[i] == gangs[0]:
			print(back + 1, i + 1)
for _ in range(int(input())):
	input()
	gangs = list(map(int, input().split()))
	ans(gangs)


from collections import *
from functools import *
import math
import sys
inp = sys.stdin.readline
out = sys.stdout.write

def mi():
	return map(int, inp().split())

def li():
	return list(mi())

def ii():
	return int(inp())

def main():
	for _ in range(ii()):
		n = ii()
		a = li()
		x = a[0]
		if n == a.count(x):
			print('NO')
		else:
			print('YES')
			z = []
			y = None
			for i in range(1, n):
				if a[i] != x:
					print(1, i + 1)
					y = i + 1
				else:
					z.append(i + 1)
			for i in z:
				print(y, i)
main()


import sys
from array import array
import typing as Tp

def input():
	return sys.stdin.buffer.readline().decode('utf-8')

def output(*args):
	sys.stdout.buffer.write(('\n'.join(map(str, args)) + '\n').encode('utf-8'))

def main():
	from collections import defaultdict
	t = int(input())
	ans_a = [''] * t
	for ti in range(t):
		n = int(input())
		gang = defaultdict(list)
		cnt = defaultdict(int)
		for (i, x) in enumerate(map(int, input().split()), start=1):
			gang[x].append(i)
			cnt[x] += 1
		a = sorted(((v, k) for (k, v) in cnt.items()))
		if len(a) == 1:
			ans_a[ti] = 'NO'
			continue
		v1 = gang[a[0][1]].pop()
		v2 = gang[a[1][1]][0]
		ans = []
		for (_, k) in a[1:]:
			for dest in gang[k]:
				ans.append(f'{v1} {dest}')
		for dest in gang[a[0][1]]:
			ans.append(f'{v2} {dest}')
		ans_a[ti] = 'YES\n' + '\n'.join(ans)
	output(*ans_a)
main()


for u in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	x = 0
	if len(set(l)) > 1:
		print('YES')
		for i in range(1, n):
			if l[i] != l[0]:
				x = i + 1
				break
		for i in range(1, n):
			if l[i] != l[0]:
				print(i + 1, 1)
			else:
				print(i + 1, x)
	else:
		print('NO')


rn = lambda : int(input())
rl = lambda : list(map(int, input().split()))
rns = lambda : map(int, input().split())
rs = lambda : input()
yn = lambda x: print('Yes') if x else print('No')
YN = lambda x: print('YES') if x else print('NO')
for _ in range(rn()):
	n = rn()
	l = rl()
	if len(set(l)) == 1:
		print('NO')
	else:
		for i in range(n):
			l[i] = [l[i], i + 1]
		l.sort()
		i = 0
		while l[i][0] == l[0][0]:
			i += 1
		print('YES')
		for j in range(i, n):
			print(l[0][1], l[j][1])
		for j in range(1, i):
			print(l[j][1], l[i][1])


from collections import *
a = int(input())
for i in range(a):
	s = int(input())
	z = list(map(int, input().split()))
	if z.count(z[0]) == len(z):
		print('NO')
		continue
	else:
		al = defaultdict(int)
		dl = defaultdict(list)
		for i in range(len(z)):
			al[z[i]] += 1
			dl[z[i]].append(i + 1)
		ans = []
		for i in al:
			ans.append([al[i], i])
		ans.sort()
		fin = []
		x = dl[ans[0][1]][0]
		for i in range(1, len(ans)):
			ye = ans[i][1]
			for j in range(len(dl[ye])):
				fin.append([x, dl[ye][j]])
		m = dl[ans[1][1]][0]
		for i in range(1, len(dl[ans[0][1]])):
			fin.append([m, dl[ans[0][1]][i]])
		print('YES')
		for i in range(len(fin)):
			print(fin[i][0], fin[i][1])


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	if arr.count(arr[0]) == len(arr):
		print('NO')
	else:
		print('YES')
		count = 0
		ind = []
		i = 0
		for j in range(1, n):
			if arr[0] != arr[j]:
				print(1, j + 1)
				count += 1
				if count == 1:
					i = j
			else:
				ind.append(j)
		for j in ind:
			print(i + 1, j + 1)


test = int(input())
for _ in range(test):
	n = int(input())
	arr = list(map(int, input().split()))
	arrv = sorted(arr)
	if arrv[0] == arrv[-1]:
		print('NO')
	else:
		ans = []
		m = arr[0]
		for i in range(n):
			if arr[i] != m:
				sec = i + 1
				break
		print('YES')
		for i in range(n):
			if arr[i] != m:
				print(1, i + 1)
		for i in range(1, n):
			if arr[i] == m:
				print(sec, i + 1)


for test in range(int(input())):
	q = int(input())
	bands = list(map(int, input().split()))[:q]
	checking = set(bands)
	if len(checking) == 1:
		print('NO')
	else:
		lng = len(bands)
		print('YES')
		netts = []
		for i in range(lng):
			if i == lng - 1 and len(netts) < lng - 1:
				for j in range(lng):
					if bands[i] != bands[j]:
						netts.append((i + 1, j + 1))
						break
			for j in range(i + 1, lng):
				if bands[i] != bands[j]:
					netts.append((i + 1, j + 1))
					break
				if j == lng - 1 and bands[i] == bands[i - 1]:
					for jj in range(0, i):
						if bands[i] != bands[jj]:
							netts.append((i + 1, jj + 1))
							break
		for nett in netts:
			print(*nett)


import sys, math
from collections import deque, defaultdict
import operator as op
from functools import reduce
I = sys.stdin.readline

def ii():
	return int(I().strip())

def li():
	return list(map(int, I().strip().split()))

def mi():
	return map(int, I().strip().split())

def ncr(n, r):
	r = min(r, n - r)
	numer = reduce(op.mul, range(n, n - r, -1), 1)
	denom = reduce(op.mul, range(1, r + 1), 1)
	return numer // denom

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def valid(row, col, rows, cols, rcross, lcross):
	return rows[row] == 0 and cols[col] == 0 and (rcross[col + row] == 0) and (lcross[col - row] == 0)

def main():
	for _ in range(ii()):
		n = ii()
		arr = li()
		vis = [1] * n
		flag = 1
		cnt = 0
		ans = []
		for i in range(n - 1):
			for j in range(i + 1, n):
				if arr[i] != arr[j] and (vis[j] == 1 or vis[i] == 1):
					ans.append((i + 1, j + 1))
					vis[i] = 0
					vis[j] = 0
					cnt += 1
					if cnt == n - 1:
						flag = 0
						break
			if flag == 0:
				break
		if len(ans) == 0:
			print('NO')
		else:
			print('YES')
			for i in ans:
				print(i[0], i[1])
main()


t = int(input())
for _ in range(t):
	n = int(input())
	gangs = list(map(int, input().split()))
	if len(set(gangs)) == 1:
		print('NO')
	else:
		print('YES')
		start = gangs[0]
		other_idx = None
		remaining = []
		for i in range(1, n):
			if gangs[i] == start:
				remaining.append(i)
			else:
				if other_idx is None:
					other_idx = i
				print(1, i + 1)
		for idx in remaining:
			print(other_idx + 1, idx + 1)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	gangs = {}
	for i in range(n):
		if a[i] not in gangs:
			gangs[a[i]] = []
		gangs[a[i]].append(i + 1)
	if len(gangs) <= 1:
		print('NO')
		continue
	print('YES')
	gang0 = a[0]
	gang1 = -1
	for gang in gangs.keys():
		if gang != gang0:
			gang1 = gang
			break
	for (gang, districts) in gangs.items():
		if gang != gang0:
			for d in districts:
				print(gangs[gang0][0], d)
		else:
			for d in districts:
				if d == gangs[gang0][0]:
					continue
				print(d, gangs[gang1][0])


for _ in range(int(input())):
	n = int(input())
	lst = [int(i) for i in input().split()]
	(k, ind) = (lst.count(lst[0]), 0)
	if k == n:
		print('NO')
	else:
		print('YES')
		for i in range(n):
			if lst[i] != lst[0]:
				print(1, i + 1, sep=' ')
				ind = i
		for i in range(1, n):
			if lst[i] == lst[0]:
				print(i + 1, ind + 1, sep=' ')


for _ in range(int(input())):
	n = int(input())
	a = [int(x) for x in input().split()]
	c = []
	d = []
	for i in range(n):
		if i != n - 1 and a[i + 1] == a[i]:
			c.append(i + 1)
		if i != n - 1 and a[i + 1] != a[i]:
			d.append(i + 1)
	if len(d) == 0:
		print('NO')
	else:
		print('YES')
		for j in range(len(d)):
			print(d[j], d[j] + 1)
			if j == 0:
				for i in c[:d[j] - 1]:
					print(i, d[0] + 1)
			else:
				for i in range(d[j - 1] + 1, d[j]):
					print(i, d[j] + 1)
	if len(d) != 0 and d[-1] != n - 1:
		for i in range(d[-1] + 2, n + 1):
			print(d[-1], i)


import sys
input = sys.stdin.readline
I = lambda : list(map(int, input().split()))
(t,) = I()
for i in range(t):
	(n,) = I()
	l = I()
	an = 'NO'
	ed = []
	vis = [0] * n
	if l.count(l[0]) != n:
		an = 'YES'
		se = []
		fd = 0
		for i in range(n):
			if l[i] != l[0]:
				fd = i + 1
				ed.append([1, i + 1])
			elif i != 0:
				se.append(i + 1)
		for i in se:
			ed.append([i, fd])
	print(an)
	for i in ed:
		print(*i)


def cal(n, arr):
	dic = {}
	for i in range(n):
		if arr[i] not in dic:
			dic[arr[i]] = [i + 1]
		else:
			dic[arr[i]].append(i + 1)
	if len(dic) == 1:
		print('NO')
		return
	print('YES')
	visited = set()
	all_gang = list(dic.keys())
	last_city = None
	while len(all_gang) > 1:
		cur_gang = all_gang.pop(0)
		for cur_gang_child in dic[cur_gang]:
			visited.add(cur_gang_child)
			visited.add(dic[all_gang[0]][0])
			print(cur_gang_child, dic[all_gang[0]][0])
			last_city = cur_gang_child
	cur_gang = all_gang.pop(0)
	while len(dic[cur_gang]):
		cur_gang_child = dic[cur_gang].pop(0)
		if cur_gang_child not in visited:
			print(cur_gang_child, last_city)
t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	cal(n, arr)


t = int(input())
for _ in range(t):
	n = int(input())
	s = input().split()
	v = list(map(int, s))
	roads = []
	x = v[0]
	p = 0
	for i in range(1, n):
		if v[i] != x:
			p = i
			roads.append((1, i + 1))
	if p == 0:
		print('NO')
		continue
	else:
		print('YES')
		for i in range(1, n):
			if v[i] == x:
				roads.append((i + 1, p + 1))
	for r in roads:
		print(str(r[0]) + ' ' + str(r[1]))


testcases = int(input())
for testcase in range(testcases):
	n = int(input())
	temparr = input()
	temparr = temparr.split()
	arr = []
	dicts = {}
	uniqindex = -1
	for (j, i) in enumerate(temparr):
		i = int(i)
		arr.append(i)
		if i not in dicts:
			dicts[i] = []
		dicts[i].append(int(j))
	if len(dicts) == 1:
		print('NO')
		continue
	for (key, value) in dicts.items():
		if len(value) == 1:
			uniqindex = value[0]
			break
	flag = 0
	if uniqindex != -1:
		print('YES')
		flag = 1
		i1index = uniqindex + 1
		for i in range(1, n + 1):
			if i != i1index:
				print(str(i) + ' ' + str(i1index))
	if flag == 1:
		continue
	dicts = {}
	count = 0
	ansarr = []
	visited = {}
	for i in range(n - 1):
		curval = arr[i]
		for j in range(i + 1, n):
			if count == n - 1:
				break
			newval = arr[j]
			curstrs = str(j) + ',' + str(i)
			revstrs = str(i) + ',' + str(j)
			if curval != newval and curstrs not in dicts and (revstrs not in dicts) and (i not in visited or j not in visited):
				count += 1
				visited[i] = 1
				visited[j] = 1
				dicts[curstrs] = 1
				dicts[revstrs] = 1
				tempa = [str(i + 1), str(j + 1)]
				ansarr.append(tempa[:])
		if count == n - 1:
			break
	if count < n - 1:
		print('NO')
	else:
		print('YES')
		for tup in ansarr:
			print(' '.join(tup))


for _ in range(int(input())):
	n = int(input())
	list1 = [int(i) for i in input().split()]
	list2 = []
	count = 0
	a = 0
	for i in range(1, n):
		if list1[0] == list1[i]:
			list2.append(i)
		else:
			if count == 0:
				print('YES')
				a = i
			count += 1
			print(1, i + 1)
	if len(list2) == n - 1:
		print('NO')
	else:
		for i in range(len(list2)):
			print(a + 1, list2[i] + 1)


for _ in range(int(input())):
	n = int(input())
	a = input().split()
	for i in range(n):
		a[i] = [int(a[i]), i]
	a.sort()
	if a[0][0] == a[-1][0]:
		print('NO')
	else:
		print('YES')
		for i in range(n - 1):
			if a[i][0] == a[0][0]:
				print(a[i][1] + 1, a[-1][1] + 1)
			else:
				print(a[i][1] + 1, a[0][1] + 1)


from sys import stdin, stdout
from collections import Counter
from itertools import permutations
import bisect
import math
I = lambda : map(int, stdin.readline().split())
I1 = lambda : stdin.readline()
for _ in range(int(I1())):
	n = int(I1())
	a = list(I())
	if len(set(a)) == 1:
		print('NO')
		continue
	d = {}
	f = 0
	for x in a:
		d[x] = d.get(x, 0) + 1
	y = 0
	m = 20000
	for x in d:
		if d[x] <= m:
			m = d[x]
			y = x
	print('YES')
	ind = a.index(y)
	l = []
	b = []
	for i in range(n):
		if a[i] != a[ind]:
			l.append([i + 1, ind + 1])
		elif i != ind:
			b.append(i)
	for x in b:
		for i in range(n):
			if a[x] != a[i]:
				l.append([x + 1, i + 1])
				break
	for i in range(n - 1):
		print(*l[i])


tests = int(input())
for t in range(tests):
	size = int(input())
	A = list(map(int, input().split()))
	center = A[0]
	centerindex = 0
	lastdiff = None
	for i in range(1, size):
		if A[i] != center:
			lastdiff = A[i]
			lastdiffindex = i
			break
	if lastdiff == None:
		print('NO')
		continue
	else:
		print('YES')
	for i in range(lastdiffindex):
		print(i + 1, lastdiffindex + 1)
	for i in range(lastdiffindex + 1, size):
		if i != lastdiffindex:
			if A[i] != center:
				print(centerindex + 1, i + 1)
			else:
				print(lastdiffindex + 1, i + 1)


import math
import sys
import os
if os.path.isfile('C:\\work\\python\\input.txt'):
	sys.stdin = open('C:\\work\\python\\input.txt', 'r')
	sys.stdout = open('C:\\work\\python\\output.txt', 'w')
for _ in range(int(input())):
	n = int(input())
	a = [int(i) for i in input().split()]
	p = 0
	for i in range(n):
		if a[i] != a[0]:
			p = i
			break
	if p == 0:
		print('No')
		continue
	print('Yes')
	for i in range(1, n):
		if a[i] == a[0]:
			print(p + 1, i + 1)
		else:
			print(0 + 1, i + 1)


def comp(a):
	return a[0]

def solve():
	n = int(input())
	array = list(map(int, input().split()))
	graph = []
	for i in range(len(array)):
		graph.append([array[i], i + 1])
	graph.sort(key=comp)
	if graph[0][0] == graph[len(graph) - 1][0]:
		print('NO')
		return
	print('YES')
	ancValue = graph[0][0]
	ancIndex = graph[0][1]
	for i in range(len(graph)):
		if graph[i][0] != ancValue:
			print(ancIndex, graph[i][1])
	for i in range(1, len(graph)):
		if graph[i][0] == ancValue:
			print(graph[len(graph) - 1][1], graph[i][1])
tests = int(input())
while tests > 0:
	solve()
	tests -= 1


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	d = {}
	for i in range(n):
		if a[i] not in d:
			d[a[i]] = [i + 1]
		else:
			d[a[i]].append(i + 1)
	if len(d) == 1:
		print('NO')
	else:
		print('YES')
		ans = []
		k = []
		for i in d:
			k.append(d[i])
		for i in range(len(k[1])):
			ans.append((k[0][0], k[1][i]))
		for i in range(1, len(k[0])):
			ans.append((k[1][0], k[0][i]))
		for i in range(2, len(k)):
			for j in k[i]:
				ans.append((k[0][0], j))
		for i in ans:
			print(i[0], i[1])


def solve():
	n = int(input())
	a = list(map(int, input().split()))
	x = a[0]
	y = None
	k = -1
	for i in range(n):
		if a[i] != x:
			y = a[i]
			k = i
			break
	if k == -1:
		return 'NO'
	e = []
	for i in range(1, n):
		if a[i] != x:
			e.append((0, i))
		else:
			e.append((k, i))
	z = 'YES'
	for i in range(len(e)):
		z += '\n%d %d' % (e[i][0] + 1, e[i][1] + 1)
	return z
t = int(input())
i = 0
while i < t:
	print(solve())
	i += 1


def Solve():
	n = ri()
	gang = rl()
	fi = 0
	si = 0
	mm = max(gang)
	mn = min(gang)
	if mm == mn:
		print('NO')
	else:
		print('YES')
		for i in range(n):
			if gang[i] == mm:
				fi = i + 1
			if gang[i] == mn:
				si = i + 1
		for i in range(n):
			if i + 1 == fi:
				continue
			elif gang[i] == mm:
				print(si, i + 1)
			elif gang[i] == mn:
				print(fi, i + 1)
			else:
				print(fi, i + 1)
import sys
inp = sys.stdin.buffer.readline
rl = lambda : list(map(int, inp().split()))
ri = lambda : int(inp())
rs = lambda : inp().decode().strip()
Testcase = 1
Testcase = ri()
for Test in range(Testcase):
	Solve()


from sys import stdin, stdout
from collections import *
st = lambda : list(stdin.readline().strip())
li = lambda : list(map(int, stdin.readline().split()))
mp = lambda : map(int, stdin.readline().split())
inp = lambda : int(stdin.readline())
pr = lambda n: stdout.write(str(n) + '\n')
mod = 1000000007
INF = float('inf')

def solve():
	n = inp()
	l = li()
	d = defaultdict(list)
	for i in range(n):
		d[l[i]].append(i + 1)
	ma = INF
	for i in d:
		if len(d[i]) < ma:
			ma = len(d[i])
			val = i
			index = d[i][0]
	ans = []
	for i in d:
		if i != val:
			for j in d[i]:
				ans.append((index, j))
	u = len(d[val])
	cur = n - u
	if cur < u - 1:
		print('NO')
		return
	i = 1
	while i < u:
		for j in d:
			if j != val:
				for k in d[j]:
					ans.append((d[val][i], k))
					i += 1
					if i >= u:
						print('YES')
						for p in ans:
							print(*p)
						return
	print('YES')
	for p in ans:
		print(*p)
for _ in range(inp()):
	solve()


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import math
import bisect
mod = 998244353
from collections import Counter
import bisect
from heapq import *
from collections import defaultdict
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	ans = []
	d = {}
	if len(set(arr)) == 1:
		print('NO')
	else:
		par = arr[0]
		for i in range(1, n):
			if arr[i] == par:
				for j in range(n):
					if i == j:
						continue
					if arr[i] != arr[j]:
						ans.append([i + 1, j + 1])
						break
			else:
				ans.append([1, i + 1])
		print('YES')
		for i in ans:
			print(*i)


from collections import Counter
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	ll = [False] * n
	i = 0
	d = []
	while i < n:
		j = i + 1
		while j < n:
			if l[i] != l[j] and (ll[i] == False or ll[j] == False):
				d.append([i + 1, j + 1])
				ll[i] = True
				ll[j] = True
			j += 1
		i += 1
	if ll != [True] * n:
		print('NO')
	else:
		print('YES')
		for i in d:
			print(*i)


t = int(input())
for _ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	arr = []
	k = l[0]
	ones = []
	key = 0
	for i in range(1, n):
		if l[i] != k:
			arr.append([1, i + 1])
			key = i + 1
		else:
			ones.append(i + 1)
	if key != 0:
		for i in range(len(ones)):
			arr.append([ones[i], key])
	if arr == []:
		print('NO')
	else:
		print('YES')
		for a in arr:
			print(a[0], a[1])


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	k = []
	t = 0
	for i in range(n):
		v = l[i]
		f = 0
		for j in range(n):
			if v == l[j]:
				continue
			k.append([i + 1, j + 1])
			f = 1
			break
		if f == 0:
			t = 1
			break
	if t == 1:
		print('NO')
	else:
		print('YES')
		for i in k[1:]:
			print(i[0], i[1])


R = lambda : map(int, input().split())
for _ in range(int(input())):
	n = int(input())
	arr = list(R())
	b = [0]
	c = []
	if len(set(arr)) == 1:
		print('NO')
	else:
		print('YES')
		for i in range(1, n):
			if arr[i] == arr[0]:
				b.append(i)
			else:
				c.append(i)
		for i in range(len(c)):
			print(1, c[i] + 1)
		for j in range(1, len(b)):
			print(b[j] + 1, c[0] + 1)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	f = []
	r = []
	ans = []
	for i in range(1, n):
		if l[0] != l[i]:
			ans.append([1, i + 1])
			f.append(i)
		else:
			r.append(i)
	if len(r) != 0:
		if len(f) == 0:
			print('NO')
		else:
			for i in range(len(r)):
				ans.append([r[i] + 1, f[0] + 1])
			print('YES')
			for i in range(n - 1):
				print(*ans[i])
	else:
		print('YES')
		for i in range(n - 1):
			print(*ans[i])


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	if a.count(a[0]) == n:
		print('NO')
	else:
		print('YES')
		G1 = []
		g1 = a[0]
		for i in range(1, n):
			if a[i] != g1:
				print(1, i + 1)
				g2 = i + 1
			else:
				G1.append(i + 1)
		for i in G1:
			print(g2, i)


def solve(n, l):
	t = l[0]
	for i in range(n):
		if l[i] != t:
			break
	else:
		print('NO')
		return
	print('YES')
	for j in range(n):
		if j == i:
			continue
		if l[i] != l[j]:
			print(j + 1, i + 1)
		else:
			for x in range(n):
				if l[x] != l[j]:
					print(j + 1, x + 1)
					break
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	solve(n, l)


for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	s = set()
	for d in arr:
		s.add(d)
	if len(s) == 1:
		print('NO')
	else:
		print('YES')
		a = -1
		b = -1
		for d in s:
			if a != -1:
				b = d
			if b == -1:
				a = d
		ind = -1
		ind1 = -1
		for i in range(n):
			if arr[i] == a:
				ind = i
			elif arr[i] == b:
				ind1 = i
		for i in range(n):
			if i != ind:
				if arr[i] != arr[ind]:
					print(i + 1, ind + 1)
				else:
					print(i + 1, ind1 + 1)


import sys

def rs():
	return sys.stdin.readline().rstrip()

def ri():
	return int(sys.stdin.readline())

def ria():
	return list(map(int, sys.stdin.readline().split()))

def ws(s):
	sys.stdout.write(s + '\n')

def wi(n):
	sys.stdout.write(str(n) + '\n')

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
import math
from collections import defaultdict
for _ in range(ri()):
	n = ri()
	l = ria()
	if len(set(l)) == 1:
		ws('NO')
	else:
		ws('YES')
		x = [1 for i in range(n)]
		x[0] = 0
		for i in range(1, n):
			if l[i] != l[0]:
				print(1, i + 1)
				x[i] = 0
		for i in range(n):
			if l[i] != l[0]:
				break
		for j in range(n):
			if x[j]:
				print(i + 1, j + 1)


from collections import defaultdict, deque

def solve():
	n = int(input())
	a = list(map(int, input().split()))
	if len(set(a)) == 1:
		print('NO')
		return None
	print('YES')
	gangs = defaultdict(list)
	gng = []
	for i in range(n):
		if a[i] not in gangs:
			gng.append(a[i])
		gangs[a[i]].append(i + 1)
	for i in range(len(gng)):
		for j in range(len(gangs[gng[i]])):
			if i != 0 or j != 0:
				print(gangs[gng[i]][j], gangs[gng[(i + 1) % len(gng)]][0])

def main():
	t = 1
	t = int(input())
	for _ in range(t):
		solve()
main()


import io
import os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
import collections
for _ in range(int(input())):
	n = int(input())
	a = [*map(int, input().split())]
	b = collections.defaultdict(lambda : [])
	c = set()
	for (ind, i) in enumerate(a):
		b[i].append(ind + 1)
		c.add(i)
	c = list(c)
	if len(c) > 1:
		print('YES')
		for i in c[1:]:
			for j in b[i]:
				print(b[c[0]][0], j)
		for (i, j) in enumerate(b[c[0]]):
			if i != 0:
				print(j, b[c[1]][0])
	else:
		print('NO')


from sys import stdout, stdin
from collections import defaultdict, deque
import math
t = int(stdin.readline())
for _ in range(t):
	n = int(stdin.readline())
	l = list(map(int, stdin.readline().split()))
	flag = True
	for i in range(1, n):
		if l[i] != l[0]:
			flag = False
			break
	if flag:
		print('NO')
	else:
		print('YES')
		v = [0] * n
		ind = -1
		v[0] = 1
		for i in range(n):
			if l[i] != l[0]:
				ind = i
				print(1, i + 1)
				v[i] = 1
		for i in range(n):
			if v[i] == 0:
				print(ind + 1, i + 1)


for t in range(int(input())):
	input()
	arr = list(map(int, input().split()))
	lefts = []
	f = arr[0]
	ls = None
	check = False
	for i in range(1, len(arr)):
		if arr[i] == f:
			lefts.append(i + 1)
		else:
			if not check:
				print('YES')
				check = True
			print(1, i + 1, sep=' ')
			ls = i + 1
	if ls:
		for lf in lefts:
			print(ls, lf, sep=' ')
	else:
		print('NO')


t = int(input())
for j in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	(b1, b2) = (max(a), min(a))
	if b1 == b2:
		print('NO')
		continue
	(i1, i2) = (-1, -1)
	for i in range(n):
		if a[i] == b1 and i1 == -1:
			i1 = i
		if a[i] == b2 and i2 == -1:
			i2 = i
	print('YES')
	print(i1 + 1, i2 + 1)
	for i in range(n):
		if i != i1 and i != i2:
			if a[i] != b1:
				print(i + 1, i1 + 1)
			else:
				print(i + 1, i2 + 1)


for _ in range(int(input())):
	x = int(input())
	l = list(map(int, input().split()))
	q = 0
	if l.count(l[0]) == x:
		print('NO')
	else:
		print('YES')
		p = []
		np = l[0]
		for n in range(1, x):
			if np == l[n]:
				p.append(n)
			else:
				print(1, n + 1)
				q = n + 1
		if len(p) != 0:
			for nn in p:
				print(q, nn + 1)


rr = lambda : input().strip()
rri = lambda : int(rr())
rrm = lambda : [int(x) for x in rr().split()]
from sys import stdin, stdout, setrecursionlimit
from math import ceil
from heapq import *

def sol():
	n = rri()
	nums = rrm()
	arr = [(v, i + 1) for (i, v) in enumerate(nums)]
	arr.sort()
	if arr[0][0] == arr[n - 1][0]:
		print('NO')
		return
	print('YES')
	(i, j) = (0, n - 1)
	while arr[i][0] != arr[j][0]:
		stdout.write(str(arr[i][1]) + ' ' + str(arr[j][1]) + '\n')
		j -= 1
	i += 1
	while i <= j:
		stdout.write(str(arr[i][1]) + ' ' + str(arr[n - 1][1]) + '\n')
		i += 1
	return

def main():
	T = rri()
	for t in range(1, T + 1):
		ans = sol()
main()


import sys
input = sys.stdin.readline
T = int(input())
for _ in range(T):
	n = int(input())
	A = list(map(int, input().split()))
	D = {}
	flag = 0
	for i in range(n):
		if A[i] in D:
			D[A[i]].append(i + 1)
		else:
			D[A[i]] = [i + 1]
			flag = flag + 1
	if flag == 1:
		print('NO')
	else:
		print('YES')
		v = A[0]
		v1 = 0
		for i in range(n):
			if i + 1 not in D[v]:
				print(D[v][0], i + 1)
				v1 = i + 1
		l = len(D[v])
		for i in range(1, l):
			print(v1, D[v][i])


import math
from collections import deque
from sys import stdin, stdout, setrecursionlimit
from string import ascii_letters
letters = ascii_letters[:26]
from collections import defaultdict
input = stdin.readline
print = stdout.write
for _ in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	groups = defaultdict(list)
	for i in range(n):
		groups[arr[i]].append(i)
	res = []
	groups = sorted(groups.values(), key=lambda x: len(x))
	ind = 1
	bf = 0
	while True:
		if ind >= len(groups):
			break
		if bf >= len(groups[ind]):
			bf = 0
			ind += 1
		if ind >= len(groups):
			break
		res.append((groups[0][0] + 1, groups[ind][bf] + 1))
		bf += 1
	if len(groups) <= 1 or len(res) != n - len(groups[0]):
		print('NO\n')
		continue
	for i in range(1, len(groups[0])):
		res.append((groups[0][i] + 1, groups[1][0] + 1))
	print('YES\n')
	for i in res:
		print(str(i[0]) + ' ' + str(i[1]) + '\n')


import time, math as mt, bisect, sys
from sys import stdin, stdout
from collections import deque
from fractions import Fraction
from collections import Counter
from collections import OrderedDict
pi = 3.141592653589793

def II():
	return int(stdin.readline())

def IO():
	return stdin.readline()

def IP():
	return map(int, stdin.readline().split())

def L():
	return list(map(int, stdin.readline().split()))

def P(x):
	return stdout.write(str(x) + '\n')

def PI(x, y):
	return stdout.write(str(x) + ' ' + str(y) + '\n')

def lcm(a, b):
	return a * b // gcd(a, b)

def gcd(a, b):
	if a == 0:
		return b
	elif b == 0:
		return a
	if a > b:
		return gcd(a % b, b)
	else:
		return gcd(a, b % a)

def bfs(adj, v):
	visited = [False] * (v + 1)
	q = deque()
	while q:
		pass

def sieve():
	li = [True] * 1000001
	(li[0], li[1]) = (False, False)
	for i in range(2, len(li), 1):
		if li[i] == True:
			for j in range(i * i, len(li), i):
				li[j] = False
	prime = []
	for i in range(1000001):
		if li[i] == True:
			prime.append(i)
	return prime

def setBit(n):
	count = 0
	while n != 0:
		n = n & n - 1
		count += 1
	return count
mx = 10 ** 7
spf = [mx] * (mx + 1)

def SPF():
	spf[1] = 1
	for i in range(2, mx + 1):
		if spf[i] == mx:
			spf[i] = i
			for j in range(i * i, mx + 1, i):
				if i < spf[j]:
					spf[j] = i
	return

def readTree(v):
	adj = [set() for i in range(v + 1)]
	for i in range(v - 1):
		(u1, u2) = In()
		adj[u1].add(u2)
		adj[u2].add(u1)
	return adj
mod = 10 ** 9 + 7

def solve():
	n = II()
	a = L()
	if len(set(a)) == 1:
		print('NO')
		return
	else:
		print('YES')
		xx = list(set(a))
		(c, de) = (xx[0], xx[1])
		d = {c: de, de: c}
		(ind1, ind2) = (-1, -1)
		for i in range(n):
			ele = a[i]
			if d.get(ele, -10) == -10:
				d[ele] = c
			if ele == c:
				ind1 = i
			elif ele == de:
				ind2 = i
		print(ind2 + 1, ind1 + 1)
		for i in range(n):
			if i != ind1 and i != ind2:
				if a[i] == c:
					print(i + 1, ind2 + 1)
				else:
					print(i + 1, ind1 + 1)
		return
t = II()
for i in range(t):
	solve()


for cnt in range(int(input())):
	n = int(input())
	b = list(map(int, input().split()))
	m = max(b)
	if min(b) == max(b):
		print('NO')
	else:
		print('YES')
		f = b[0]
		s = None
		for i in range(n):
			if b[i] != f:
				print(1, i + 1)
				if not s:
					s = i + 1
		for i in range(1, n):
			if b[i] == f:
				print(s, i + 1)


def read_int():
	return int(input())

def read_ints():
	return map(int, input().split(' '))
t = read_int()
for case_num in range(t):
	n = read_int()
	d = dict()
	for (i, a) in enumerate(read_ints()):
		if a not in d:
			d[a] = []
		d[a].append(i + 1)
	if len(d) == 1:
		print('NO')
		continue
	print('YES')
	groups = list(d.values())
	for i in groups[0]:
		print(i, groups[1][0])
	for i in groups[1][1:]:
		print(groups[0][0], i)
	for g in range(2, len(groups)):
		for i in groups[g]:
			print(groups[0][0], i)


def lis():
	return [int(x) for x in input().split()]

def intt():
	return int(input())

def st():
	return str(input())
t = intt()
for i in range(t):
	n = intt()
	a = lis()
	s = set(a)
	if len(s) == 1:
		print('NO')
		continue
	ans = -1
	for i in s:
		if a.count(i) == 1:
			ans = a.index(i)
			break
	if ans != -1:
		print('YES')
		for i in range(n):
			if a[i] != a[ans]:
				print(str(ans + 1) + ' ' + str(i + 1))
	else:
		print('YES')
		s = list(s)
		b = a.index(s[0])
		c = a.index(s[1])
		for i in range(n):
			if a[i] != a[b]:
				print(str(b + 1) + ' ' + str(i + 1))
			elif a[i] == a[b] and i != b:
				print(str(c + 1) + ' ' + str(i + 1))


for _ in range(int(input())):
	n = int(input())
	L = list(map(int, input().split()))
	if len(set(L)) == 1:
		print('NO')
	else:
		M = []
		x = L[0]
		for i in range(1, n):
			if L[i] != L[0]:
				M.append(1)
				M.append(i + 1)
				y = i
		for i in range(1, n):
			if L[i] == L[0]:
				M.append(y + 1)
				M.append(i + 1)
		print('YES')
		for k in range(0, 2 * n - 2 - 1, 2):
			print(M[k], M[k + 1])


from collections import Counter, defaultdict
I = lambda : int(input())
M = lambda : map(int, input().split())
LI = lambda : list(map(int, input().split()))
for _ in range(I()):
	n = I()
	a = LI()
	if len(set(a)) == 1:
		print('NO')
	else:
		b = max(a)
		c = min(a)
		d = a.index(b) + 1
		e = a.index(c) + 1
		print('YES')
		flag = 0
		for i in range(n):
			if a[i] == b:
				if flag == 0:
					flag = 1
				else:
					print(i + 1, e)
			else:
				print(i + 1, d)


def solve():
	n = int(input())
	arr = [int(v) for v in input().split()]
	for i in range(1, n):
		if arr[i] != arr[i - 1]:
			print('YES')
			cnt = 0
			for j in range(n):
				if i == j:
					continue
				if arr[j] != arr[i]:
					print(i + 1, j + 1)
					cnt += 1
			for j in range(n):
				if j in (i - 1, i):
					continue
				if arr[j] == arr[i]:
					print(i, j + 1)
					cnt += 1
			return
	print('NO')
t = int(input())
for _ in range(t):
	solve()


def rl():
	return list(map(int, input().split()))

def arp(arr):
	return ' '.join([str(i) for i in arr])
from collections import deque, Counter
from math import ceil, sqrt, log2, log, floor
for _ in range(int(input())):
	(n,) = rl()
	arr = rl()
	if len(set(arr)) == 1:
		print('NO')
	else:
		ind1 = 1
		ind2 = 0
		for i in range(1, n):
			if arr[i] != arr[0]:
				ind2 = i + 1
				break
		print('YES')
		for i in range(1, n):
			if arr[ind1 - 1] != arr[i]:
				print(1, i + 1)
			else:
				print(i + 1, ind2)


from collections import Counter

def solve(a, n):
	if len(set(a)) == 1:
		print('NO')
		return
	res = []
	d = {}
	for i in range(n):
		if d.get(a[i]):
			pass
		else:
			d[a[i]] = i + 1
	key = list(d.keys())
	cen = key[0]
	print('YES')
	for i in range(1, n):
		if a[i] == cen:
			print(d[key[1]], i + 1)
		else:
			print(d[cen], i + 1)
t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	solve(a, n)


import sys
max_int = 1000000001
min_int = -max_int
t = int(input())
for _t in range(t):
	n = int(sys.stdin.readline())
	a = list(map(int, sys.stdin.readline().split()))
	a1 = a2 = 0
	i1 = i2 = 0
	for (i, aa) in enumerate(a):
		if a1:
			if a1 != aa:
				a2 = aa
				i2 = i
				break
		else:
			a1 = aa
			i1 = i
	if not i2:
		print('NO')
		continue
	print('YES')
	for (i, aa) in enumerate(a):
		if i == i1:
			continue
		if aa == a1:
			print(i + 1, i2 + 1)
		else:
			print(i + 1, i1 + 1)


t = int(input())
while t > 0:
	t -= 1
	n = int(input())
	l = list(map(int, input().split(' ')))
	maxs = max(l)
	maxind = -1
	mins = min(l)
	minind = -1
	if maxs == mins:
		print('NO')
		continue
	for i in range(0, n):
		if l[i] == maxs:
			maxind = i
		if l[i] == mins:
			minind = i
	print('YES')
	for i in range(0, n):
		g = []
		if i == maxind:
			continue
		if l[i] != maxs:
			g.append(i + 1)
			g.append(maxind + 1)
			print(*g)
		else:
			g.append(i + 1)
			g.append(minind + 1)
			print(*g)


t = int(input())
for _ in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	b = []
	c = []
	edges = 0
	used = [0] * n
	for i in range(n):
		used[i] = used[i] + 1
		for j in range(n):
			if used[j] > 0 or a[i] == a[j]:
				continue
			else:
				edges = edges + 1
				used[j] = used[j] + 1
				used[i] = used[i] + 1
				b.append(i + 1)
				c.append(j + 1)
		used[i] = used[i] - 1
	if edges != n - 1:
		print('NO')
		continue
	print('YES')
	for i in range(n - 1):
		print(b[i], end=' ')
		print(c[i])


from sys import stdin, gettrace
if gettrace():
	inputi = input
else:

	def input():
		return next(stdin)[:-1]

	def inputi():
		return stdin.buffer.readline()

def solve():
	n = int(inputi())
	aa = [int(a) for a in inputi().split()]
	if all((a == aa[0] for a in aa)):
		print('NO')
		return
	print('YES')
	g1 = [i for i in range(n) if aa[i] == aa[0]]
	g2 = [i for i in range(n) if aa[i] != aa[0]]
	for i in g2:
		print(1, i + 1)
	for i in g1[1:]:
		print(g2[0] + 1, i + 1)

def main():
	t = int(inputi())
	for _ in range(t):
		solve()
main()


def check(a, n):
	areas = {}
	for i in range(n):
		if a[i] in areas:
			areas[a[i]].append(i)
		else:
			areas[a[i]] = [i]
	_key = a[0]
	for key in areas:
		if key != a[0]:
			_key = key
			for i in areas[key]:
				print(areas[a[0]][0] + 1, i + 1)
	for i in range(1, len(areas[a[0]])):
		print(areas[_key][0] + 1, areas[a[0]][i] + 1)
t = int(input())
for test in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	if len(set(a)) == 1:
		print('NO')
		continue
	print('YES')
	check(a, n)


import sys
input = sys.stdin.readline
from collections import defaultdict as dc
from collections import Counter
from bisect import bisect_right
import math
for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	if len(set(l)) == 1:
		print('NO')
	else:
		print('YES')
		x = dc(list)
		for i in range(n):
			x[l[i]].append(i + 1)
		p = sorted(set(l))
		t = x[p[0]][0]
		for i in range(1, len(p)):
			for j in x[p[i]]:
				print(t, j)
		k = x[p[1]][0]
		for i in x[p[0]][1:]:
			print(k, i)


def zip_sorted(a, b):
	(a, b) = zip(*sorted(zip(a, b)))
	sorted(zip(a, b), key=lambda x: x[1])
	return (a, b)
t = int(input())
for t1 in range(t):
	n = int(input())
	a = [int(n1) for n1 in input().split()]
	n1 = a[0]
	last = -1
	same = []
	res = all((ele == a[0] for ele in a))
	if res:
		print('NO')
	else:
		print('YES')
		for i in range(1, len(a)):
			if n1 == a[i]:
				same.append(i)
			else:
				print(1, i + 1)
				last = i
		for j in range(len(same)):
			print(last + 1, same[j] + 1)


t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	k = l[0]
	if max(l) == min(l):
		print('NO')
	else:
		print('YES')
		for i in range(1, n):
			if l[i] == k:
				l[i] = 0
			else:
				d = i
				print(1, i + 1)
		for i in range(n):
			if l[i] == 0:
				print(d + 1, i + 1)


t = int(input())
for i in range(t):
	n = int(input())
	discs = [int(k) for k in input().split()]
	res = []
	indice = -1
	for i in range(1, n):
		if discs[i] != discs[0]:
			indice = i
			res.append((1, i + 1))
	if indice == -1:
		print('NO')
		continue
	for i in range(1, n):
		if discs[i] == discs[0]:
			res.append((indice + 1, i + 1))
	print('YES')
	for i in res:
		print(i[0], i[1])


import math
from collections import Counter
t = int(input())
for i in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	counter = Counter(l)
	least = counter.most_common()[-1]
	least_freq = least[1]
	least_num = least[0]
	index_of_freq_element = [j for j in range(n) if l[j] == least_num]
	index_of_other_element = [j for j in range(n) if l[j] != least_num]
	if least_freq <= n - 1:
		print('YES')
		for j in index_of_other_element:
			print(index_of_freq_element[0] + 1, j + 1)
		pos = 0
		for j in index_of_freq_element[1:]:
			print(index_of_other_element[pos] + 1, j + 1)
			pos += 1
	else:
		print('NO')


from collections import defaultdict
t = int(input())
for i in range(t):
	n = int(input())
	A = list(map(int, input().split()))
	if len(set(A)) == 1:
		print('NO')
	else:
		d = defaultdict(list)
		for j in range(n):
			d[A[j]].append(j + 1)
		x = len(d)
		ke = list(d.keys())
		kn = ke[1:]
		print('YES')
		for j in kn:
			for k in range(len(d[j])):
				print(d[ke[0]][0], d[j][k])
		for j in range(1, len(d[ke[0]])):
			print(d[kn[0]][0], d[ke[0]][j])