#include<bits/stdc++.h>
using namespace std;
const int N = 500 + 10;
int n;
int k[N];
int a[N * N], b[N * N], id[N * N];

int cmp(int x, int y) { return abs(k[a[x]] - k[b[x]]) > abs(k[a[y]] - k[b[y]]); }

int main() {
	cin >> n;
	for(int i = 1; i <= n; i++) cin >> k[i];
	int m = 0;
	for(int i = 1; i <= n; i++) for(int j = i + 1; j <= n; j++) a[++m] = i, b[m] = j, id[m] = m;
	sort(id + 1, id + m + 1, cmp);
	for(int i = 1; i <= m; i++) {
		if(k[a[id[i]]] < k[b[id[i]]]) swap(a[id[i]], b[id[i]]);
		cout << "? " << a[id[i]] <<" " << b[id[i]] << endl;
		string res;
		cin >> res;
		if(res == "Yes") return cout << "! " << a[id[i]] <<" " << b[id[i]] << endl, 0;
	}
	cout << "! " << 0 <<" " << 0 << endl;
	return 0;
}