#include <bits/stdc++.h>
#define mk make_pair
#define fs first
#define sc second
using namespace std;
typedef long long ll;
typedef long double ld;
const int N=510;
int a[N];
int n, m;
vector<pair<int,int>> v[N];
int main(){
	scanf("%d",&n);
	for(int i=1; i<=n; ++i){
		scanf("%d",a+i);
		for(int j=1; j<i; ++j){
			v[abs(a[i]-a[j])].push_back(mk(i,j));
		}
	}
	int ans1 = 0, ans2 = 0;
	char s[11];
	for(int i=n; i>=0; --i){
		for(auto it:v[i]){
			if(a[it.fs]<a[it.sc]){
				swap(it.fs, it.sc);
			}
			printf("? %d %d\n",it.fs, it.sc);
			cout.flush();
			scanf("%s",s);
			if(s[0]=='Y'){
				ans1 = it.fs;
				ans2 = it.sc;
				break;
			}
		}
		if(ans1){
			break;
		}
	}
	printf("! %d %d\n",ans1, ans2);
}