It was the third month of remote learning, Nastya got sick of staying at dormitory, so she decided to return to her hometown. In order to make her trip more entertaining, one of Nastya's friend presented her an integer array $a$.

Several hours after starting her journey home Nastya remembered about the present. To entertain herself she decided to check, are there four different indices $x, y, z, w$ such that $a_x + a_y = a_z + a_w$.

Her train has already arrived the destination, but she still hasn't found the answer. Can you help her unravel the mystery?


-----Input-----

The first line contains the single integer $n$ ($4 \leq n \leq 200000$) — the size of the array.

The second line contains $n$ integers $a_1, a_2, \ldots, a_n$ ($1 \leq a_i \leq 2.5 \cdot 10^6$).


-----Output-----

Print "YES" if there are such four indices, and "NO" otherwise.

If such indices exist, print these indices $x$, $y$, $z$ and $w$ ($1 \le x, y, z, w \le n$).

If there are multiple answers, print any of them.


-----Examples-----

Input
6
2 1 5 2 7 4
Output
YES
2 3 1 6
Input
5
1 3 1 9 20
Output
NO


-----Note-----

In the first example $a_2 + a_3 = 1 + 5 = 2 + 4 = a_1 + a_6$. Note that there are other answer, for example, 2 3 4 6.

In the second example, we can't choose four indices. The answer 1 2 2 3 is wrong, because indices should be different, despite that $a_1 + a_2 = 1 + 3 = 3 + 1 = a_2 + a_3$

Difficulty: MEDIUM_HARD
Tags: Mathematics

String algorithms

Implementation

Complete search
Skill types: Complete search

Starter code:

Solutions:
import sys
from collections import defaultdict
from itertools import islice
_ = input()
numbers_str = input()
numbers = [int(n) for n in numbers_str.strip().split()]
sums = {}
for (i, a) in enumerate(numbers, start=1):
	for (j, b) in enumerate(islice(numbers, i, None), start=i + 1):
		if a + b in sums:
			indexes = sums[a + b]
			if i in indexes or j in indexes:
				continue
			print('YES')
			(x, y) = indexes
			print(x, y, i, j)
			sys.exit()
		else:
			sums[a + b] = (i, j)
else:
	print('NO')


from collections import defaultdict

def win(a, n):
	arr = dict()
	for i in range(n):
		for j in range(i):
			k = a[i] + a[j]
			if k in arr:
				arr[k].add(i)
				arr[k].add(j)
				if len(arr[k]) == 4:
					s = 'YES' + '\n'
					lst = list(arr[k])
					lst.sort(key=lambda x: a[x])
					(lst[3], lst[1]) = (lst[1], lst[3])
					s += ' '.join((str(elem + 1) for elem in lst))
					if a[lst[0]] + a[lst[1]] == a[lst[2]] + a[lst[3]]:
						return s
			else:
				arr[k] = set([i, j])
	return 'NO'
n = int(input())
a = list(map(int, input().split()))
print(win(a, n))


n = int(input())
arr = list(map(int, input().split()))
d = {}
flag = True
for i1 in range(n):
	for j1 in range(i1):
		if arr[i1] + arr[j1] in d:
			(i2, j2) = d[arr[i1] + arr[j1]]
			if len(set([i1, i2, j1, j2])) == 4:
				print('YES')
				print(j2 + 1, i2 + 1, j1 + 1, i1 + 1)
				flag = False
				break
		else:
			d[arr[i1] + arr[j1]] = (i1, j1)
	if flag == False:
		break
if flag:
	print('NO')


n = int(input())
a = list(map(int, input().split()))
l = {}

def main(a):
	m = {}
	for i in range(n):
		for j in range(i + 1, n):
			s = a[i] + a[j]
			if s in m:
				m[s] += 1
			else:
				m[s] = 1
			t = m[s]
			if t == 1:
				l[s] = [(i, j)]
			else:
				for p in l[s]:
					(x, y) = p
					if x != i and x != j and (y != i) and (y != j):
						print('yes')
						print(x + 1, y + 1, i + 1, j + 1)
						exit(0)
				l[s].append((i, j))
			if t == 4:
				cnt = {}
				for e in l[s]:
					(x, y) = e
					if x in cnt:
						cnt[x] += 1
					else:
						cnt[x] = 1
					if y in cnt:
						cnt[y] += 1
					else:
						cnt[y] = 1
				ans = []
				for (a, b) in cnt.items():
					if b == 1:
						ans.append(str(a + 1))
				print('yes')
				print(' '.join(ans))
				exit(0)
	print('no')
	exit(0)
main(a)


from collections import Counter
n = int(input())
m = [int(j) for j in input().split()]
m = m[:4000]
new = {}
res = []
for i in range(len(m)):
	for j in range(i + 1, len(m)):
		if m[i] + m[j] in new:
			if i not in new[m[i] + m[j]] and j not in new[m[i] + m[j]]:
				z = new[m[i] + m[j]][0]
				x = new[m[i] + m[j]][1]
				res.extend([i, j, z, x])
				break
			else:
				continue
		else:
			new[m[i] + m[j]] = [i, j]
	else:
		continue
	break
if res:
	print('YES')
	print(' '.join([str(e + 1) for e in res]))
else:
	print('NO')


for _ in range(1):
	n = int(input())
	array = [int(i) for i in input().split()]
	countdict = dict()
	for i in range(n):
		if array[i] in countdict:
			countdict[array[i]].append(i)
		else:
			countdict[array[i]] = [i]
	flag = 0
	ans = []
	for i in countdict:
		if len(countdict[i]) >= 4:
			ans = countdict[i][:4]
		elif len(countdict[i]) >= 2:
			ans += countdict[i]
		if len(ans) == 4:
			print('YES')
			print(ans[0] + 1, ans[2] + 1, ans[1] + 1, ans[3] + 1)
			break
	else:
		arrx = [i for i in countdict]
		m = len(arrx)
		sumcount = dict()
		for i in range(m):
			for j in range(i, m):
				if i == j:
					if len(countdict[arrx[i]]) < 2:
						continue
				tx = arrx[i] + arrx[j]
				if tx in sumcount:
					print('YES')
					print(sumcount[tx][0] + 1, sumcount[tx][1] + 1, countdict[arrx[i]][0] + 1, countdict[arrx[j]][-1] + 1)
					flag = 1
					break
				else:
					sumcount[tx] = [countdict[arrx[i]][0], countdict[arrx[j]][-1]]
				if len(sumcount) > 5 * 10 ** 6:
					print('NO')
					flag = 1
					break
			if flag == 1:
				break
		if flag == 0:
			print('NO')


n = int(input())
arr = list(map(int, input().split(' ')))
cache = {}
for i in range(n):
	for j in range(i):
		s = arr[i] + arr[j]
		if s in cache:
			(f, t) = cache[s]
			if i != f and i != t and (j != f) and (t != j):
				print('YES')
				print(f + 1, t + 1, i + 1, j + 1)
				exit()
		cache[s] = (i, j)
