This is an interactive problem. Remember to flush your output while communicating with the testing program. You may use fflush(stdout) in C++, system.out.flush() in Java, stdout.flush() in Python or flush(output) in Pascal to flush the output. If you use some other programming language, consult its documentation. You may also refer to the guide on interactive problems: <https://codeforces.com/blog/entry/45307>.

There is a city in which Dixit lives. In the city, there are n houses. There is  exactly one directed road between every pair of houses. For example, consider two houses A and B, then there is a directed road either from A to B or from B to A but not both. The number of roads leading to the i-th house is k_i.

Two houses A and B are bi-reachable if A is reachable from B and B is reachable from A. We say that house B is reachable from house A when there is a path from house A to house B.

Dixit wants to buy two houses in the city, that is, one for living and one for studying. Of course, he would like to travel from one house to another. So, he wants to find a pair of bi-reachable houses A and B. Among all such pairs, he wants to choose one with the maximum value of |k_A - k_B|, where k_i is the number of roads leading to the house i. If more than one optimal pair exists, any of them is suitable.

Since Dixit is busy preparing CodeCraft, can you help him find the desired pair of houses, or tell him that no such houses exist?

In the problem input, you are not given the direction of each road. You are given — for each house — only the number of incoming roads to that house (k_i).

You are allowed to ask only one type of query from the judge: give two houses A and B, and the judge answers whether B is reachable from A. There is no upper limit on the number of queries. But, you cannot ask more queries after the judge answers "Yes" to any of your queries. Also, you cannot ask the same query twice.

Once you have exhausted all your queries (or the judge responds "Yes" to any of your queries), your program must output its guess for the two houses and quit.

See the Interaction section below for more details.

Input

The first line contains a single integer n (3 ≤ n ≤ 500) denoting the number of houses in the city. The next line contains n space-separated integers k_1, k_2, ..., k_n (0 ≤ k_i ≤ n - 1), the i-th of them represents the number of incoming roads to the i-th house.

Interaction

To ask a query, print "? A B" (1 ≤ A,B ≤ N, A≠ B). The judge will respond "Yes" if house B is reachable from house A, or "No" otherwise.

To output the final answer, print "! A B", where A and B are bi-reachable with the maximum possible value of |k_A - k_B|. If there does not exist such pair of houses A and B, output "! 0 0".

After outputting the final answer, your program must terminate immediately, otherwise you will receive Wrong Answer verdict.

You cannot ask the same query twice. There is no upper limit to the number of queries you ask, but, you cannot ask more queries after the judge answers "Yes" to any of your queries. Your program must now output the final answer ("! A B" or "! 0 0") and terminate.

If you ask a query in incorrect format or repeat a previous query, you will get Wrong Answer verdict.

After printing a query do not forget to output the end of the line and flush the output. Otherwise, you will get the Idleness limit exceeded error. To do this, use:

  * fflush(stdout) or cout.flush() in C++; 
  * System.out.flush() in Java; 
  * flush(output) in Pascal; 
  * stdout.flush() in Python; 
  * see documentation for other languages.

Examples

Input


3
1 1 1
Yes

Output


? 1 2
! 1 2

Input


4
1 2 0 3
No
No
No
No
No
No

Output


? 2 1
? 1 3
? 4 1
? 2 3
? 4 2
? 4 3
! 0 0

Note

In the first sample input, we are given a city of three houses with one incoming road each. The user program asks one query: "? 1 2": asking whether we can reach from house 1 to house 2. The judge responds with "Yes". The user program now concludes that this is sufficient information to determine the correct answer. So, it outputs "! 1 2" and quits.

In the second sample input, the user program queries for six different pairs of houses, and finally answers "! 0 0" as it is convinced that no two houses as desired in the question exist in this city.

Source: codeforces | Difficulty: HARD
Tags: Complete search

Sorting

Graph algorithms

Greedy algorithms


Solutions:
from sys import stdin, stdout
input = stdin.readline

def MyIter(n):
	for k in range(n - 1, 0, -1):
		i = 0
		while i + k < n:
			yield (i, i + k)
			i += 1

def solve(n, a):
	dct = [[] for i in range(n)]
	for (i, el) in enumerate(a):
		dct[el].append(i + 1)
	for (i, j) in MyIter(n):
		for a in dct[i]:
			for b in dct[j]:
				stdout.write('? %d %d\n' % (b, a))
				stdout.flush()
				if input()[0] == 'Y':
					return [a, b]
	for j in range(n):
		if len(dct[j]) >= 2:
			return dct[j][:2]
	return [0, 0]
