#include <bits/stdc++.h>
using namespace std;
void read(int &x) {
  x = 0;
  int f = 1;
  char ch = getchar();
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') f = -f;
  for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - '0';
  x *= f;
}
void print(int x) {
  if (x < 0) putchar('-'), x = -x;
  if (!x) return;
  print(x / 10), putchar(x % 10 + 48);
}
void write(int x) {
  if (!x)
    putchar('0');
  else
    print(x);
  putchar('\n');
}
const int maxn = 1e6 + 10;
const int inf = 1e9;
const double eps = 1e-8;
const int mod = 1e9 + 7;
int n, m, vis[maxn], in[maxn], d[maxn], sta[maxn], top;
vector<int> e[maxn], t[maxn];
void dfs(int x) {
  vis[x] = in[x] = 1;
  for (auto v : e[x]) {
    if (!in[v]) t[x].push_back(v), d[v]++;
    if (!vis[v]) dfs(v);
  }
  in[x] = 0;
}
int main() {
  read(n), read(m);
  for (int i = 1, x, y; i <= m; i++) read(x), read(y), e[x].push_back(y);
  for (int i = 1; i <= n; i++)
    if (!vis[i]) dfs(i);
  for (int i = 1; i <= n; i++)
    if (!d[i]) sta[++top] = i;
  while (top > 1) {
    int x = sta[top--], y = sta[top--], op;
    printf("? %d %d\n", x, y);
    fflush(stdout);
    read(op);
    if (!op) swap(x, y);
    sta[++top] = x;
    for (auto v : t[y])
      if (!(--d[v])) sta[++top] = v;
  }
  printf("! ");
  write(sta[top]);
  fflush(stdout);
  return 0;
}
