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

template<typename A, typename B>
string to_string(pair<A, B> p);

template<typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);

template<typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);

string to_string(const string &s) {
	return '"' + s + '"';
}

string to_string(const char *s) {
	return to_string((string) s);
}

string to_string(bool b) {
	return (b ? "true" : "false");
}

string to_string(vector<bool> v) {
	bool first = true;
	string res = "{";
	for (int i = 0; i < static_cast<int>(v.size()); i++) {
		if (!first) {
			res += ", ";
		}
		first = false;
		res += to_string(v[i]);
	}
	res += "}";
	return res;
}

template<size_t N>
string to_string(bitset<N> v) {
	string res = "";
	for (size_t i = 0; i < N; i++) {
		res += static_cast<char>('0' + v[i]);
	}
	return res;
}

template<typename A>
string to_string(A v) {
	bool first = true;
	string res = "{";
	for (const auto &x : v) {
		if (!first) {
			res += ", ";
		}
		first = false;
		res += to_string(x);
	}
	res += "}";
	return res;
}

template<typename A, typename B>
string to_string(pair<A, B> p) {
	return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template<typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
	return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", "
			+ to_string(get<2>(p)) + ")";
}

template<typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
	return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", "
			+ to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}

void dbg_out() {
	cout << endl;
}

template<typename Head, typename ... Tail>
void dbg_out(Head H, Tail ... T) {
	cout << " " << to_string(H);
	dbg_out(T...);
}

#ifndef ONLINE_JUDGE
#define dbg(...) cout << "[" << #__VA_ARGS__ << "]:", dbg_out(__VA_ARGS__)
#else
#define dbg(...) ;
#endif

#define import ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define read(x) cin >> x
#define out(x) cout << x
#define readInt(x) scanf("%d",&x)
#define readLong(x) scanf("%lld",&x)
#define readDouble(x) scanf("%Lf",&x)
#define readString(x) scanf("%s",&x)
#define outInt(x) printf("%d",x)
#define outLong(x) printf("%lld",x)
#define outDouble(x) printf("%Lf",x)
#define outString(x) printf("%s",x)
#define outLine(x) cout << x << endl
#define readArr(x,size) for(int i=0;i<size;i++)read(x[i])
#define outArr(x,size) for(int i=0;i<size;i++){cout << x[i] << " ";}out(endl)
#define ll long long
#define ld long double
#define pii pair<int,int>
#define len(s) (int)(s.length())
#define bitCnt(msk) __builtin_popcount(msk)
#define ff first
#define ss second
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int mrand(int a) {
	return rng() % a;
}


void test_case() {
	int n;
	cin >> n;
	vector<pair<int,int>>deg(n);
	for(int i=0;i<n;i++){
		int x;
		cin >> x;
		deg[i]=make_pair(x,i);
	}
	sort(deg.begin(),deg.end());
	vector<pair<int,pair<int,int>>>arr(n*(n-1)/2);
	int idx=0;
	for(int c=n-1;c>=0;c--) {
		int i=deg[c].second;
		for(int o=0;o<c;o++) {
			int j=deg[o].second;
			pair<int,pair<int,int>>zz;
			zz.first=-deg[c].first+deg[o].first;
			zz.second=make_pair(i, j);
			arr[idx++]=zz;
		}
	}
	sort(arr.begin(),arr.end());
	for(int c=0;c<arr.size();c++) {
		int i=arr[c].second.first,j=arr[c].second.second;
		cout << "? " << i+1 << " " << j+1 << endl;
		string s;
		cin >> s;
		if(s[0]=='Y') {
			cout << "! " << i+1 << " " << j+1 << endl;
			return;
		}

	}

	cout << "! 0 0" << endl;
}

int main() {
	import;
//	int tc = 1;
//	readInt(tc);
//	while (tc--)
		test_case();
	return 0;
}
