#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 7, M = 1e5 + 7;
int head[N], nxt[M], to[M];
int nhead[N], nnxt[M], nto[M];
int dfn[N], low[N], in[N], st[N], bel[N];
int cnt[N], q[N * 4];
vector<int> vec[N];
inline void ade(int x, int y) {
  nxt[++nxt[0]] = head[x];
  head[x] = nxt[0];
  to[nxt[0]] = y;
}
inline void adn(int x, int y) {
  nnxt[++nnxt[0]] = nhead[x];
  nhead[x] = nnxt[0];
  nto[nnxt[0]] = y;
  cnt[y]++;
}
void dfs(int x) {
  dfn[x] = low[x] = ++dfn[0];
  in[x] = 1;
  st[++st[0]] = x;
  for (int now = head[x]; now; now = nxt[now]) {
    if (!dfn[to[now]])
      dfs(to[now]), low[x] = min(low[x], low[to[now]]);
    else if (in[to[now]])
      low[x] = min(low[x], dfn[to[now]]);
  }
  if (dfn[x] == low[x]) {
    bel[0]++;
    int tmp;
    do {
      tmp = st[st[0]--];
      bel[tmp] = bel[0];
      vec[bel[0]].push_back(tmp);
      in[tmp] = 0;
    } while (tmp != x);
  }
}
void win(int x) {
  printf("! %d\n", x);
  exit(0);
}
bool qry(int x, int y) {
  printf("? %d %d\n", x, y);
  fflush(stdout);
  int res;
  scanf("%d", &res);
  if (res == -1) exit(0);
  return res;
}
int main() {
  int n, m, i, x, y, ti = 0, he = 1, rt, tmp, now, last;
  scanf("%d%d", &n, &m);
  for (i = 1; i <= m; i++) {
    scanf("%d%d", &x, &y);
    ade(x, y);
  }
  for (i = 1; i <= n; i++)
    if (!dfn[i]) dfs(i);
  for (i = 1; i <= n; i++)
    for (now = head[i]; now; now = nxt[now])
      if (bel[i] != bel[to[now]]) {
        adn(bel[i], bel[to[now]]);
      }
  for (i = 1; i <= bel[0]; i++) {
    if (cnt[i] == 0) q[++ti] = i;
  }
  if (ti == 1) win(vec[q[ti]][0]);
  rt = vec[q[he]].back();
  vec[q[he]].pop_back();
  he++;
  while (he <= ti) {
    tmp = q[he++];
    last = 0;
    while (vec[tmp].size()) {
      if (qry(rt, vec[tmp].back())) {
        vec[tmp].pop_back();
      } else {
        last = rt;
        rt = vec[tmp].back();
        vec[tmp].pop_back();
        break;
      }
    }
    if (last)
      q[++ti] = bel[last];
    else {
      for (now = nhead[tmp]; now; now = nnxt[now]) {
        cnt[nto[now]]--;
        if (cnt[nto[now]] == 0) q[++ti] = nto[now];
      }
    }
  }
  win(rt);
  return 0;
}
