#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;

int in[5100];
vector<pair<int, pair<int, int> > > v;

int main(){
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++){
		cin >> in[i];
	}
	
	for (int i = 1; i <= n; i++){
		for (int j = i + 1; j <= n; j++){
			if (in[i] > in[j])	v.push_back({in[i] - in[j], {i, j}});
			else				v.push_back({in[j] - in[i], {j, i}});
		}
	}
	
	sort(v.rbegin(), v.rend());
	for (int i = 0; i < v.size(); i++){
		int a = v[i].second.first;
		int b = v[i].second.second;
		cout << "? " << a << " " << b << endl;
		cout.flush();
		string s;
		cin >> s;
		if (s == "Yes"){
			printf("! %d %d\n", a, b);
			cout.flush();
			return 0;
		}
	}
	printf("! 0 0\n");
	return 0;
	
} 
