#include<bits/stdc++.h>
using namespace std;
int read() {
	char c=getchar(); int x=0,f=1;
	while (c<'0' || c>'9') {
		if (c=='-') f=-1;
		c=getchar();
	}
	while (c>='0' && c<='9') {
		x=x*10+c-'0';
		c=getchar();
	}
	return x*f;
}
char s[100];
int k[505];
vector< pair<int,pair<int,int> > > vec; 
bool query(int x,int y) {
	printf("? %d %d\n", x, y);
	fflush(stdout);
	scanf("%s", s);
	if (s[0]=='Y') return true;
	else return false;
}
int main() {
	int n=read();
	for (int i=1; i<=n; i++) k[i]=read();
	for (int i=1; i<=n; i++) {
		for (int j=i+1; j<=n; j++) {
			vec.push_back(make_pair(-abs(k[i]-k[j]),make_pair(i,j)));
		}
	}
	sort(vec.begin(),vec.end());
	for (auto p:vec) {
		int x=p.second.first,y=p.second.second;
		if (k[x]<k[y]) swap(x,y);
		if (query(x,y)) {
			printf("! %d %d\n", x, y);
			fflush(stdout);
			exit(0);
		}
	}
	printf("! 0 0\n");
	fflush(stdout);
	return 0;
}
