#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
vector<int> a[N], c[N], f[N];
int d[N];
int vst[N], bel[N], low[N], ins[N];
int st[N], top, ind, cnt;
void Tarjan(int u) {
  vst[u] = low[u] = ++ind;
  ins[u] = 1, st[++top] = u;
  for (auto v : a[u]) {
    if (!vst[v]) {
      Tarjan(v);
      if (low[u] > low[v]) low[u] = low[v];
    } else if (ins[v]) {
      if (low[u] > vst[v]) low[u] = vst[v];
    }
  }
  if (vst[u] == low[u]) {
    cnt++;
    while (true) {
      bel[st[top]] = cnt;
      ins[st[top]] = 0;
      if (st[top--] == u) break;
    }
  }
}
int main() {
  int n, m, u, v, t;
  scanf("%d %d", &n, &m);
  while (m--) {
    scanf("%d %d", &u, &v);
    a[u].push_back(v);
  }
  for (int i = 1; i <= n; i++) {
    if (vst[i] == 0) {
      Tarjan(i);
    }
  }
  for (u = 1; u <= n; u++) {
    f[bel[u]].push_back(u);
    for (auto v : a[u]) {
      if (bel[u] != bel[v]) {
        c[bel[u]].push_back(bel[v]);
        d[bel[v]]++;
      }
    }
  }
  deque<int> q;
  for (int i = 1; i <= cnt; i++) {
    if (d[i] == 0) {
      q.push_back(i);
    }
  }
  while (q.size() > 1) {
    u = q.front();
    q.pop_front();
    v = q.front();
    q.pop_front();
    printf("? %d %d\n", f[u].back(), f[v].back());
    fflush(stdout);
    scanf("%d", &t);
    if (t) swap(u, v);
    q.push_front(v);
    f[u].pop_back();
    if (f[u].empty()) {
      for (auto v : c[u]) {
        d[v]--;
        if (d[v] == 0) {
          q.push_back(v);
        }
      }
    } else {
      q.push_front(u);
    }
  }
  printf("! %d\n", f[q.front()].back());
  fflush(stdout);
  return 0;
}
