#include <bits/stdc++.h>
using namespace std;
const int N = 100100;
int n, m;
vector<int> g[N], rg[N], G[N], scc[N];
int col[N], colc, vis[N], ord[N], ordSz, deg[N], q[N], topQ;
int query(int a, int b) {
  int ans;
  printf("? %d %d\n", a, b);
  fflush(stdout);
  scanf("%d", &ans);
  if (ans == -1) throw;
  return ans;
}
void dfs(int u) {
  vis[u] = 1;
  for (auto &v : g[u]) {
    if (!vis[v]) dfs(v);
  }
  ord[ordSz++] = u;
}
void dfscol(int u) {
  col[u] = colc;
  scc[colc].push_back(u);
  for (auto &v : rg[u]) {
    if (!col[v]) dfscol(v);
  }
}
void myFree(int u) {
  for (auto &v : G[u]) {
    deg[v]--;
    if (deg[v] == 0) q[topQ++] = v;
  }
}
int main() {
  int i, u, v, U, V;
  scanf("%d%d", &n, &m);
  for (i = 0; i < m; i++) {
    scanf("%d%d", &u, &v);
    g[u].push_back(v);
    rg[v].push_back(u);
  }
  for (i = 1; i <= n; i++)
    if (!vis[i]) dfs(i);
  for (i = ordSz - 1; i >= 0; i--) {
    u = ord[i];
    if (!col[u]) ++colc, dfscol(u);
  }
  for (i = 1; i <= n; i++)
    for (auto &v : g[i])
      if (col[i] != col[v]) G[col[i]].push_back(col[v]);
  for (i = 1; i <= colc; i++) {
    sort(G[i].begin(), G[i].end());
    G[i].resize(unique(G[i].begin(), G[i].end()) - G[i].begin());
    for (auto &v : G[i]) deg[v]++;
  }
  for (u = 1; u <= colc; u++)
    if (deg[u] == 0) q[topQ++] = u;
  V = q[0];
  for (i = 1; i < topQ; i++) {
    U = q[i];
    while (!scc[U].empty() && !scc[V].empty()) {
      if (query(scc[U].back(), scc[V].back()))
        scc[V].pop_back();
      else
        scc[U].pop_back();
    }
    if (!scc[U].empty()) swap(U, V);
    myFree(U);
  }
  printf("! %d\n", scc[V].back());
  fflush(stdout);
  return 0;
}
