#include <bits/stdc++.h>
using namespace std;
const int Inf = 0x3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f3fll;
const int maxn = 100005;
int n, m;
vector<int> nei[maxn], egs[maxn];
int dfn[maxn], low[maxn], tmc, bls;
bool inq[maxn];
vector<int> stk;
int bel[maxn], deg[maxn];
vector<int> ctn[maxn];
void tarjan(int now) {
  dfn[now] = low[now] = ++tmc;
  stk.push_back(now);
  inq[now] = 1;
  for (auto &to : (nei[now])) {
    if (!dfn[to]) {
      tarjan(to);
      low[now] = min(low[now], low[to]);
    } else if (inq[to]) {
      low[now] = min(low[now], dfn[to]);
    }
  }
  if (dfn[now] == low[now]) {
    bel[now] = ++bls;
    inq[now] = 0;
    ctn[bls].push_back(now);
    while (stk.back() != now) {
      bel[stk.back()] = bls;
      inq[stk.back()] = 0;
      ctn[bls].push_back(stk.back());
      stk.pop_back();
    }
    stk.pop_back();
  }
}
bool inline query(int a, int b) {
  cout << "? " << a << ' ' << b << endl;
  int res;
  cin >> res;
  return res;
}
void inline answer(int a) { cout << "! " << a << endl; }
int main() {
  ios::sync_with_stdio(0);
  cin >> n >> m;
  for (int i = 1; i <= (m); ++i) {
    int a, b;
    cin >> a >> b;
    nei[a].push_back(b);
  }
  for (int i = 1; i <= (n); ++i)
    if (!dfn[i]) tarjan(i);
  for (int i = 1; i <= (n); ++i)
    for (auto &j : (nei[i]))
      if (bel[i] != bel[j]) {
        egs[bel[i]].push_back(bel[j]);
        ++deg[bel[j]];
      }
  vector<int> ls;
  for (int i = 1; i <= (bls); ++i)
    if (!deg[i]) {
      ls.push_back(ctn[i].back());
      ctn[i].pop_back();
    }
  while (((int)(ls).size()) > 1) {
    int u = ls.back();
    ls.pop_back();
    int v = ls.back();
    ls.pop_back();
    int del, rem;
    if (query(u, v))
      del = v, rem = u;
    else
      rem = v, del = u;
    ls.push_back(rem);
    int gr = bel[del];
    if (((int)(ctn[gr]).size())) {
      ls.push_back(ctn[gr].back());
      ctn[gr].pop_back();
    } else {
      for (auto &j : (egs[gr])) {
        --deg[j];
        if (!deg[j]) {
          ls.push_back(ctn[j].back());
          ctn[j].pop_back();
        }
      }
    }
  }
  assert(((int)(ls).size()));
  answer(ls[0]);
  return 0;
}
