#include <bits/stdc++.h>
using namespace std;
#define sc(x) scanf("%d", &(x))
#define sclld(x) scanf("%lld", &(x))
#define sz(x) int((x).size())
#define all(x) (x).begin(), (x).end()
#define MT make_tuple
#define MP make_pair
#define lastOne(x) (31 - __builtin_clz(x))
#define debug(x) cout<<(#x)<<": \""<<x<<"\""<<endl
#define debugVec(vec) cout<<(#vec)<<": "; for (auto& i: vec) cout<<i<<" "; cout<<endl

typedef long long ll;
typedef pair<int, int> ii;
const double PI = 2*acos(0); 
const double EPS =  1e-9;
const int oo = 2e9;
const ll OO = 1e18;
const ll MOD = 1e9+7;

const int N = 3e5+5;
char in[5];

bool query(int a, int b)
{
    printf("? %d %d\n", a+1, b+1);
    fflush(stdout);
    scanf("%s", in);
    string s = in;
    if (s == "Yes")
        return 1;
    return 0;
}

void ansQuery(int a, int b)
{
    printf("! %d %d\n", a+1, b+1);
    fflush(stdout);
}

int main() 
{
    int n;
    sc(n);
    vector<int> deg(n);
    vector<ii> edges(n*(n-1)/2);
    for (int i = 0; i < n; i++)
        sc(deg[i]);

    for (int i = 0, idx = 0; i < n; i++)
        for (int j = i+1; j < n; j++)
            edges[idx++] = {i, j};
    
    sort(all(edges), [&deg](const ii& a, const ii& b){
        return abs(deg[a.first]-deg[a.second]) > abs(deg[b.first]-deg[b.second]);
    });

    ii ans = {-1, -1};
    for (int i = 0; i < sz(edges); i++)
    {
        int a, b;
        tie(a, b) = edges[i];
        if (deg[a] < deg[b])
            swap(a, b);
        if(query(a, b))
        {
            ans = {a, b};
            break;
        }
    }
    ansQuery(ans.first, ans.second);
    return 0;
}