#include <bits/stdc++.h>
const int N = 100005;
int n, m, deg[N];
int a[N], b[N];
std::vector<int> E[N], G[N];
std::stack<int> s, ss[N];
bool inss[N];
int dfn[N], low[N], tt;
bool ins[N], vis[N];
int st[N], top;
int col[N], cnt;
void tarjan(int x) {
  dfn[x] = low[x] = ++tt;
  vis[x] = ins[x] = 1, st[++top] = x;
  for (int i = 0; i < E[x].size(); ++i) {
    int y = E[x][i];
    if (!vis[y])
      tarjan(y), low[x] = std::min(low[x], low[y]);
    else if (ins[y])
      low[x] = std::min(low[x], dfn[y]);
  }
  if (dfn[x] == low[x]) {
    ++cnt;
    int tmp = -1;
    while (tmp != x) {
      ins[tmp = st[top--]] = 0;
      col[tmp] = cnt;
    }
  }
  return;
}
inline int query(int u, int v) {
  printf("? %d %d\n", u, v), fflush(stdout);
  int x;
  scanf("%d", &x);
  return x;
}
inline void pushto(int x) {
  if (!inss[col[x]])
    s.push(x), inss[col[x]] = 1;
  else
    ss[col[x]].push(x);
}
int main(void) {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; ++i) {
    scanf("%d%d", a + i, b + i);
    E[a[i]].push_back(b[i]);
  }
  for (int i = 1; i <= n; ++i)
    if (!vis[i]) tarjan(i);
  for (int i = 1; i <= m; ++i)
    if (col[a[i]] != col[b[i]]) G[a[i]].push_back(b[i]), ++deg[b[i]];
  for (int i = 1; i <= n; ++i)
    if (!deg[i]) pushto(i);
  while (s.size() > 1) {
    int u = s.top();
    s.pop();
    int v = s.top();
    s.pop();
    if (!query(u, v)) std::swap(u, v);
    s.push(u);
    for (int i = 0; i < G[v].size(); ++i) {
      int y = G[v][i];
      if (!--deg[G[v][i]]) pushto(y);
    }
    inss[col[v]] = 0;
    if (!ss[col[v]].empty()) pushto(ss[col[v]].top()), ss[col[v]].pop();
  }
  printf("! %d\n", s.top());
  return 0;
}
