#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int n, m, x[N], y[N], cnt, head[N];
int dfn[N], low[N], stk[N], bel[N], top, clk, scc, rd[N];
vector<int> V[N];
int q[N], Head[N];
set<int> S[N];
struct edge {
  int to, nxt;
} e[N << 1];
void adde(int *head, int x, int y) {
  e[++cnt].to = y;
  e[cnt].nxt = head[x];
  head[x] = cnt;
}
void tarjan(int u) {
  dfn[u] = low[u] = ++clk;
  stk[++top] = u;
  for (int i = head[u], v; i; i = e[i].nxt)
    if (v = e[i].to, !dfn[v]) {
      tarjan(v);
      low[u] = min(low[u], low[v]);
    } else if (!bel[v])
      low[u] = min(low[u], dfn[v]);
  if (dfn[u] != low[u]) return;
  ++scc;
  while (stk[top] != u) V[scc].push_back(stk[top]), bel[stk[top--]] = scc;
  V[scc].push_back(stk[top]), bel[stk[top--]] = scc;
}
int ask(int x, int y) {
  printf("? %d %d\n", x, y), fflush(stdout);
  scanf("%d", &x);
  return x;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = (1); i <= (m); i++)
    scanf("%d%d", &x[i], &y[i]), adde(head, x[i], y[i]);
  for (int i = (1); i <= (n); i++)
    if (!dfn[i]) tarjan(i);
  for (int i = (1); i <= (m); i++)
    if (bel[x[i]] != bel[y[i]] && !S[bel[x[i]]].count(bel[y[i]])) {
      adde(Head, bel[x[i]], bel[y[i]]);
      rd[bel[y[i]]]++, S[bel[x[i]]].insert(bel[y[i]]);
    }
  int tail = 0;
  for (int i = (1); i <= (scc); i++)
    if (!rd[i]) q[++tail] = i;
  while (tail > 1) {
    int x = V[q[1]].back(), y = V[q[2]].back();
    if (!ask(x, y)) swap(q[1], q[2]);
    x = q[2];
    V[x].pop_back();
    if (V[x].empty()) {
      swap(q[tail], q[2]), tail--;
      for (int i = Head[x], v; i; i = e[i].nxt)
        if (v = e[i].to, !--rd[v]) q[++tail] = v;
    }
  }
  printf("! %d\n", V[q[1]].back()), fflush(stdout);
  return 0;
}
