#include <bits/stdc++.h>
using namespace std;
const int N = 110000;
int hd[N], nxt[N], to[N], dfn[N], low[N], scc[N], dgrV[N], dgrS[N], stck[N],
    instck[N], rep[N];
int n, m, cnt, tot, noedg = 1, top;
queue<int> que;
template <class T>
inline void read(T &x) {
  x = 0;
  char ch = getchar(), w = 0;
  while (!isdigit(ch)) w = (ch == '-'), ch = getchar();
  while (isdigit(ch)) x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();
  x = w ? -x : x;
  return;
}
inline void addEdg(int x, int y) {
  nxt[++noedg] = hd[x], hd[x] = noedg, to[noedg] = y;
  return;
}
void tarjan(int now) {
  dfn[now] = low[now] = ++cnt;
  stck[++top] = now, instck[now] = 1;
  for (register int i = hd[now]; i; i = nxt[i]) {
    int v = to[i];
    if (dfn[v]) {
      if (instck[v]) low[now] = min(low[now], dfn[v]);
    } else
      tarjan(v), low[now] = min(low[now], low[v]);
  }
  if (dfn[now] == low[now]) {
    rep[++tot] = now;
    while (stck[top] != now) instck[stck[top]] = 0, scc[stck[top--]] = tot;
    instck[now] = 0, scc[stck[top--]] = tot;
  }
  return;
}
inline void del(int x) {
  for (register int i = hd[x], v; i; i = nxt[i]) {
    if (scc[v = to[i]] != scc[x]) {
      if (!--dgrS[scc[v]]) que.push(rep[scc[v]]);
    } else if (!--dgrV[v] && v != rep[scc[v]])
      que.push(v);
  }
  return;
}
int main() {
  int x, y;
  read(n), read(m);
  for (register int i = 1; i <= m; ++i) read(x), read(y), addEdg(x, y);
  for (register int i = 1; i <= n; ++i)
    if (!dfn[i]) tarjan(i);
  for (register int i = 1; i <= n; ++i)
    for (register int j = hd[i], v; j; j = nxt[j])
      if (scc[v = to[j]] != scc[i])
        ++dgrS[scc[v]];
      else
        ++dgrV[v];
  for (register int i = 1; i <= tot; ++i)
    if (!dgrS[i]) que.push(rep[i]);
  while (que.size()) {
    if (que.size() == 1) {
      cout << "! " << que.front() << endl;
      return 0;
    }
    int a = que.front(), b;
    que.pop(), b = que.front(), que.pop();
    cout << "? " << a << ' ' << b << endl;
    read(x);
    if (x)
      del(b), que.push(a);
    else
      del(a), que.push(b);
  }
  return 0;
}
