/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author codelegend
 */

#include <fstream>
#include <iostream>

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<int, int>;
using VI = vector<int>;

void prec() {}

void solve(istream &cin, ostream &cout) {
  auto reach = [&](int u, int v) {
    cout << "? " << u << ' ' << v << '\n';
    string res;
    cin >> res;
    return res[0] == 'Y';
  };
  int n;
  cin >> n;
  VI indeg(n);
  for (int &x : indeg)
    cin >> x;
  vector<vector<PII>> ps(n);
  for (int u = 1; u <= n; u++) {
    for (int v = u + 1; v <= n; v++) {
      int gap = abs(indeg[u - 1] - indeg[v - 1]);
      ps[gap].emplace_back(u, v);
    }
  }
  for (int g = n - 1; g >= 0; g--) {
    for (auto [u, v] : ps[g]) {
      if (indeg[u - 1] > indeg[v - 1]) swap(u, v);
      if (reach(v, u)) {
        cout << "! " << u << ' ' << v << '\n';
        return;
      }
    }
  }
  cout << "! 0 0\n";
}

struct ETwoHouses {
  void solve(std::istream &in, std::ostream &out) {
#ifdef PRINT_CASE_NUMBERS
    case_num++;
    out << "Case #" << case_num << ": ";
#endif
    ::solve(in, out);
  }
};

int main() {
  prec();
  ETwoHouses solver;
  std::istream &in(std::cin);
  std::ostream &out(std::cout);
  solver.solve(in, out);
  return 0;
}