print('NO')


ll = lambda : map(int, input().split())
t = lambda : int(input())
ss = lambda : input()
lx = lambda x: map(int, input().split(x))
from math import log10, log2, ceil, factorial as f, gcd
n = t()
a = list(ll())
d = {}
for i in range(n):
	fl = 0
	for j in range(i + 1, n):
		if a[i] + a[j] not in d:
			d[a[i] + a[j]] = [i + 1, j + 1]
		elif i + 1 not in d[a[i] + a[j]] and j + 1 not in d[a[i] + a[j]]:
			print('yes')
			print(i + 1, j + 1, *d[a[i] + a[j]])
			fl = 1
			break
	if fl:
		break
else:
	print('no')


def zip_sorted(a, b):
	(a, b) = zip(*sorted(zip(a, b)))
	sorted(zip(a, b), key=lambda x: x[1])
	return (a, b)
import sys
from collections import defaultdict
input = sys.stdin.readline
I = lambda : list(map(int, input().split()))
S = lambda : list(map(str, input().split()))
(n,) = I()
a = I()
mem1 = defaultdict(list)
mem2 = defaultdict(list)
count = 0
count1 = 0
for i in range(len(a)):
	mem1[a[i]].append(i)
	if len(mem1[a[i]]) >= 2 and a[i] not in mem2:
		count += 1
		mem2[a[i]] = mem1[a[i]]
	if len(mem1[a[i]]) >= 4:
		count1 += 1
if count1 >= 1:
	ans = []
	countx = 0
	for i in mem1:
		if len(mem1[i]) >= 4:
			for j in mem1[i][:4]:
				ans.append(j + 1)
			countx = 1
			break
		if countx == 1:
			break
	print('YES')
	print(*ans)
elif count >= 2:
	count = 0
	ans = [0] * 4
	for i in mem2:
		if count == 0:
			ans[0] = mem1[i][:2][0] + 1
			ans[2] = mem1[i][:2][1] + 1
			count += 1
		elif count == 1:
			ans[1] = mem1[i][:2][0] + 1
			ans[3] = mem1[i][:2][1] + 1
			count += 1
		if count == 2:
			break
	print('YES')
	print(*ans)
elif count == 1:
	countx = 0
	s = 0
	ans = []
	for i in mem2:
		s = 2 * i
		ans = [j + 1 for j in mem2[i]]
	for i in range(len(a)):
		if a[i] == s // 2:
			continue
		for j in range(i + 1, len(a)):
			if a[i] + a[j] == s:
				ans.append(i + 1)
				ans.append(j + 1)
				countx = 1
				break
		if countx == 1:
			break
	if countx != 0:
		print('YES')
		print(*ans)
	else:
		ans = []
		countx = 0
		mem3 = defaultdict(list)
		for i in range(len(a)):
			for j in range(i + 1, len(a)):
				if a[i] + a[j] in mem3 and i + 1 not in mem3[a[i] + a[j]][0] and (j + 1 not in mem3[a[i] + a[j]][0]):
					countx = 1
					print('YES')
					print(*mem3[a[i] + a[j]][0], i + 1, j + 1)
					break
				else:
					mem3[a[i] + a[j]].append([i + 1, j + 1])
			if countx == 1:
				break
		if countx == 0:
			print('NO')
else:
	ans = []
	countx = 0
	mem3 = defaultdict(list)
	for i in range(len(a)):
		for j in range(i + 1, len(a)):
			if a[i] + a[j] in mem3 and i + 1 not in mem3[a[i] + a[j]][0] and (j + 1 not in mem3[a[i] + a[j]][0]):
				countx = 1
				print('YES')
				print(*mem3[a[i] + a[j]][0], i + 1, j + 1)
				break
			else:
				mem3[a[i] + a[j]].append([i + 1, j + 1])
		if countx == 1:
			break
	if countx == 0:
		print('NO')


n = int(input())
l = list(map(int, input().split()))
d = {}
s = set()
f = False
for i in range(n):
	for j in range(i + 1, n):
		s = l[i] + l[j]
		if s in d:
			if d[s][0] != i and d[s][0] != j and (d[s][1] != i) and (d[s][1] != j):
				print('YES')
				print(d[s][0] + 1, d[s][1] + 1, i + 1, j + 1)
				f = True
				break
		else:
			d[s] = [i, j]
	if f:
		break
if not f:
	print('NO')


import sys
n = int(sys.stdin.readline())
a = list(map(int, sys.stdin.readline().rstrip().split()))
d = {}
for i in range(n):
	for j in range(i):
		if a[i] + a[j] in d:
			(first, second) = d[a[i] + a[j]]
			if len(set([i, j, first, second])) == 4:
				print('YES')
				print(i + 1, j + 1, first + 1, second + 1)
				exit(0)
		else:
			d[a[i] + a[j]] = (i, j)
print('NO')


import os, sys
from io import BytesIO, IOBase
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')

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

def getInts():
	return list(map(int, input().split()))
MAXA = 2500000
N = getInt()
A = getInts()
B = {}
for i in range(N):
	for j in range(i):
		if A[i] + A[j] in B:
			(i0, j0) = B[A[i] + A[j]]
			if len(set([i0, j0, i, j])) == 4:
				print('YES')
				print(i + 1, j + 1, i0 + 1, j0 + 1)
				sys.exit(0)
		B[A[i] + A[j]] = (i, j)
print('NO')


n = int(input())
a = list(map(int, input().split()))
d = {}
for i in range(n):
	for j in range(i):
		if a[i] + a[j] in d:
			(ii, jj) = d[a[i] + a[j]]
			if len({i, j, ii, jj}) == 4:
				print('YES')
				print(i + 1, j + 1, ii + 1, jj + 1)
				exit(0)
		else:
			d[a[i] + a[j]] = (i, j)
print('NO')


n = int(input())
a = list(map(int, input().split()))
d = {}
check = 0
for i in range(n):
	for j in range(i):
		if a[i] + a[j] in d:
			(x, y) = d[a[i] + a[j]]
			if x != i and x != j and (y != i) and (y != j):
				print('YES')
				print(x + 1, y + 1, i + 1, j + 1)
				check = 1
				break
		else:
			d[a[i] + a[j]] = [i, j]
	if check == 1:
		break
if check != 1:
	print('NO')


d = dict()
n = int(input())
arr = list(map(int, input().split()))
for i in range(1, n):
	for j in range(i):
		s = arr[i] + arr[j]
		if s in d:
			(x, y) = d[s]
			if (i != x and i != y) and (j != x and j != y):
				print('YES')
				print(x + 1, y + 1, i + 1, j + 1)
				quit()
		else:
			d[s] = (i, j)
print('NO')


import math
import time
from collections import defaultdict, deque, Counter
from sys import stdin, stdout
from bisect import bisect_left, bisect_right
import sys
from heapq import heapify, heappush, heappop
n = int(input())
a = list(map(int, stdin.readline().split()))
c = defaultdict(lambda : [])
for i in range(n):
	c[a[i]].append(i + 1)
