#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100010;
int n, m;
int vis[MAXN];
int deg[MAXN];
int inq[MAXN];
vector<int> E[MAXN], to[MAXN];
inline void dfs(int x) {
  vis[x] = inq[x] = 1;
  for (auto u : E[x]) {
    if (!inq[u]) to[x].push_back(u), ++deg[u];
    if (!vis[u]) dfs(u);
  }
  inq[x] = 0;
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> m;
  for (int i = 1; i <= m; i++) {
    int u, v;
    cin >> u >> v;
    E[u].push_back(v);
  }
  queue<int> q;
  for (int i = 1; i <= n; i++)
    if (!vis[i]) dfs(i);
  for (int i = 1; i <= n; i++)
    if (!deg[i]) q.push(i);
  while (q.size() > 1) {
    int x = q.front();
    q.pop();
    int y = q.front();
    q.pop();
    cout << "? " << x << " " << y << endl;
    int answer;
    cin >> answer;
    if (!answer) swap(x, y);
    q.push(x);
    for (auto u : to[y]) {
      --deg[u];
      if (!deg[u]) q.push(u);
    }
  }
  cout << "! " << q.front() << endl;
  return 0;
}
