#include <bits/stdc++.h>
#define f(c,a,b) for(int c=a; c<=b; c++)
#define N 5000010
#define pii pair<int,int>
#define mp make_pair
#define fi first
#define se second
#define sl (u<<1)
#define sr ((u<<1)+1)
#define pb push_back

using namespace std;
typedef double db;
typedef long long ll;
struct node{
	int u,v,x;
	bool operator < (const node& a) const{ return x<a.x; }
}b[N];
int k[N];

bool ask(int i,int j){
	cout<<"? "<<i<<' '<<j<<endl;
	string ans;
	cin>>ans;
	if(ans=="Yes") return true; else return false;
}

int main(){
	// freopen("owo.in","r",stdin);
	// ios::sync_with_stdio(false);
	// cin.tie(nullptr);
	int n;
	cin >> n;
	f(i,1,n) cin>>k[i];
	int id=0;
	f(i,1,n){
		f(j,i+1,n){
			b[++id] = (node){ i,j,abs(k[i]-k[j]) };
		}
	}
	sort(b+1,b+id+1);
	for(int i=id; i>=1; i--) {
		int ti=b[i].u, tj=b[i].v;
		if(k[ti]>k[tj]) {
			if(ask(ti,tj)){
				cout<<"! "<<ti<<' '<<tj<<endl;
				return 0;
			}
		}else{
			if(ask(tj,ti)){
				cout<<"! "<<ti<<' '<<tj<<endl;
				return 0;
			}	
		}
	}
	cout<<"! "<<0<<' '<<0<<endl;
	return 0;
}