ans = False
tw = []
for i in c.values():
	if len(i) > 3:
		ans = True
		print('YES')
		print(*i[:4])
		break
	elif len(i) > 1:
		tw.append(i)
	if len(tw) > 1:
		ans = True
		print('YES')
		print(tw[0][0], tw[1][0], tw[0][1], tw[1][1])
		break
if not ans:
	d = defaultdict(lambda : 0)
	for i in range(len(a)):
		for j in range(i + 1, len(a)):
			temp = a[i] + a[j]
			if temp in d:
				if i + 1 not in d[temp] and j + 1 not in d[temp]:
					ans = True
					print('YES')
					print(i + 1, j + 1, d[temp][0], d[temp][1])
					break
			else:
				d[temp] = [i + 1, j + 1]
		if ans:
			break
	if not ans:
		print('NO')


import sys, os
from collections import defaultdict
if os.environ['USERNAME'] == 'kissz':
	inp = open('in2.txt', 'r').readline

	def debug(*args):
		print(*args, file=sys.stderr)
else:
	inp = sys.stdin.readline

	def debug(*args):
		pass
n = int(inp())
A = [*map(int, inp().split())]
C = defaultdict(list)
done = False
for i in range(n):
	for j in range(i):
		x = A[i] + A[j]
		if x in C:
			for ab in C[x]:
				if i not in ab and j not in ab:
					print('YES')
					done = True
					print(ab[0] + 1, ab[1] + 1, j + 1, i + 1)
					break
		if done:
			break
		C[x] += [(j, i)]
	if done:
		break
if not done:
	print('NO')


def show(x, y, z, w):
	print('YES')
	print(x + 1, y + 1, z + 1, w + 1)
	exit(0)
n = int(input())
ara = list((int(x) for x in input().split()))
n = min(n, 2000)
found = {}
for i in range(0, n):
	for j in range(i + 1, n):
		cur_sm = ara[i] + ara[j]
		if cur_sm in found.keys() and found[cur_sm][0] != i and (found[cur_sm][1] != j) and (found[cur_sm][0] != j) and (found[cur_sm][1] != i):
			show(found[cur_sm][0], found[cur_sm][1], i, j)
		found[cur_sm] = (i, j)
print('NO')


import sys

def solve(T, A):
	if T > 2400:
		A = A[:2400]
	T = min(T, 2400)
	sum_dict = {}
	for i in range(T - 1):
		for j in range(i + 1, T):
			if A[i] + A[j] in sum_dict.keys():
				for elem in sum_dict[A[i] + A[j]]:
					if elem[0] != i and elem[0] != j and (elem[1] != i) and (elem[1] != j):
						print('YES')
						return ' '.join([str(elem[0] + 1), str(elem[1] + 1), str(i + 1), str(j + 1)])
				sum_dict[A[i] + A[j]].append((i, j))
			else:
				sum_dict[A[i] + A[j]] = [(i, j)]
	return 'NO'

def run():
	out = ''
	T = int(input())
	A = [int(x) for x in input().split()]
	print(solve(T, A))
run()


import sys
r = sys.stdin.readline
n = int(sys.stdin.readline())
a = list(map(int, r().split()))
d = {}
for i in range(n):
	for j in range(i):
		if a[i] + a[j] in d:
			(f, s) = d[a[i] + a[j]]
			if len(set([i, j, f, s])) == 4:
				print('YES')
				print(i + 1, j + 1, f + 1, s + 1)
				exit(0)
		else:
			d[a[i] + a[j]] = (i, j)
print('NO')


def findPairs(arr, size):
	Map = {}
	for i in range(0, size - 1):
		for j in range(i + 1, size):
			Sum = arr[i] + arr[j]
			if Sum in Map:
				if (Map[Sum][0] != i and Map[Sum][0] != j) and (Map[Sum][1] != i and Map[Sum][1] != j):
					t = (Map[Sum][0] + 1, Map[Sum][1] + 1, i + 1, j + 1)
					return t
			if Sum not in Map:
				Map[Sum] = [i, j]
	return (-1, -1, -1, -1)

def solve1():
	n = int(input())
	arr = list(map(int, input().split()))
	(a, b, c, d) = findPairs(arr, n)
	if a == -1:
		print('NO')
	else:
		print('YES')
		print(a, b, c, d)
for testis in range(1):
	solve1()


from collections import defaultdict

def main():
	n = int(input())
	a = readIntArr()
	mp = defaultdict(lambda : [])
	x = None
	for i in range(1, n):
		for j in range(i):
			summ = a[i] + a[j]
			for (ii, jj) in mp[summ]:
				s = {i, j, ii, jj}
				if len(s) == 4:
					x = i + 1
					y = j + 1
					z = ii + 1
					w = jj + 1
					break
			mp[summ].append([i, j])
		if x:
			break
	if x:
		print('YES')
		print('{} {} {} {}'.format(x, y, z, w))
	else:
		print('NO')
	return
import sys
input = sys.stdin.buffer.readline

def oneLineArrayPrint(arr):
	print(' '.join([str(x) for x in arr]))

def multiLineArrayPrint(arr):
	print('\n'.join([str(x) for x in arr]))

def multiLineArrayOfArraysPrint(arr):
	print('\n'.join([' '.join([str(x) for x in y]) for y in arr]))

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

def queryInteractive(x, y):
	print('? {} {}'.format(x, y))
	sys.stdout.flush()
	return int(input())

def answerInteractive(ans):
	print('! {}'.format(ans))
	sys.stdout.flush()
inf = float('inf')
MOD = 10 ** 9 + 7
for _abc in range(1):
	main()


import sys
import math
import heapq
import bisect
from collections import Counter
from collections import defaultdict
from io import BytesIO, IOBase
import string

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
		self.BUFSIZE = 8192

	def read(self):
		while True:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, self.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, self.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')

def get_int():
	return int(input())

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

def get_int_grid(n):
	return [get_ints() for _ in range(n)]

def get_str():
	return input().split(' ')

def yes_no(b):
	if b:
		return 'YES'
	else:
		return 'NO'

def binary_search(good, left, right, delta=1, right_true=False):
	limits = [left, right]
	while limits[1] - limits[0] > delta:
		if delta == 1:
			mid = sum(limits) // 2
		else:
			mid = sum(limits) / 2
		if good(mid):
			limits[int(right_true)] = mid
		else:
			limits[int(~right_true)] = mid
	if good(limits[int(right_true)]):
		return limits[int(right_true)]
	else:
		return False

def prefix_sums(a, drop_zero=False):
	p = [0]
	for x in a:
		p.append(p[-1] + x)
	if drop_zero:
		return p[1:]
	else:
		return p

def prefix_mins(a, drop_zero=False):
	p = [float('inf')]
	for x in a:
		p.append(min(p[-1], x))
	if drop_zero:
		return p[1:]
	else:
		return p

