#include <bits/stdc++.h>
using namespace std;
vector<int> top;
vector<vector<int>> g, rev_g, s;
vector<set<int>> h;
vector<int> c;
vector<bool> used;
int cnt = 0;
void top_sort(int v) {
  used[v] = true;
  for (int u : g[v]) {
    if (!used[u]) {
      top_sort(u);
    }
  }
  top.push_back(v);
}
void dfs(int v) {
  used[v] = true;
  c[v] = cnt;
  s.back().push_back(v);
  for (int u : rev_g[v]) {
    if (!used[u]) {
      dfs(u);
    }
  }
}
int main() {
  int n, m;
  cin >> n >> m;
  g.resize(n);
  rev_g.resize(n);
  c.resize(n);
  used.resize(n);
  for (int i = 0; i < m; i++) {
    int from, to;
    cin >> from >> to;
    from--;
    to--;
    g[from].push_back(to);
    rev_g[to].push_back(from);
  }
  for (int i = 0; i < n; i++) {
    if (!used[i]) {
      top_sort(i);
    }
  }
  used.assign(n, false);
  for (int i = n - 1; i >= 0; i--) {
    if (!used[top[i]]) {
      s.push_back(vector<int>());
      dfs(top[i]);
      cnt++;
    }
  }
  h.resize(cnt);
  for (int i = 0; i < cnt; i++) {
    for (int v : s[i]) {
      for (int u : g[v]) {
        if (c[v] != c[u]) {
          h[c[v]].insert(c[u]);
        }
      }
    }
  }
  vector<int> in(cnt), q;
  for (int v = 0; v < cnt; v++) {
    for (int node : h[v]) {
      in[node]++;
    }
  }
  for (int v = 0; v < cnt; v++) {
    if (!in[v]) {
      q.push_back(v);
    }
  }
  int ans = q.back();
  q.pop_back();
  while (!q.empty()) {
    int v = q.back();
    q.pop_back();
    while (!s[ans].empty() && !s[v].empty()) {
      cout << "? " << s[ans].back() + 1 << " " << s[v].back() + 1 << endl;
      int res;
      cin >> res;
      if (!res) swap(ans, v);
      s[v].pop_back();
    }
    if (s[ans].empty()) swap(ans, v);
    for (int u : h[v]) {
      in[u]--;
      if (!in[u]) {
        q.push_back(u);
      }
    }
  }
  cout << "! " << s[ans][0] + 1;
}
