#include<bits/stdc++.h>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    int k[n],i,j;
    vector<int> g[n];
    for(i=0;i<n;i++) cin>>k[i];

    for(i=0;i<n;i++)
    for(j=i+1;j<n;j++)
    {
        int ab=abs(k[i]-k[j]);
        if(k[i]>k[j]) {g[ab].push_back(i+1); g[ab].push_back(j+1);}
        else {g[ab].push_back(j+1); g[ab].push_back(i+1);}
    }

    int ans[]={0,0};
    for(i=n-1;i>=0;i--)
    {
        for(j=0;j<g[i].size();j+=2)
        {
            int x=g[i][j],y=g[i][j+1];
            cout<<"? "<<x<<" "<<y<<"\n";
            cout.flush();
            string s;
            cin>>s;
            if(s[0]=='Y') {ans[0]=x; ans[1]=y; break;}
        }
        if(ans[0]!=0) break;
    }
    cout<<"! "<<ans[0]<<" "<<ans[1]<<"\n";
    return 0;
}