def solve_a():
	n = get_int()
	arr = [0]
	dep = [0]
	for _ in range(n):
		(a, b) = get_ints()
		arr.append(a)
		dep.append(b)
	delta = get_ints()
	departure = 0
	for idx in range(1, n + 1):
		arrival = arr[idx] - dep[idx - 1] + delta[idx - 1] + departure
		departure = max(dep[idx], arrival + math.ceil((dep[idx] - arr[idx]) / 2))
	return arrival

def solve_b():
	n = get_int()
	a = get_ints()
	retval = [0] * n
	idx = n - 1
	min_fill = n
	while idx >= 0:
		if a[idx]:
			min_fill = min(min_fill, idx - a[idx] + 1)
		if min_fill <= idx:
			retval[idx] = 1
		idx -= 1
	return retval

def solve_c():
	n = get_int()
	arr = get_ints()
	sums = {}
	for i in range(n):
		for j in range(i):
			if arr[i] + arr[j] in sums:
				(k, l) = sums[arr[i] + arr[j]]
				if len(set([i, j, k, l])) == 4:
					return [i + 1, j + 1, k + 1, l + 1]
			sums[arr[i] + arr[j]] = (i, j)
	return False
ans = solve_c()
if ans:
	print('YES')
	print(*ans)
else:
	print('NO')


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()
inf = 10 ** 16
md = 10 ** 9 + 7
from collections import defaultdict
n = II()
aa = LI()
if n < 2500:
	ss = defaultdict(list)
	for j in range(n):
		for i in range(j):
			ss[aa[i] + aa[j]].append((i, j))
	for ij in ss.values():
		if len(ij) < 2:
			continue
		for x in range(len(ij)):
			(i0, j0) = ij[x]
			for y in range(x):
				(i1, j1) = ij[y]
				if len(set([i0, j0, i1, j1])) == 4:
					print('YES')
					print(i0 + 1, j0 + 1, i1 + 1, j1 + 1)
					exit()
	print('NO')
else:
	dd = {}
	ai = [(a, i) for (i, a) in enumerate(aa)]
	ai.sort(key=lambda x: x[0])
	for i in range(n - 1):
		d = ai[i + 1][0] - ai[i][0]
		if d in dd:
			j = dd[d]
			if j + 1 == i:
				continue
			x = ai[j][1]
			y = ai[j + 1][1]
			z = ai[i][1]
			w = ai[i + 1][1]
			print('YES')
			print(x + 1, w + 1, y + 1, z + 1)
			exit()
		else:
			dd[d] = i


def solve(a, n):
	S = {}
	for (x, ax) in enumerate(a):
		for (y, ay) in enumerate(a[:x]):
			s = ax + ay
			if s not in S:
				S[s] = []
			if x not in S[s] and y not in S[s]:
				(S[s].append(x), S[s].append(y))
			if len(S[s]) == 4:
				return S[s]
	return []
n = int(input())
a = list(map(int, input().split(' ')))
ans = solve(a, n)
if len(ans) > 0:
	print('YES')
	print(*[i + 1 for i in ans])
else:
	print('NO')


def some_random_function():
	x = 10
	x *= 100
	i_dont_know = x
	why_am_i_writing_this = x * x
	print(i_dont_know)
	print(why_am_i_writing_this)

def some_random_function5():
	x = 10
	x *= 100
	i_dont_know = x
	why_am_i_writing_this = x * x
	print(i_dont_know)
	print(why_am_i_writing_this)
import os, sys
from io import BytesIO, IOBase
from collections import defaultdict

def main():
	n = int(input())
	a = list(map(int, input().split()))
	y = defaultdict(list)
	for (ind, i) in enumerate(a):
		y[i].append(ind + 1)
	pa = []
	for i in y:
		if len(y[i]) >= 4:
			print('YES')
			print(*y[i][:4])
			exit()
		if len(y[i]) >= 2:
			pa.append(y[i])
		if len(pa) >= 2:
			print('YES')
			print(pa[0][0], pa[1][0], pa[0][1], pa[1][1])
			exit()
	x = min(4000, n)
	z = defaultdict(list)
	se = set()
	if len(pa):
		su = a[pa[0][-1] - 1] * 2
		an = [pa[0][-1], pa[0][-2]]
	else:
		su = 0
		an = [-1, -1]
	ind = []
	ne = []
	for i in range(x):
		if a[i] in se:
			continue
		se.add(a[i])
		ind.append(i + 1)
		ne.append(a[i])
	x = len(ne)
	for i in range(x):
		for j in range(i + 1, x):
			y = ne[i] + ne[j]
			if y == su:
				print('YES')
				assert len({ind[i], ind[j], an[0], an[1]}) == 4
				print(an[0], an[1], ind[i], ind[j])
				exit()
			z[y].append((ind[i], ind[j]))
			if len(z[y]) >= 2:
				print('YES')
				assert len({z[y][0][0], z[y][0][1], z[y][1][0], z[y][1][1]}) == 4
				print(z[y][0][0], z[y][0][1], z[y][1][0], z[y][1][1])
				exit()
	print('NO')
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 some_random_function1():
	x = 10
	x *= 100
	i_dont_know = x
	why_am_i_writing_this = x * x
	print(i_dont_know)
	print(why_am_i_writing_this)

def some_random_function2():
	x = 10
	x *= 100
	i_dont_know = x
	why_am_i_writing_this = x * x
	print(i_dont_know)
	print(why_am_i_writing_this)

def some_random_function3():
	x = 10
	x *= 100
	i_dont_know = x
	why_am_i_writing_this = x * x
	print(i_dont_know)
	print(why_am_i_writing_this)

def some_random_function4():
	x = 10
	x *= 100
	i_dont_know = x
	why_am_i_writing_this = x * x
	print(i_dont_know)
	print(why_am_i_writing_this)

def some_random_function6():
	x = 10
	x *= 100
	i_dont_know = x
	why_am_i_writing_this = x * x
	print(i_dont_know)
	print(why_am_i_writing_this)

def some_random_function7():
	x = 10
	x *= 100
	i_dont_know = x
	why_am_i_writing_this = x * x
	print(i_dont_know)
	print(why_am_i_writing_this)

def some_random_function8():
	x = 10
	x *= 100
	i_dont_know = x
	why_am_i_writing_this = x * x
	print(i_dont_know)
	print(why_am_i_writing_this)
main()


import sys
from collections import defaultdict
n = int(input())
nums = list(map(int, input().split()))
sum_dict = defaultdict(list)
for i in range(n):
	for j in range(i):
		s = nums[i] + nums[j]
		if s in sum_dict:
			for (x, y) in sum_dict[s]:
				if not {i, j} & {x, y}:
					print('YES')
					print(str(x + 1) + ' ' + str(y + 1) + ' ' + str(j + 1) + ' ' + str(i + 1))
					sys.exit()
		else:
			sum_dict[s].append((j, i))
print('NO')
sys.exit()


