//Author:MatrixCascade

#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define clr(f, n) memset(f, 0, sizeof(int) * (n))
#define cpy(f, g, n) memcpy(f, g, sizeof(int) * (n))
#define rev(f, n) reverse(f, f + n)
#define pir pair<int, int>
#define mkp make_pair
#define fst it->first
#define sec it->second
#define int long long
#define up(i,x,y) for(int i=x,i##end=y;i<=i##end;++i)
#define down(i,x,y) for(int i=x,i##end=y;i>=i##end;--i)
using namespace std;
int n, m;
int read()
{
    int s = 0, f = 1;
    char ch = getchar();
    while (ch < '0' || ch > '9')
    {
        if (ch == '-')
            f = -1;
        ch = getchar();
    }
    while (ch >= '0' && ch <= '9')
    {
        s = s * 10 + ch - '0';
        ch = getchar();
    }
    return s * f;
}
inline void print(int *f, int len)
{
    for (int i = 0; i < len; i++)
        printf("%lld ", f[i]);
    puts("");
}
int T;
int k[5050];
struct node{
	int x,y,t;
}w[606060];
int tot=0;
bool cmp(node a,node b)
{
	return a.t>b.t;
}
signed main()
{
	n=read();
	up(i,1,n)k[i]=read();
	up(i,1,n)
	{
		up(j,i+1,n)
		{
			if(i==j)continue;
			if(k[i]>=k[j])w[++tot]=(node){i,j,k[i]-k[j]};
			else w[++tot]=(node){j,i,k[j]-k[i]};
		}
	}
	sort(w+1,w+tot+1,cmp);
	up(i,1,tot)
	{
		string s;
		cout<<"? "<<w[i].x<<" "<<w[i].y<<endl;
		cin>>s;
		if(s=="Yes")
		{
			cout<<"! "<<w[i].x<<" "<<w[i].y<<endl;
			return 0;
		}
	}
	cout<<"! 0 0"<<endl;
}
