#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<vector>
#include<map>
#include<queue>
#include<array>
#include<stack>
#include<set>
using namespace std;

#define imax(a,b) (((a)>(b))?(a):(b))
#define imin(a,b) (((a)<(b))?(a):(b))
#define mp make_pair

typedef long long ll;

const int N = 510;

int n;
int g[N];
char st[10];
struct dop
{
	int x, a, b;
	bool operator < (const dop& A) const {
		return x > A.x;
	}
} d[N * N];


void read(int& x)
{
	x = 0; char ch = getchar(); bool f = 0;
	while (!(ch >= '0' && ch <= '9')) f |= (ch == '-'), ch = getchar();
	while ((ch >= '0' && ch <= '9')) x = (x << 3) + (x << 1) + ch - '0', ch = getchar();
	if (f) x = -x;
}

/*ll Mul(ll x, ll y, ll mods)
{
	ll s = 0;
	for (; y; y >>= 1, x = (x << 1) % mods)
		if (y & 1) s = (s + x) % mods;
	return s;
}

ll Pow(ll x, ll y, ll mods)
{
	ll s = 1;
	for (; y; y >>= 1, x = Mul(x, x, mods))
		if (y & 1) s = Mul(s, x, mods);
	return s;
}

ll gcd(ll x, ll y) { return (y ? gcd(y, x % y) : x); }
*/


int main()
{
	scanf("%d", &n);
	for (int i = 1;i <= n;++i) scanf("%d", &g[i]);
	int cnt = 0;
	for (int i = 1;i < n;++i)
		for (int j = i + 1;j <= n;++j)
		{
			d[++cnt].a = i; d[cnt].b = j;
			if (g[d[cnt].a] < g[d[cnt].b]) swap(d[cnt].a, d[cnt].b);
			d[cnt].x = g[d[cnt].a] - g[d[cnt].b];
		}
	sort(d + 1, d + 1 + cnt);
	for (int i = 1;i <= cnt;++i)
	{
		printf("? %d %d\n",d[i].a,d[i].b); fflush(stdout);
		scanf("%s", st);
		if (st[0] == 'Y')
		{
			printf("! %d %d\n", d[i].a, d[i].b);
			return 0;
		}
	}
	printf("! 0 0\n");
	fflush(stdout);
	return 0;
}