__name__ = '__main__'
n = int(input())
nums = list(map(int, input().split()))
sums = {}
solved = False
for i in range(0, n):
	for j in range(0, i):
		if nums[i] + nums[j] in sums:
			(a, b) = sums[nums[i] + nums[j]]
			if i != a and i != b and (j != a) and (j != b):
				print('YES')
				print(i + 1, j + 1, a + 1, b + 1)
				solved = True
				break
		else:
			sums[nums[i] + nums[j]] = [i, j]
	if solved:
		break
if not solved:
	print('NO')


def main():
	n = int(input())
	arr = list(map(int, input().split(' ')))
	cache = {}
	for i in range(n):
		for j in range(i):
			s = arr[i] + arr[j]
			if s in cache:
				(f, t) = cache[s]
				if i != f and i != t and (j != f) and (t != j):
					print('YES')
					print(f + 1, t + 1, i + 1, j + 1)
					return
			cache[s] = (i, j)
	print('NO')
main()


def find(a, idx):
	for ii in range(len(idx)):
		for jj in range(ii + 1, len(idx)):
			for kk in range(jj + 1, len(idx)):
				for ll in range(kk + 1, len(idx)):
					(i, j, k, l) = (idx[ii], idx[jj], idx[kk], idx[ll])
					if a[i] + a[j] == a[k] + a[l]:
						return (i, j, k, l)

def good(a, b):
	return all((a[i] not in b for i in range(2)))

def solve(n, a):
	seen = [[] for _ in range(2 * max(a) + 1)]
	for i in range(n):
		for j in range(i + 1, n):
			s = a[i] + a[j]
			seen[s].append((i, j))
			for k in range(len(seen[s]) - 1):
				if good(seen[s][k], seen[s][-1]):
					return list(seen[s][k]) + list(seen[s][-1])
			if len(seen[s]) >= 4:
				return find(a, list(set([seen[s][k][l] for k in range(len(seen[s])) for l in range(2)])))
	return None
n = int(input())
a = list(map(int, input().split()))
res = solve(n, a)
if res:
	print('YES')
	print(*[i + 1 for i in res])
else:
	print('NO')


import time
t = time.time()
n = int(input())
a = list(map(int, input().split()))
d = {}
for i in range(n):
	for j in range(i + 1, n):
		x = a[i] + a[j]
		if d.get(x, set()) & {i + 1, j + 1} == set():
			d[x] = d.get(x, set()) | {i + 1, j + 1}
		if len(d.get(x, set())) == 4:
			print('YES')
			print(*d[x])
			exit()
print('NO')


from sys import stdin
t = int(stdin.readline())
arr = list(map(int, stdin.readline().split()))
sum = {}
for i in range(t):
	for j in range(i):
		if arr[i] + arr[j] in sum:
			(a, b) = sum[arr[i] + arr[j]]
			if len(set([a, b, i + 1, j + 1])) == 4:
				print('YES')
				print(a, b, i + 1, j + 1)
				exit(0)
		else:
			sum[arr[i] + arr[j]] = (i + 1, j + 1)
print('NO')


n = int(input())

def solve(arr, n):
	d = {}
	for i in range(n):
		for j in range(i):
			s = arr[i] + arr[j]
			if s not in d:
				d[s] = (i, j)
			else:
				(ii, jj) = d[s]
				if len(set([i, j, ii, jj])) == 4:
					print('YES')
					print(ii + 1, jj + 1, i + 1, j + 1)
					return 1
	print('NO')
arr = list(map(int, input().split()))
solve(arr, n)


a = int(input())
b = list(map(int, input().split()))
dict = {}
for i in range(a):
	for j in range(i):
		sum = b[i] + b[j]
		if sum in dict:
			(ii, jj) = dict[sum]
			if len(set([i, j, ii, jj])) == 4:
				print('YES')
				print(ii + 1, jj + 1, i + 1, j + 1)
				exit()
		dict[b[i] + b[j]] = (i, j)
print('NO')


n = int(input())
a = (*map(int, input().split()),)
d = {}
for i in range(n):
	for j in range(i):
		s = a[i] + a[j]
		if s not in d:
			d[s] = (i, j)
		else:
			x = d[s]
			if i not in x and j not in x:
				print('YES')
				print(x[0] + 1, x[1] + 1, i + 1, j + 1)
				exit()
print('NO')


n = int(input())
A = list(map(int, input().split(' ')))

def f(A, n):
	D = {}
	for j in range(n):
		for i in range(j):
			s = A[i] + A[j]
			if s in D:
				(x, y) = D[s]
				if not (i == x or i == y or j == y):
					print('YES')
					print(x + 1, y + 1, i + 1, j + 1)
					return
			D[s] = (i, j)
	print('NO')
f(A, n)


import sys
input = sys.stdin.readline
(n, values, sums) = (int(input()), [int(i) for i in input().split()], {})
for i in range(n):
	for j in range(i):
		check = values[i] + values[j]
		if check not in sums:
			sums[check] = (i, j)
		elif i != sums[check][0] and i != sums[check][1] and (j != sums[check][0]) and (j != sums[check][1]):
			print('YES')
			print(i + 1, j + 1, sums[check][0] + 1, sums[check][1] + 1)
			sys.exit()
print('NO')


n = int(input())
a = list(map(int, input().split()))
d = {}
(x, y, w, z) = (-1, -1, -1, -1)
ans = 0
for i in range(n):
	if ans == 0:
		for j in range(i + 1, n):
			s = a[i] + a[j]
			if s in d.keys():
				x = i + 1
				y = j + 1
				w = d.get(s)[0] + 1
				z = d.get(s)[1] + 1
				if x != w and x != z and (y != w) and (y != z):
					ans = 1
					break
			else:
				d[s] = [i, j]
if ans:
	print('YES')
	print(x, y, w, z)
else:
	print('NO')


def sol(arr):
	s = dict()
	for i in range(min(4000, len(arr) - 1)):
		for j in range(i + 1, min(4001, len(arr))):
			key = arr[i] + arr[j]
			if key not in s:
				s[key] = (i, j)
			elif i not in s[key] and j not in s[key]:
				print('YES')
				print(s[key][0] + 1, s[key][1] + 1, i + 1, j + 1)
				return
	print('NO')
input()
sol([int(i) for i in input().split()])


n = int(input().strip())
a = list(map(int, input().strip().split()))
hm = {}
for i in range(len(a)):
	for j in range(i + 1, len(a)):
		if a[i] + a[j] in hm:
			if i in hm[a[i] + a[j]] or j in hm[a[i] + a[j]]:
				continue
			else:
				print('YES')
				print(i + 1, j + 1, hm[a[i] + a[j]][0] + 1, hm[a[i] + a[j]][1] + 1)
				exit(0)
		else:
			hm[a[i] + a[j]] = [i, j]
print('NO')


