#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<vector<int> > adj(n);
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    adj[--u].push_back(--v);
  }
  vector<int> dfn(n), low(n), belong(n), stk;
  vector<vector<int> > vec;
  vector<bool> in_stk(n);
  int timer = 0;
  function<void(int)> tarjan = [&](int u) {
    dfn[u] = low[u] = ++timer;
    stk.push_back(u);
    in_stk[u] = true;
    for (int v : adj[u]) {
      if (!dfn[v]) {
        tarjan(v);
        low[u] = min(low[u], low[v]);
      } else if (in_stk[v]) {
        low[u] = min(low[u], dfn[v]);
      }
    }
    if (low[u] >= dfn[u]) {
      vec.push_back(vector<int>());
      while (true) {
        int v = stk.back();
        stk.pop_back();
        belong[v] = vec.size() - 1;
        vec.back().push_back(v);
        in_stk[v] = false;
        if (v == u) {
          break;
        }
      }
    }
  };
  for (int i = 0; i < n; i++) {
    if (!dfn[i]) {
      tarjan(i);
    }
  }
  vector<vector<int> > graph(vec.size());
  vector<int> degree(vec.size());
  for (int u = 0; u < n; u++) {
    for (int v : adj[u]) {
      if (belong[u] != belong[v]) {
        graph[belong[u]].push_back(belong[v]);
        degree[belong[v]]++;
      }
    }
  }
  vector<int> que;
  for (int u = 0; u < vec.size(); u++) {
    if (!degree[u]) {
      que.push_back(u);
    }
  }
  for (int i = 0; i + 1 < que.size(); i++) {
    int u = que[i], v = que[i + 1];
    cout << "? " << vec[u].back() + 1 << " " << vec[v].back() + 1 << endl;
    bool direction;
    cin >> direction;
    if (!direction) {
      swap(u, v);
    }
    que[i + 1] = u;
    vec[v].pop_back();
    if (vec[v].empty()) {
      for (int p : graph[v]) {
        degree[p]--;
        if (!degree[p]) {
          que.push_back(p);
        }
      }
    } else {
      que[i] = v;
      i--;
    }
  }
  cout << "! " << vec[que.back()].back() + 1 << endl;
  return 0;
}
