#include <bits/stdc++.h>
using namespace std;
const int _ = 1e2;
const int maxn = 1e5 + _;
int ask(int x, int y) {
  printf("? %d %d\n", x, y);
  fflush(stdout);
  static int ret;
  scanf("%d", &ret);
  return ret;
}
struct node {
  int x, y, next;
} a[maxn];
int len, last[maxn];
void ins(int x, int y) {
  a[++len].x = x;
  a[len].y = y;
  a[len].next = last[x];
  last[x] = len;
}
int z, dfn[maxn], low[maxn];
int top, sta[maxn];
bool v[maxn];
int cnt, bel[maxn];
vector<int> vec[maxn];
void dfs(int x) {
  dfn[x] = low[x] = ++z;
  sta[++top] = x;
  v[x] = true;
  for (int k = last[x]; k; k = a[k].next) {
    int y = a[k].y;
    if (!dfn[y]) {
      dfs(y);
      low[x] = min(low[x], low[y]);
    } else if (v[y])
      low[x] = min(low[x], dfn[y]);
  }
  if (dfn[x] == low[x]) {
    int i;
    cnt++;
    do {
      i = sta[top--];
      v[i] = false;
      bel[i] = cnt;
      vec[cnt].push_back(i);
    } while (i != x);
  }
}
node e[maxn];
int elen, elast[maxn], edu[maxn];
void eins(int x, int y) {
  e[++elen].y = y;
  e[elen].next = elast[x];
  elast[x] = elen;
  edu[y]++;
}
int main() {
  int n, m, x, y;
  scanf("%d%d", &n, &m);
  len = 1;
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &x, &y);
    ins(x, y);
  }
  for (int i = 1; i <= n; i++)
    if (!dfn[i]) dfs(i);
  for (int i = 1; i <= len; i++)
    if (bel[a[i].x] != bel[a[i].y]) eins(a[i].x, bel[a[i].y]);
  top = 0;
  for (int i = 1; i <= cnt; i++)
    if (!edu[i]) sta[++top] = i, low[top] = vec[i].size() - 1;
  int p = sta[top--], w = vec[p].size() - 1;
  while (top) {
    int x = sta[top], u = low[top--];
    if (!ask(vec[p][w], vec[x][u])) swap(p, x), swap(w, u);
    for (int k = elast[vec[x][u]]; k; k = e[k].next) {
      edu[e[k].y]--;
      if (edu[e[k].y] == 0)
        sta[++top] = e[k].y, low[top] = vec[e[k].y].size() - 1;
    }
    if (u) sta[++top] = x, low[top] = u - 1;
  }
  printf("! %d\n", vec[p][w]);
  fflush(stdout);
  return 0;
}
