#include<bits/stdc++.h>
using namespace std;

typedef long long ll;

const int N = 5e2 + 30;
int a[N];
bool seen[N][N];
vector<pair<int, int>> vt;

bool compa(pair<int, int> p1, pair<int, int> p2)
{
	return abs(a[p1.first] - a[p1.second]) > abs(a[p2.first] - a[p2.second]);
}

int main()
{
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) cin >> a[i];
	for (int i = 0; i < n; i++)
	{
		for (int j = i + 1; j < n; j++)
		{
			vt.push_back({i, j});
		}
	}
	sort(vt.begin(), vt.end(), compa);
	for (auto [u, v] : vt)
	{
		if (a[u] > a[v]) swap(u, v);
		cout << "? " << v + 1 << " " << u + 1 << endl;
		assert(!(seen[u][v] || seen[v][u]));
		seen[v][u] = seen[u][v] = true;
		string s;
		cin >> s;
		if (s == "Yes")
		{
			cout << "! " << u + 1 << " " << v + 1 << endl;
			return 0;
		}
	}
	cout << "! 0 0" << endl;
	return 0;
}