def main():
	n = int(input())
	a = list(map(lambda x: int(x), input().split(' ')))
	un = []
	ind = {}
	two = 0
	x = 0
	i = 0
	for i in range(n):
		if not a[i] in ind:
			ind[a[i]] = [i]
			un.append((a[i], i))
		else:
			ind[a[i]].append(i)
		l = ind[a[i]]
		if len(l) >= 4:
			print('YES')
			print(l[0] + 1, l[1] + 1, l[2] + 1, l[3] + 1)
			return
		if len(l) > 1:
			if two == 1 and x != a[i]:
				print('YES')
				print(l[0] + 1, ind[x][0] + 1, l[1] + 1, ind[x][1] + 1)
				return
			two = 1
			x = a[i]
	if len(un) > 5000:
		s = []
		for i in range(len(un)):
			s.append((un[i][0], un[i][1]))
		s = sorted(s, key=lambda x: x[0])
		diff_m = {}
		for i in range(len(s) - 1):
			x = s[i + 1][0] - s[i][0]
			if x in diff_m and diff_m[x] != i - 1:
				j = diff_m[x]
				print('YES')
				print(s[j][1] + 1, s[i + 1][1] + 1, s[j + 1][1] + 1, s[i][1] + 1)
				return
			if not s[i + 1][0] - s[i][0] in diff_m:
				diff_m[s[i + 1][0] - s[i][0]] = i
		return
	m = {}
	for i in range(n):
		for j in range(i + 1, n):
			m[a[i] + a[j]] = (i, j)
	for i in range(n):
		for j in range(i + 1, n):
			(l, k) = m[a[i] + a[j]]
			if l != i and l != j and (k != i) and (k != j):
				print('YES')
				print(i + 1, j + 1, k + 1, l + 1)
				return
	print('NO')
	return
main()


from collections import Counter
n = int(input())
dupe = -1

def findMatch(a, sols):
	v = []
	for x in sols:
		for i in range(n):
			if a[i] == x and i + 1 not in v:
				v.append(i + 1)
				break
	return v
a = [int(x) for x in input().split()]
occ = Counter(a)
for (i, j) in occ.items():
	if j > 1:
		if dupe == -1:
			dupe = i
		else:
			indices1 = [x for x in range(n) if a[x] == dupe]
			indices2 = [x for x in range(n) if a[x] == i]
			print('YES')
			print(*(indices1[0] + 1, indices2[0] + 1, indices1[1] + 1, indices2[1] + 1))
			exit()
	if j >= 4:
		print('YES')
		indices = [x + 1 for x in range(n) if a[x] == i]
		print(*indices[:4])
		exit()
b = list(sorted(a))
seen = [[] for _ in range(25 * 10 ** 5)]
for i in range(n):
	for j in range(i):
		diff = b[i] - b[j]
		if len(seen[diff]) == 0:
			seen[diff].append((i, j))
		else:
			for (c, d) in seen[diff]:
				if i != c and i != d and (j != c) and (j != d):
					sols = [b[j], b[c], b[d], b[i]]
					v = findMatch(a, sols)
					print('YES')
					print(*v)
					exit()
print('NO')


def findPairs(arr, size):
	sumPair = {}
	for i in range(0, size - 1):
		for j in range(i + 1, size):
			Sum = arr[i] + arr[j]
			if Sum in sumPair:
				if (sumPair[Sum][0] != i and sumPair[Sum][1] != j) and (sumPair[Sum][1] != i and sumPair[Sum][0] != j):
					print('YES')
					print(i + 1, j + 1, sumPair[Sum][0] + 1, sumPair[Sum][1] + 1)
					return
			else:
				sumPair[Sum] = [i, j]
	print('NO')
n = int(input())
a = list(map(int, input().split()))
findPairs(a, n)


import sys
input = sys.stdin.readline
from operator import itemgetter
n = int(input())
A = list(map(int, input().split()))
MAX = max(A) - min(A)
COUNT = [[] for i in range(max(A) + 1)]
fl1 = 0
for i in range(n):
	COUNT[A[i]].append(i)
	if len(COUNT[A[i]]) == 4:
		print('YES')
		print(*[c + 1 for c in COUNT[A[i]]])
		exit()
	if len(COUNT[A[i]]) == 2:
		if fl1 == 0:
			fl1 = A[i]
		else:
			print('YES')
			print(COUNT[fl1][0] + 1, COUNT[A[i]][0] + 1, COUNT[A[i]][1] + 1, COUNT[fl1][1] + 1)
			exit()
X = [(A[i], i) for i in range(n)]
SA = [[] for i in range(MAX + 1)]
for i in range(n):
	for j in range(i + 1, n):
		sa = abs(X[j][0] - X[i][0])
		for (x, y) in SA[sa]:
			if X[i][1] != x and X[i][1] != y and (X[j][1] != x) and (X[j][1] != y):
				if X[i][0] <= X[j][0]:
					print('YES')
					print(X[i][1] + 1, y + 1, x + 1, X[j][1] + 1)
					exit()
				else:
					print('YES')
					print(X[j][1] + 1, y + 1, x + 1, X[i][1] + 1)
					exit()
		if X[i][0] <= X[j][0]:
			SA[sa].append((X[i][1], X[j][1]))
		else:
			SA[sa].append((X[j][1], X[i][1]))
print('NO')


import sys, getpass
from collections import Counter, defaultdict, deque
import time
start_time = time.time()
input = sys.stdin.readline
M9 = 10 ** 9 + 7
MAXINT = sys.maxsize
OFFLINE_TEST = getpass.getuser() == 'hkmac'

def log(*args):
	if OFFLINE_TEST:
		print('\x1b[36m', *args, '\x1b[0m', file=sys.stderr)

def solve(*args):
	if OFFLINE_TEST:
		log('----- solving ------')
		log(*args)
		log('----- ------- ------')
	return solve_(*args)

def read_matrix(rows):
	return [list(map(int, input().split())) for _ in range(rows)]

def read_strings(rows):
	return [input().strip() for _ in range(rows)]

def solve_(A, N):
	C = dict()
	for i in range(N):
		for j in range(i):
			res = A[i] + A[j]
			if res in C:
				(z, w) = C[res]
				if len(set((i, j, z, w))) == 4:
					return f'YES\n{i + 1} {j + 1} {z + 1} {w + 1}'
			else:
				C[res] = (i, j)
	return 'NO'
for case_num in [0]:
	k = int(input())
	lst = list(map(int, input().split()))
	res = solve(lst, k)
	print(res)


def solve():
	n = int(input())
	a = list(map(int, input().split()))
	dic = {}
	for i in range(n):
		for j in range(i + 1, n):
			s1 = a[i] + a[j]
			if s1 not in dic:
				dic[s1] = [i, j]
			else:
				if dic[s1][0] == i or dic[s1][0] == j or dic[s1][1] == i or (dic[s1][1] == j):
					continue
				print('YES')
				print(dic[s1][0] + 1, dic[s1][1] + 1, i + 1, j + 1)
				return 0
	print('NO')
	return 0
solve()


