#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <cstring>

using namespace std;

const int N = 510;
int g[N];

struct node {
    int x, y, sub;
};

vector<node> vec;

int main() {
    int n;
    cin >> n;
    for (int i = 1; i <= n; ++i) {
        cin >> g[i];
    }
    for (int i = 1; i <= n; ++i) {
        for (int j = 1; j <= n; ++j) {
            if (j == i) continue;
            if (g[i] >= g[j]) {
                vec.push_back({i, j, g[i] - g[j]});
            }
        }
    }
    sort(vec.begin(), vec.end(), [](node a, node b) { return a.sub > b.sub; });

    int siz = vec.size();
    for (int i = 0; i < siz; ++i) {
        cout << "? " << vec[i].x << " " << vec[i].y << endl;
        cout.flush();
        string s;
        cin >> s;
        if (s == "Yes") {
            cout << "! " << vec[i].x << " " << vec[i].y << endl;
            return 0;
        }
    }
    cout << "! 0 0";
    return 0;

}

