#include <bits/stdc++.h>
using namespace std;
struct scc {
  vector<vector<int>> adj, comp;
  vector<bool> u;
  vector<int> pre, low, mp;
  stack<int> s;
  int n, idx, cs;
  scc() {}
  scc(int nn) {
    n = nn;
    adj.resize(n);
  }
  void add(int a, int b) { adj[a].push_back(b); }
  vector<int> go() {
    comp.resize(n);
    idx = 1, cs = 0;
    pre.resize(n), low.resize(n), mp.resize(n);
    u.resize(n);
    for (int i = 0; i < n; ++i) {
      if (pre[i] == 0) {
        dfs(i);
      }
    }
    return mp;
  }
  void dfs(int v) {
    pre[v] = low[v] = idx++;
    s.push(v);
    u[v] = true;
    for (int to : adj[v]) {
      if (pre[to] == 0) {
        dfs(to);
        low[v] = min(low[v], low[to]);
      } else if (u[to]) {
        low[v] = min(low[v], pre[to]);
      }
    }
    if (low[v] == pre[v]) {
      int nxt;
      do {
        nxt = s.top();
        s.pop();
        u[nxt] = false;
        mp[nxt] = cs;
        comp[cs].push_back(nxt);
      } while (nxt != v);
      ++cs;
    }
  }
  vector<vector<int>> compressSCC() {
    vector<vector<int>> g(cs);
    vector<int> added(cs, -1);
    for (int i = 0; i < cs; ++i) {
      for (int v : comp[i]) {
        for (int to : adj[v]) {
          int mapTo = mp[to];
          if (mapTo != i && added[mapTo] != i) {
            g[i].push_back(mapTo);
            added[mapTo] = i;
          }
        }
      }
    }
    return g;
  }
};
int ask(int a, int b) {
  cout << "? " << a + 1 << " " << b + 1 << endl;
  cout.flush();
  int x;
  cin >> x;
  if (x == -1) {
    cout << "Bad news" << endl;
    exit(0);
  }
  return x;
}
void sol() {
  int N, M;
  cin >> N >> M;
  scc graph(N);
  for (int i = 0; i < M; i++) {
    int x, y;
    cin >> x >> y;
    x--;
    y--;
    graph.add(x, y);
  }
  graph.go();
  auto adj = graph.compressSCC();
  auto comps = graph.comp;
  int S = (int)adj.size();
  vector<int> degree(S);
  for (auto x : adj) {
    for (auto y : x) {
      degree[y]++;
    }
  }
  deque<int> dq;
  for (int i = 0; i < S; i++)
    if (!degree[i]) {
      dq.push_back(i);
    }
  int ans = comps[dq.front()].back();
  int curRoot = dq.front();
  dq.pop_front();
  while ((int)dq.size()) {
    int who = dq.front();
    int cand = comps[who].back();
    int dir = ask(ans, cand);
    if (dir) {
      comps[who].pop_back();
      if (!(int)comps[who].size()) {
        dq.pop_front();
        for (int y : adj[who]) {
          degree[y]--;
          if (!degree[y]) dq.push_back(y);
        }
      }
    } else {
      comps[curRoot].pop_back();
      if (!(int)comps[curRoot].size()) {
        for (int y : adj[curRoot]) {
          degree[y]--;
          if (!degree[y]) dq.push_back(y);
        }
      } else {
        dq.push_back(curRoot);
      }
      dq.pop_front();
      curRoot = who;
      ans = cand;
    }
  }
  cout << "! " << ans + 1 << endl;
  cout.flush();
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  sol();
  return 0;
}
