#include <bits/stdc++.h>
using namespace std;
#define forn(i,x,n) for(int i = x; i < n; ++i)

int main(){
	int n;
    string s;

    cin>>n;
    vector<int> k(n);
    map<int,vector<pair<int,int>>> m;
    forn(i,0,n)
    	cin>>k[i];

    forn(i,0,n)
    	forn(j,i+1,n)
    		if(k[i]>k[j])
    			m[abs(k[i]-k[j])].push_back({i,j});
    		else
    			m[abs(k[i]-k[j])].push_back({j,i});

    for(auto it=m.rbegin();it!=m.rend();it++)
    	for(auto [i,j]:it->second){
    		cout<<"? "<<i+1<<' '<<j+1<<endl;
    		cin>>s;
    		if(s=="Yes"){
    			cout<<"! "<<i+1<<' '<<j+1<<endl;
    			return 0;
    		}
    	}
    cout<<"! 0 0"<<endl;
    return 0;
}