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

int n, a, num[505], up, cnt;

pair<int, int> p[505];

pair<int, pair<int, int>> pp[505*505];

char s[50];

int main(){
    cin >> n;
    for(int i = 1; i <= n; i++) cin >> a, p[i] = {a, i}, num[a]++;
    while(cnt <= up){
        up += num[cnt], cnt++;
    }
    sort(p + 1, p + 1 + n), cnt = 0;
    for(int i = 1; i <= n; i++) if(p[i].first > up){
        for(int j = n; j > i; j--) if(p[j].first > up){
            //cout<<i<<' '<<j<<endl;
            pp[++cnt] = {p[i].first - p[j].first, {p[j].second, p[i].second}};
        }
    }
    sort(pp + 1, pp + 1 + cnt);
    for(int i = 1; i <= cnt; i++){
        cout << '?' << ' ' << pp[i].second.first << ' ' << pp[i].second.second << endl, cout.flush();
        cin >> s;
        if(s[0] == 'Y'){
            cout << '!' << ' ' << pp[i].second.first << ' ' << pp[i].second.second << endl, cout.flush();
            return 0;
        }    
    }
    cout << "! 0 0" << endl, cout.flush();
    return 0;
}