n = int(input())
arr = list(map(int, input().split()))
d = {}
flag = 0
for i in range(n):
	for j in range(i + 1, n):
		s = arr[i] + arr[j]
		if s not in d:
			d[s] = (i, j)
		else:
			if d[s][0] == i or d[s][1] == i or d[s][0] == j or (d[s][1] == j):
				continue
			print('YES')
			print(d[s][0] + 1, d[s][1] + 1, i + 1, j + 1)
			flag = 1
			break
	if flag == 1:
		break
if flag == 0:
	print('NO')


def find(n, a):
	d = dict()
	for i in range(n):
		for j in range(i + 1, n):
			v = a[i] + a[j]
			if v in d:
				if i != d[v][0] and i != d[v][1] and (j != d[v][0]) and (j != d[v][1]):
					return d[v] + [i, j]
			d[v] = [i, j]
	return False
n = int(input())
a = list(map(int, input().split()))
f = find(n, a)
if not f:
	print('NO')
else:
	print('YES')
	print(*[e + 1 for e in f])


mod = 1000000007
eps = 10 ** (-9)

def main():
	import sys
	from collections import Counter
	input = sys.stdin.readline
	N = int(input())
	A = list(map(int, input().split()))
	C = Counter(A)
	T = []
	for v in C:
		if C[v] >= 2:
			T.append(v)
	if len(T) >= 2:
		(v0, v1) = (T[0], T[1])
		print('YES')
		ans = [-1] * 4
		for (i, a) in enumerate(A):
			if a == v0:
				if ans[0] == -1:
					ans[0] = i + 1
				else:
					ans[2] = i + 1
			elif a == v1:
				if ans[1] == -1:
					ans[1] = i + 1
				else:
					ans[3] = i + 1
		print(*ans)
		exit()
	elif len(T) == 1:
		v = T[0]
		if C[v] >= 4:
			ans = []
			for (i, a) in enumerate(A):
				if a == v:
					ans.append(i + 1)
					if len(ans) == 4:
						break
			print('YES')
			print(*ans)
			exit()
	D = [None] * 5000001
	for i in range(N):
		ai = A[i]
		for j in range(i + 1, N):
			aj = A[j]
			if D[ai + aj] is None:
				D[ai + aj] = [(i + 1, j + 1)]
			else:
				for (k, l) in D[ai + aj]:
					ijkl = set([i + 1, j + 1, k, l])
					if len(ijkl) == 4:
						print('YES')
						print(i + 1, j + 1, k, l)
						exit()
				D[ai + aj].append((i + 1, j + 1))
	print('NO')
main()


n = int(input())
a = [int(x) for x in input().split()]
d = {}
for x in range(n):
	for y in range(x):
		if a[x] + a[y] not in d:
			d[a[x] + a[y]] = [x, y]
		else:
			(z, w) = d[a[x] + a[y]]
			if x not in [z, w] and y not in [z, w]:
				print('YES')
				print(*[1 + i for i in (x, y, z, w)])
				exit()
print('NO')


from collections import defaultdict
n = int(input())
a = [int(y) for y in input().split()]
dic = dict()
found = False
ans = []
d = {}
res = []
for i in range(n):
	for j in range(i + 1, n):
		if a[i] + a[j] not in d:
			d[a[i] + a[j]] = (i, j)
		elif i != d[a[i] + a[j]][0] and i != d[a[i] + a[j]][1] and (j != d[a[i] + a[j]][1]) and (j != d[a[i] + a[j]][0]):
			res.append(list(d[a[i] + a[j]]) + [i] + [j])
			print('YES')
			for i in range(4):
				res[0][i] += 1
			print(*res[0])
			found = True
			break
	if found:
		break
if not found:
	print('NO')


from sys import stdin
input = stdin.readline

