/*
                                                  
  _|_|                              _|  _|    _|  
_|    _|  _|  _|_|  _|_|_|_|        _|  _|  _|    
_|    _|  _|_|          _|          _|  _|_|      
_|    _|  _|          _|      _|    _|  _|  _|    
  _|_|    _|        _|_|_|_|    _|_|    _|    _|  
                                                                                                    
*/ 
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<vector>
#include<queue>
#include<set>
//#define ls (rt<<1)
//#define rs (rt<<1|1)
#define vi vector<int>
#define pb push_back
#define mk make_pair
#define pii pair<int,int>
#define rep(i,a,b) for(int i=(a),i##end=(b);i<=i##end;i++)
#define fi first
#define se second
typedef long long ll;
using namespace std;
const int maxn=505;
pii ori[maxn];//<k,idx>
string s;
bool query(int a,int b){
	cout<<"? "<<a<<' '<<b<<endl;fflush(stdout);
	cin>>s;
	if(s[0]=='Y')return 1;
	else return 0;
}
int main(){
	ios::sync_with_stdio(0);
	int n;cin>>n;
	rep(i,1,n)ori[i].se=i,cin>>ori[i].fi;
	sort(ori+1,ori+1+n);
	for(int ans=n-1;ans>=0;ans--){
		rep(i,1,n){
			int idx=ori[i].se,val=ori[i].fi;
			for(int j=n;ori[j].fi-val>=ans&&j>i;j--){
			    if(ori[j].fi-val>ans)continue;
				if(query(ori[j].se,idx)){
					cout<<"! "<<ori[j].se<<' '<<idx;return 0;
				}
			}
		}
	}
	cout<<"! 0 0";
	return 0;
}
