#include <bits/stdc++.h>
#define rep(i, l, r) for(int i = (l); i <= (r); i++)
#define per(i, r, l) for(int i = (r); i >= (l); i--)
#define mem(a, b) memset(a, b, sizeof a)
#define For(i, l, r) for(int i = (l), i##e = (r); i < i##e; i++)
#define upd(a, b) (a = min(a, b))

using namespace std;
const int N = 1000;
char ch[N];
struct Qry {
	int x, y, v;
	bool operator <(const Qry& b)const { return v > b.v; }
} q[N * N];
vector <int> v[N];
int n, idx, k[N];
int main() {
	scanf("%d", &n);
	rep(i, 1, n) scanf("%d", &k[i]);
	rep(i, 1, n) rep(j, i + 1, n)
		q[++idx] = k[i] < k[j] ? (Qry){ j, i, k[j] - k[i] } : (Qry){ i, j, k[i] - k[j] };
	sort(q + 1, q + idx + 1);
	rep(i, 1, idx) {
		printf("? %d %d\n", q[i].x, q[i].y);
		fflush(stdout);
		scanf("%s", ch);
		if(ch[0] == 'Y')
			printf("! %d %d\n",q[i].x,q[i].y), fflush(stdout), exit(0);
	}
	puts("! 0 0"), fflush(stdout);
	return 0;
}