#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
int n, m, dfn[N], i, u, v, low[N], sta[N], top, insta[N], tot, c[N], pts[N], l,
    r, q[N], k;
vector<int> g[N], p[N], e[N];
void dfs(int i) {
  sta[++top] = i;
  insta[i] = 1;
  dfn[i] = ++k;
  low[i] = k;
  for (auto j : g[i])
    if (!dfn[j]) {
      dfs(j);
      low[i] = min(low[i], low[j]);
    } else if (insta[j])
      low[i] = min(low[i], dfn[j]);
  if (dfn[i] == low[i]) {
    ++tot;
    int j;
    for (j = top;; --j) {
      insta[sta[j]] = 0;
      c[sta[j]] = tot;
      if (sta[j] == i) break;
    }
    top = j - 1;
  }
}
int Ask(int u, int v) {
  cout << "? " << u << ' ' << v << endl;
  int d;
  scanf("%d", &d);
  d ^= 1;
  return d;
}
int main() {
  scanf("%d %d", &n, &m);
  for (i = 1; i <= m; ++i) {
    scanf("%d %d", &u, &v);
    swap(u, v);
    g[u].push_back(v);
  }
  k = 0;
  for (i = 1; i <= n; ++i)
    if (!dfn[i]) dfs(i);
  for (i = 1; i <= n; ++i) {
    e[c[i]].push_back(i);
    for (auto j : g[i])
      if (c[j] != c[i]) {
        p[c[j]].push_back(c[i]);
        ++pts[c[i]];
      }
  }
  for (i = 1; i <= tot; ++i)
    if (!pts[i]) q[++r] = i;
  while (l < r) {
    while (!e[q[l]].empty() && !e[q[l + 1]].empty())
      if (Ask(*e[q[l]].rbegin(), *e[q[l + 1]].rbegin()))
        e[q[l]].pop_back();
      else
        e[q[l + 1]].pop_back();
    if (e[q[l]].empty())
      for (auto j : p[q[l]]) {
        --pts[j];
        if (!pts[j]) q[++r] = j;
      }
    else
      for (auto j : p[q[l + 1]]) {
        --pts[j];
        if (!pts[j]) q[++r] = j;
      }
    ++l;
    if (e[q[l]].empty()) q[l] = q[l - 1];
  }
  cout << "! " << *e[q[l]].rbegin() << endl;
}