def A707():
	from collections import defaultdict
	CAP = 2500001
	n = int(input())
	a = list(map(int, input().split()))
	d = [0] * (CAP * 2)
	i = n - 2
	j = n - 1
	found = False
	while i >= 0:
		j = i + 1
		while j < n:
			if d[a[i] + a[j]] != 0:
				ID = i * n + j
				for k in d[a[i] + a[j]]:
					if not (k % n == i or k % n == j or k // n == i or (k // n == j)):
						print('YES')
						print(i + 1, j + 1, k % n + 1, k // n + 1)
						found = True
						break
				d[a[i] + a[j]].append(ID)
			else:
				d[a[i] + a[j]] = [i * n + j]
			j += 1
			if found:
				break
		i -= 1
		if found:
			break
	if not found:
		print('NO')
A707()


n = int(input())
zoz = [int(x) for x in input().split()]
s = {}
for a in range(n):
	for b in range(a + 1, n):
		if a != b:
			if zoz[a] + zoz[b] not in s:
				s[zoz[a] + zoz[b]] = [a + 1, b + 1]
			else:
				g = set()
				g.add(a)
				g.add(b)
				g.add(-1 + s[zoz[a] + zoz[b]][0])
				g.add(-1 + s[zoz[a] + zoz[b]][1])
				if len(g) == 4:
					print('YES')
					print(*s[zoz[a] + zoz[b]], a + 1, b + 1)
					break
	else:
		continue
	break
else:
	print('NO')


import sys
import math

class DictList(dict):

	def __setitem__(self, key, value):
		try:
			self[key].append(value)
		except KeyError:
			super(DictList, self).__setitem__(key, value)
		except AttributeError:
			super(DictList, self).__setitem__(key, [self[key], value])

def fn(n, a):
	d = {}
	ans = []
	for i in range(n - 1):
		for j in range(i + 1, n):
			sum0 = a[i] + a[j]
			if sum0 in d:
				p = d.get(sum0)
				if i in p or j in p:
					continue
				ans = [p[0] + 1, p[1] + 1, i + 1, j + 1]
				print('YES')
				print(*ans)
				return 0
			else:
				d[sum0] = [i, j]
	print('NO')
input = sys.stdin.read()
data = list(map(int, input.split()))
n = data[0]
a = data[1:]
fn(n, a)


n = int(input())
a = list(map(int, input().split()))
d = {}
f = True
for i in range(n):
	if not f:
		break
	for j in range(i):
		if a[i] + a[j] in d:
			(ii, jj) = d[a[i] + a[j]]
			if len(set([i, j, ii, jj])) == 4:
				print('YES')
				f = False
				print(i + 1, j + 1, ii + 1, jj + 1)
				break
		else:
			d[a[i] + a[j]] = (i, j)
if f:
	print('NO')


n = int(input())
a = list(map(int, input().split()))
d = {}
bp = False
for i in range(len(a)):
	if bp:
		break
	for j in range(i + 1, len(a)):
		if bp:
			break
		c = a[i] + a[j]
		if c in d:
			for k in d[c]:
				if k[0] < i and j != k[1] and (i != k[1]):
					c = [k[0] + 1, k[1] + 1, i + 1, j + 1]
					bp = True
					break
		else:
			d[c] = [[i, j]]
if not bp:
	c = []
if c:
	print('YES')
	print(*c)
else:
	print('NO')


from sys import stdin, stdout
import heapq
from collections import defaultdict
import math
import copy

def main():
	n = int(stdin.readline())
	arr = list(map(int, stdin.readline().split()))
	d = {}
	for i in range(n):
		for j in range(i):
			s = arr[i] + arr[j]
			if s not in d:
				d[s] = (i, j)
			else:
				(ii, jj) = d[s]
				if len(set([i, j, ii, jj])) == 4:
					print('YES')
					print(ii + 1, jj + 1, i + 1, j + 1)
					return 1
	print('NO')
main()


def path(arr):
	d = {}
	for i in range(len(arr)):
		for j in range(i):
			if d.get(arr[i] + arr[j], None) != None:
				(ii, jj) = d[arr[i] + arr[j]]
				if len(set([ii, jj, i, j])) == 4:
					print('YES')
					print(ii + 1, jj + 1, i + 1, j + 1)
					return ''
			d[arr[i] + arr[j]] = (i, j)
	return 'NO'
a = input()
lst = list(map(int, input().strip().split()))
print(path(lst))


def sol(n, lis):
	dic = {}
	c1 = 0
	res = None
	for i in range(n):
		a = dic.get(lis[i], [])
		if a and res != lis[i]:
			c1 += 1
			res = lis[i]
			if c1 == 2:
				break
		a.append(i)
		dic[lis[i]] = a
	res = []
	for elm in dic:
		t = len(dic[elm])
		if t == 2:
			res.extend(dic[elm])
		elif t >= 4:
			return dic[elm][:4]
	if len(res) == 4:
		return res
	dic = {}
	for i in range(n - 1):
		for j in range(i + 1, n):
			temp = lis[i] + lis[j]
			a = dic.get(temp, None)
			if a:
				temp = (i, j, a[0], a[1])
				if len(set(temp)) == 4:
					return temp
			else:
				dic[temp] = (i, j)
	return None
n = int(input())
lis = [int(x) for x in input().split()]
res = sol(n, lis)
if res:
	print('YES')
	print(' '.join((str(x + 1) for x in res)))
else:
	print('NO')


import sys
readline = sys.stdin.readline
N = int(readline())
A = list(map(int, readline().split()))

def f():
	C = dict()
	for i in range(N):
		for j in range(i):
			res = A[i] + A[j]
			if res in C:
				(z, w) = C[res]
				if len(set((i, j, z, w))) == 4:
					return f'YES\n{i + 1} {j + 1} {z + 1} {w + 1}'
			else:
				C[res] = (i, j)
	return 'NO'
print(f())


n = int(input())
a = list(map(int, input().split()))
ans = None
ind = {}
for i in range(n):
	if ans is not None:
		break
	for j in range(i + 1, n):
		s = a[i] + a[j]
		if s in ind and ind[s][0] != i and (ind[s][0] != j) and (ind[s][1] != i) and (ind[s][1] != j):
			ans = [i + 1, j + 1, ind[s][0] + 1, ind[s][1] + 1]
			break
		elif s not in ind:
			ind[s] = [i, j]
if ans is not None:
	print('YES')
	print(ans[0], ans[1], ans[2], ans[3])
else:
	print('NO')


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 SegmentTree:

	def __init__(self, data, default=10 ** 10, func=lambda a, b: min(a, b)):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class SegmentTree1:

	def __init__(self, data, default=10 ** 6, func=lambda a, b: min(a, b)):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)
MOD = 10 ** 9 + 7

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
mod = 10 ** 9 + 7
omod = 998244353
prime = [True for i in range(200001)]
pp = []

def SieveOfEratosthenes(n=200000):
	p = 2
	c = 0
	while p * p <= n:
		if prime[p] == True:
			c += 1
			pp.append(p)
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1

def binarySearch(arr, n, key):
	left = 0
	right = n - 1
	mid = 0
	res = 0
	while left <= right:
		mid = (right + left) // 2
		if arr[mid] > key:
			right = mid - 1
		else:
			res = mid + 1
			left = mid + 1
	return res
n = int(input().strip())
a = list(map(int, input().strip().split()))
hm = {}
for i in range(len(a)):
	for j in range(i + 1, len(a)):
		if a[i] + a[j] in hm:
			if i in hm[a[i] + a[j]] or j in hm[a[i] + a[j]]:
				continue
			else:
				print('YES')
				print(i + 1, j + 1, hm[a[i] + a[j]][0] + 1, hm[a[i] + a[j]][1] + 1)
				exit(0)
		else:
			hm[a[i] + a[j]] = [i, j]
print('NO')


n = int(input())
a = list(map(int, input().split()))
d = dict()
f = 0
for i in range(n):
	for j in range(i + 1, n):
		s = a[i] + a[j]
		if s not in d:
			d[s] = [i, j]
		else:
			se = {i, j}
			se.update(d[s])
			if len(se) == 4:
				print('YES')
				print(i + 1, j + 1, d[s][0] + 1, d[s][1] + 1)
				f = 1
				break
	if f == 1:
		break
if f == 0:
	print('NO')


import sys
from collections import defaultdict
r = sys.stdin.readline
n = int(input())
a = list(map(int, r().split()))
d = {}
for i in range(n):
	for j in range(i):
		if a[i] + a[j] in d:
			(ii, jj) = d[a[i] + a[j]]
			if len(set([i, j, ii, jj])) == 4:
				print('YES')
				print(i + 1, j + 1, ii + 1, jj + 1)
				exit(0)
		else:
			d[a[i] + a[j]] = (i, j)
print('NO')


from sys import stdin, stdout
n = int(stdin.readline())
a = [int(x) for x in stdin.readline().split()]
doubles = []
things = {}
for (x, y) in enumerate(a):
	if y in things:
		doubles.append(x + 1)
		doubles.append(things[y] + 1)
		del things[y]
	else:
		things[y] = x
if len(doubles) >= 4:
	print('YES')
	print(doubles[0], doubles[2], doubles[1], doubles[3])
else:
	found = {}
	done = False
	for x in range(n):
		for y in range(x + 1, n):
			g = a[x] + a[y]
			if g in found:
				if x != found[g][0] and y != found[g][1] and (x != found[g][1]) and (y != found[g][0]):
					print('YES')
					print(found[g][0] + 1, found[g][1] + 1, x + 1, y + 1)
					done = True
					break
			else:
				found[g] = [x, y]
		if done:
			break
	if not done:
		print('NO')


from sys import stdin
input = stdin.readline
n = int(input())
a = list(map(int, input().split()))
dict = {}
f = False
for i in range(n):
	for j in range(i):
		sum = a[i] + a[j]
		if sum in dict:
			f = dict[sum][0]
			s = dict[sum][1]
			if i != f and i != s and (j != f) and (j != s):
				print('YES')
				print(i + 1, j + 1, f + 1, s + 1)
				exit()
		dict[sum] = (i, j)
print('NO')