#include <bits/stdc++.h>

using namespace std;

pair<int, int> dataarr[502];

int main() {
    int n;
    cin >> n;
    int minin = n, maxin = 0;
    for (int i = 1; i <= n; i++) {
        cin >> dataarr[i].first;
        dataarr[i].second = i;
        if (dataarr[i].first < minin) {
            minin = dataarr[i].first;
        }
        if (dataarr[i].first > maxin) {
            maxin = dataarr[i].first;
        }
    }
    int indif = maxin - minin;
    sort(dataarr, dataarr + (n + 1));
    for (int d = indif; d >= 0; d--) {
        for (int i = 1; i <= n; i++) {
            for (int j = i + 1; j <= n; j++) {
                if (dataarr[j].first - dataarr[i].first == d) {
                    cout << "? " << dataarr[j].second << ' ' << dataarr[i].second << endl;
                    string s;
                    cin >> s;
                    if (s == "Yes") {
                        cout << "! " << dataarr[j].second << ' ' << dataarr[i].second << endl;
                        return(0);
                    }
                }
            }
        }
    }
    cout << "! 0 0" << endl;
    return(0);
}
