#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
int used[N], cnt[N];
vector<int> e[N], g[N], q;
int n, m, ins[N];
void dfs(int u) {
  used[u] = true;
  ins[u] = true;
  for (auto v : g[u]) {
    if (!ins[v]) {
      e[u].push_back(v), ++cnt[v];
    }
    if (!used[v]) dfs(v);
  }
  ins[u] = 0;
}
signed main() {
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= m; i++) {
    int x, y;
    cin >> x >> y;
    g[x].push_back(y);
  }
  for (int i = 1; i <= n; i++) {
    if (!used[i]) dfs(i);
  }
  for (int i = 1; i <= n; i++) {
    if (!cnt[i]) q.push_back(i);
  }
  while (q.size() != 1) {
    int x = q.back();
    q.pop_back();
    int y = q.back();
    q.pop_back();
    printf("? %d %d\n", x, y);
    fflush(stdout);
    int res;
    cin >> res;
    if (res == 0) swap(x, y);
    q.push_back(x);
    for (auto i : e[y])
      if (!--cnt[i]) q.push_back(i);
  }
  cout << "! " << q[0];
  return 0;
}
