#include <cstdio>
#include <cstring>
#include <algorithm>
#define rep(a,b,c) for(int a=b;a<=c;a++)
#define per(a,b,c) for(int a=b;a>=c;a--)
#define int long long
const int inf=0x3f3f3f3f;
template<class T>inline void read(T &x) {
	T f=1;x=0;char s=getchar();
	while(s<'0'||s>'9'){if(s=='-')f=-1;s=getchar();}
	while(s>='0'&&s<='9'){x=x*10+s-'0';s=getchar();}
	x*=f;
}
const int N=1e6+1;
struct Node {
	int i,j,val;
}a[N];
int n,du[N],idx;
char s[10];
inline bool cmp(Node a,Node b) { return a.val==b.val?a.j<b.j:a.val>b.val; }
inline void solve() {
	read(n);
	rep(i,1,n) read(du[i]);
	rep(i,1,n-1) rep(j,i+1,n) {
		if(du[i]>du[j]) a[++idx].i=i,a[idx].j=j,a[idx].val=du[i]-du[j];
		else a[++idx].i=j,a[idx].j=i,a[idx].val=du[j]-du[i];
	}
	std::sort(a+1,a+idx+1,cmp);
	rep(i,1,idx) {
		printf("? %lld %lld\n",a[i].i,a[i].j);
		fflush(stdout);
		scanf("%s",s+1);
		if(s[1]=='Y') {
			printf("! %lld %lld\n",a[i].i,a[i].j);
			fflush(stdout);
			return;
		}
	}
	puts("! 0 0");
	fflush(stdout);
}
signed main() {
	//int TEST; read(TEST); while(TEST--)
	solve();
}