/* Code Information
 * Author: Skqliao
 * Time: 2021-04-07 15:17:56
**/

#include <bits/stdc++.h>

using namespace std;

const int MAXN = 500 + 5;

int N;
int D[MAXN];
struct Node {
    int x, y, z;
};
vector<Node> v;
char ans[5];

bool ask(int x, int y) {
    printf("? %d %d\n", x, y);
    fflush(stdout);
    scanf("%s", ans);
    return ans[0] == 'Y';
}

int main() {
    scanf("%d", &N);
    for (int i = 1; i <= N; ++i) {
        scanf("%d", &D[i]);
        for (int j = 1; j < i; ++j) {
            if (D[i] > D[j]) v.push_back({i, j, D[i] - D[j]});
            else v.push_back({j, i, D[j] - D[i]});
        }
    }
    sort(v.begin(), v.end(), [](Node &a, Node &b) {return a.z > b.z; });
    for (auto x : v) {
        if (ask(x.x, x.y)) {
            printf("! %d %d\n", x.x, x.y);
            return 0;
        }
    }
    printf("! 0 0\n");
    return 0;
}