#include <bits/stdc++.h>
using namespace std;
int n, m, num = 0, h[100010], dfn[100010], low[100010], dfnum = 0, scc = 0,
          bel[100010], q[100010], qh = 1, qt = 0, in[100010];
vector<int> a[100010];
struct edge {
  int fr, to, nxt;
} data[100010];
bool inq[100010];
stack<int> qq;
void tarjan(int x) {
  dfn[x] = low[x] = ++dfnum;
  qq.push(x);
  inq[x] = 1;
  for (int i = h[x]; i; i = data[i].nxt) {
    int y = data[i].to;
    if (!dfn[y])
      tarjan(y), low[x] = min(low[x], low[y]);
    else if (inq[y])
      low[x] = min(low[x], dfn[y]);
  }
  if (dfn[x] == low[x]) {
    ++scc;
    while (1) {
      int y = qq.top();
      qq.pop();
      inq[y] = 0;
      bel[y] = scc;
      a[scc].push_back(y);
      if (y == x) break;
    }
  }
}
inline void work(int x, int y) {
  while (1) {
    int xx = a[x].back(), yy = a[y].back();
    printf("? %d %d\n", xx, yy);
    fflush(stdout);
    int op;
    scanf("%d", &op);
    a[op ? y : x].pop_back();
    if (a[x].empty() || a[y].empty()) return;
  }
}
int main() {
  scanf("%d%d", &n, &m);
  while (m--) {
    int x, y;
    scanf("%d%d", &x, &y);
    data[++num].to = y;
    data[num].nxt = h[x];
    h[x] = num;
    data[num].fr = x;
  }
  for (int i = 1; i <= n; ++i)
    if (!dfn[i]) tarjan(i);
  memset(h, 0, sizeof(h));
  for (int i = 1; i <= num; ++i) {
    int x = data[i].fr, y = data[i].to;
    if (bel[x] == bel[y]) continue;
    in[bel[y]]++;
    data[i].fr = bel[x];
    data[i].to = bel[y];
    data[i].nxt = h[bel[x]];
    h[bel[x]] = i;
  }
  for (int i = 1; i <= scc; ++i)
    if (!in[i]) q[++qt] = i;
  int x = q[qh++];
  while (qh <= qt) {
    int y = q[qh++];
    work(x, y);
    if (a[x].empty()) {
      for (int i = h[x]; i; i = data[i].nxt) {
        int z = data[i].to;
        if (--in[z] == 0) q[++qt] = z;
      }
      x = y;
    } else {
      for (int i = h[y]; i; i = data[i].nxt) {
        int z = data[i].to;
        if (--in[z] == 0) q[++qt] = z;
      }
    }
  }
  printf("! %d\n", a[x].back());
  fflush(stdout);
  return 0;
}