n = int(input())
a = list(map(int, input().split()))
res = solve(n, a)
print('!', *res)


import os
import sys
from io import BytesIO, IOBase

def main():
	n = int(input())
	k = list(map(int, input().split()))
	lens = []
	for i in range(n + 1):
		lens.append([])
	for i in range(len(k)):
		lens[k[i]].append(i + 1)
	for diff in range(n - 2, -1, -1):
		for lower in range(1, n - diff):
			higher = lower + diff
			for a in lens[lower]:
				for b in lens[higher]:
					if a == b:
						continue
					print('?', b, a, flush=True)
					s = input()
					if s == 'Yes':
						print('!', b, a, flush=True)
						exit()
	print('!', 0, 0, flush=True)
	exit()
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

def guess(i, j):
	print(f'? {i} {j}')
	sys.stdout.flush()
	return input()

def answer(i, j):
	print(f'! {i} {j}')
	sys.stdout.flush()

def solve(n, k):
	pairs = []
	for i in range(len(k)):
		for j in range(i + 1, len(k)):
			pairs.append((abs(k[i] - k[j]), i, j))
	for (d, i, j) in reversed(sorted(pairs)):
		(a, b) = (i, j)
		if k[i] < k[j]:
			(a, b) = (b, a)
		r = guess(a + 1, b + 1)
		if r == 'Yes':
			answer(a + 1, b + 1)
			return
	answer(0, 0)
n = int(input())
k = [int(v) for v in input().split()]
solve(n, k)


n = int(input())
nums = list(map(int, input().split()))
pairs = []
for i in range(len(nums)):
	for j in range(i + 1, len(nums)):
		pairs.append((abs(nums[i] - nums[j]), (i + 1, j + 1)))
pairs.sort(reverse=True)
for (_, (i, j)) in pairs:
	if nums[i - 1] > nums[j - 1]:
		print(f'? {i} {j}', flush=True)
	else:
		print(f'? {j} {i}', flush=True)
	if input() == 'Yes':
		print(f'! {j} {i}', flush=True)
		exit(0)
print('! 0 0', flush=True)


from itertools import permutations, product
n = int(input())
nums = list(map(int, input().split()))
indexed = sorted(zip(nums, range(1, len(nums) + 1)))
groups = []
prev_value = -1
for (value, index) in indexed:
	if prev_value != value:
		groups.append([])
	groups[-1].append((value, index))
	prev_value = value
max_groups = []
for i in range(len(groups)):
	for j in range(i, len(groups)):
		if i != j or len(groups[i]) >= 3:
			max_groups.append((abs(groups[i][0][0] - groups[j][0][0]), (i, j)))
max_groups.sort(reverse=True)
for (_, (start, end)) in max_groups:
	for (v1, i1) in groups[start]:
		for (v2, i2) in groups[end]:
			if i1 != i2:
				print(f'? {i2} {i1}', flush=True)
				ans = input()
				if ans.lower().strip() == 'yes':
					print(f'! {i1} {i2}', flush=True)
					exit(0)
print('! 0 0')


import time
import os, sys
from io import BytesIO, IOBase
from types import GeneratorType
from bisect import bisect_left, bisect_right
from collections import defaultdict as dd, deque as dq, Counter as dc
import math, string, heapq as h
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 getStrs():
	return input().split()

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

def getStr():
	return input()

def listStr():
	return list(input())

def getMat(n):
	return [getInts() for _ in range(n)]

def getBin():
	return list(map(int, list(input())))

def isInt(s):
	return '0' <= s[0] <= '9'

def ceil_(a, b):
	return a // b + (a % b > 0)
MOD = 10 ** 9 + 7

def solve():
	N = getInt()
	A = getInts()
	A = [[a, i] for (i, a) in enumerate(A)]
	A.sort(reverse=True)
	while A and A[-1][0] == 0:
		A.pop()
		for i in range(len(A)):
			A[i][0] -= 1
	if len(A) <= 2:
		print('!', 0, 0, flush=True)
		return
	for j in range(len(A)):
		for k in range(len(A) - 1, j, -1):
			print('?', A[j][1] + 1, A[k][1] + 1, flush=True)
			if input() == 'Yes':
				print('!', A[j][1] + 1, A[k][1] + 1, flush=True)
				return
	print('!', 0, 0, flush=True)
	return
solve()
exit(0)