#include <bits/stdc++.h>
using namespace std;
struct Edge {
  int t, next;
  Edge() {}
  Edge(int a, int b) : t(a), next(b) {}
};
Edge e[200005];
int head[100005];
vector<int> g[100005];
queue<int> bel[100005];
int d[100005], scc_cnt;
namespace Graph {
int dfn[100005], low[100005], dfs_cnt;
int st[100005], top;
bool in[100005];
int id[100005];
void dfs(int x) {
  dfn[x] = low[x] = ++dfs_cnt;
  st[++top] = x;
  in[x] = 1;
  for (int i = head[x]; i; i = e[i].next) {
    int u = e[i].t;
    if (!dfn[u]) {
      dfs(u);
      low[x] = min(low[x], low[u]);
    } else if (in[u])
      low[x] = min(low[x], dfn[u]);
  }
  if (low[x] >= dfn[x]) {
    scc_cnt++;
    int t;
    do {
      t = st[top--];
      in[t] = 0;
      id[t] = scc_cnt;
      bel[scc_cnt].push(t);
    } while (t != x);
  }
}
void build(int n) {
  for (int i = 1; i <= n; i++)
    if (!dfn[i]) dfs(i);
  for (int i = 1; i <= n; i++)
    for (int j = head[i]; j; j = e[j].next)
      if (id[i] != id[e[j].t]) {
        int u = id[i], v = id[e[j].t];
        g[u].push_back(v);
        d[v]++;
      }
}
}  // namespace Graph
bool ask(int x, int y) {
  printf("? %d %d\n", x, y);
  fflush(stdout);
  scanf("%d", &x);
  return x;
}
queue<int> q;
void erase(int x) {
  for (int i = 0; i < g[x].size(); i++) {
    int u = g[x][i];
    d[u]--;
    if (!d[u]) q.push(u);
  }
}
int solve(int n) {
  int ans = 0;
  for (int i = 1; i <= scc_cnt; i++)
    if (!d[i]) {
      if (!ans)
        ans = bel[i].front();
      else
        q.push(i);
    }
  while (!q.empty()) {
    int t = q.front(), x = bel[t].front();
    if (ask(ans, x)) {
      bel[t].pop();
      if (!bel[t].size()) {
        erase(t);
        q.pop();
      }
    } else {
      int p = Graph::id[ans];
      bel[p].pop();
      if (!bel[p].size())
        erase(p);
      else
        q.push(p);
      ans = x;
      q.pop();
    }
  }
  return ans;
}
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    e[i] = Edge(y, head[x]);
    head[x] = i;
  }
  Graph::build(n);
  printf("! %d\n", solve(n));
  return 0;
}
