#include <bits/stdc++.h>
using namespace std;
const int maxN = 1e5 + 9, maxV = 536, MOD = 1e9 + 7, AND = (1 << 20) - 1,
          lg = 21;
vector<int> farg[maxN], adj[maxN], adjc[maxN], elems[maxN];
int incom[maxN], comp[maxN], idx;
set<pair<int, int> > mys;
stack<int> stc;
bool vi[maxN];
void dfs(int nd) {
  if (vi[nd]) return;
  vi[nd] = 1;
  for (int sn : adj[nd]) dfs(sn);
  stc.push(nd);
}
void sfd(int nd) {
  if (vi[nd]) return;
  vi[nd] = 1;
  for (int sn : farg[nd]) sfd(sn);
  comp[nd] = idx;
  elems[idx].push_back(nd);
}
bool makeQuery(int a, int b) {
  cout << "? " << a + 1 << ' ' << b + 1 << '\n';
  cout.flush();
  int ans;
  cin >> ans;
  return ans == 1;
}
void procesavec(vector<int> &one, vector<int> &two) {
  while (one.size() && two.size()) {
    if (makeQuery(one.back(), two.back())) {
      two.pop_back();
    } else {
      one.pop_back();
    }
  }
}
int n, m;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  for (int u, v, i = 0; i < m; i++) {
    cin >> u >> v;
    u--;
    v--;
    adj[u].push_back(v);
    farg[v].push_back(u);
  }
  for (int i = 0; i < n; i++) dfs(i);
  memset(vi, 0, sizeof vi);
  while (stc.size()) {
    while (stc.size() && vi[stc.top()]) stc.pop();
    if (stc.empty()) break;
    sfd(stc.top());
    idx++;
  }
  for (int i = 0; i < n; i++) {
    for (int to : adj[i]) {
      if (comp[to] == comp[i]) continue;
      incom[comp[to]]++;
      adjc[comp[i]].push_back(comp[to]);
    }
  }
  for (int i = 0; i < idx; i++) {
    mys.insert(pair<int, int>(incom[i], i));
  }
  int nd = mys.begin()->second;
  mys.erase(mys.begin());
  while (mys.size() && mys.begin()->first == 0) {
    int frontup = mys.begin()->second;
    mys.erase(pair<int, int>(incom[frontup], frontup));
    procesavec(elems[nd], elems[frontup]);
    if (elems[nd].empty()) swap(nd, frontup);
    for (int cmp : adjc[frontup]) {
      mys.erase(pair<int, int>(incom[cmp]--, cmp));
      mys.insert(pair<int, int>(incom[cmp], cmp));
    }
  }
  cout << "! " << elems[nd].back() + 1 << '\n';
}
