#include<bits/stdc++.h>
using namespace std;
#define i64 int64_t
#define i32 int32_t
#define ll long long int
#define pb push_back
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define pii pair<int,int>
#define sz(x) ((int)x.size())
template<typename T, typename U> inline void amin(T &a,U b) { a = (a > b ? b : a);}
template<typename T, typename U> inline void amax(T &a,U b) { a = (a > b ? a : b);}

bool ask(int i, int j) {
    cout << "? " << i+1 << " " << j+1 << endl;
    string res;
    cin >> res;
    return res == "Yes";
}

void solve(){
    int n;
    cin >> n;
    vector<int> indeg(n, 0);
    // while(cin >> x >> y) {
    //     if(x == 0) break;
    //     ++indeg[y - 1];
    // }
    for(int i = 0; i < n; ++i) {
        cin >> indeg[i];
    }
    
    priority_queue<array<int,3>> pq;
    for(int i = 0; i < n; ++i) {
        for(int j = 0; j < n; ++j) {
            if(i == j) continue;
            if(indeg[i] == 0 or indeg[j] == 0) continue;
            pq.push({abs(indeg[j] - indeg[i]), i, j});
        }
    }

    while(!pq.empty()) {
        int f = pq.top()[1];
        int s = pq.top()[2];
        pq.pop();
        if(indeg[f] < indeg[s]) swap(f, s);
        if(ask(f, s)) {
            cout << "! " << f + 1 << " " << s + 1 << endl;
            exit(0);
        }
    }
    cout << "! " << "0 0" << endl;
}

int main()
{
    int tests = 1; 
    // cin >> tests;
    while(tests--){
       solve(); 
    }
    #ifdef LOCAL_DEFINE
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
    #endif
}
/* stuff you should look for
    * int overflow, array bounds
    * special cases (n=1?)
    * DON'T GET STUCK ON ONE APPROACH
*/