#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int gi() {
  int x = 0, o = 1;
  char ch = getchar();
  while ((ch < '0' || ch > '9') && ch != '-') ch = getchar();
  if (ch == '-') o = -1, ch = getchar();
  while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
  return x * o;
}
int n, m;
vector<int> E[N], G[N], P[N];
int dfn[N], low[N], tim = 0, st[N], tp = 0, scc = 0, bel[N];
bool in[N];
void dfs(int u) {
  dfn[u] = low[u] = ++tim;
  st[++tp] = u;
  in[u] = 1;
  for (auto v : G[u]) {
    if (!dfn[v])
      dfs(v), low[u] = min(low[u], low[v]);
    else if (in[v])
      low[u] = min(low[u], dfn[v]);
  }
  if (low[u] == dfn[u]) {
    int v;
    ++scc;
    do v = st[tp--], bel[v] = scc, P[scc].push_back(v), in[v] = 0;
    while (u != v);
  }
}
int deg[N];
bool query(int u, int v) {
  printf("? %d %d\n", u, v);
  fflush(stdout);
  return gi();
}
void answer(int u) {
  printf("! %d\n", u);
  exit(0);
}
int main() {
  n = gi(), m = gi();
  for (int i = 1, u, v; i <= m; i++) u = gi(), v = gi(), G[u].push_back(v);
  for (int i = 1; i <= n; i++)
    if (!dfn[i]) dfs(i);
  for (int u = 1; u <= n; u++)
    for (auto v : G[u])
      if (bel[u] != bel[v]) E[bel[u]].push_back(bel[v]), ++deg[bel[v]];
  vector<int> free;
  for (int i = 1; i <= scc; i++)
    if (!deg[i]) free.push_back(i);
  int rt = free.size() - 1;
  auto erase = [&](int x) {
    P[free[x]].pop_back();
    if (P[free[x]].empty()) {
      if (rt > x) --rt;
      for (auto y : E[free[x]])
        if (!--deg[y]) free.push_back(y);
      free.erase(free.begin() + x);
    }
  };
  while (free.size() > 1) {
    int u = P[free[rt]].back(), v, fv;
    if (rt == free.size() - 1)
      v = P[free[free.size() - 2]].back(), fv = free.size() - 2;
    else
      v = P[free.back()].back(), fv = free.size() - 1;
    if (query(u, v))
      erase(fv);
    else
      swap(rt, fv), erase(fv);
  }
  answer(P[free[rt]].back());
  return 0;
}
