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

#define dbg(x...)             \
    do {                      \
        cout << #x << " -> "; \
        err(x);               \
    } while (0)

void err() {
    cout << endl;
}

template<class T, class... Ts>
void err(const T &arg, const Ts &... args) {
    cout << arg << ' ';
    err(args...);
}

#define fs first
#define sc second
#define pb push_back
typedef long long ll;
typedef pair<int, int> pi;

const int maxn = 505;
const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int mod = 1e9 + 7;

int in[maxn];

struct Query {
	int dif, u, v;
	bool operator < (const Query &tmp) const {
		return dif > tmp.dif;
	}
};

bool query(Query qi) {
	printf("? %d %d\n", qi.u, qi.v);
	fflush(stdout);
	char s[5];
	scanf("%s", s);
	return s[0] == 'Y';
}

void run() {
	int n;
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) {
		scanf("%d", in + i);
	}
	vector<Query> qv;
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++) {
			if (i == j || in[i] < in[j]) continue;
			qv.push_back({in[i] - in[j], i, j});
		}
	}
	sort(qv.begin(), qv.end());
	for (Query qi : qv) {
		if (query(qi)) {
			printf("! %d %d\n", qi.u, qi.v);
			fflush(stdout);
			return;
		}
	}
	puts("! 0 0");
	fflush(stdout);
}

int main() {
	
	int T = 1;
	// scanf("%d", &T);
	while (T--) {
		run();
	}

    return 0;
}