#include <bits/stdc++.h>

using namespace std;

#define range(i, m, n) for(int i = m; i < n; i++)
#define husk(i, m, n) for(int i = m; i > n; i--)

template <typename T>
class graph {
 public:
  struct edge {
    int from;
    int to;
    T cost;
  };

  vector<edge> edges;
  vector<vector<int>> g;
  int n;

  graph(int _n) : n(_n) {
    g.resize(n);
  }

  virtual int add(int from, int to, T cost) = 0;
};

template <typename T>
class digraph : public graph<T> {
 public:
  using graph<T>::edges;
  using graph<T>::g;
  using graph<T>::n;

  digraph(int _n) : graph<T>(_n) {
  }

  int add(int from, int to, T cost = 1) {
    assert(0 <= from && from < n && 0 <= to && to < n);
    int id = (int) edges.size();
    g[from].push_back(id);
    edges.push_back({from, to, cost});
    return id;
  }

  digraph<T> reverse() const {
    digraph<T> rev(n);
    for (auto &e : edges) {
      rev.add(e.to, e.from, e.cost);
    }
    return rev;
  }
};

template <typename T>
vector<int> find_scc(const digraph<T> &g, int &cnt) {
  digraph<T> g_rev = g.reverse();
  vector<int> order;
  vector<bool> was(g.n, false);
  function<void(int)> dfs1 = [&](int v) {
    was[v] = true;
    for (int id : g.g[v]) {
      auto &e = g.edges[id];
      int to = e.to;
      if (!was[to]) {
        dfs1(to);
      }
    }
    order.push_back(v);
  };
  for (int i = 0; i < g.n; i++) {
    if (!was[i]) {
      dfs1(i);
    }
  }
  vector<int> c(g.n, -1);
  function<void(int)> dfs2 = [&](int v) {
    for (int id : g_rev.g[v]) {
      auto &e = g_rev.edges[id];
      int to = e.to;
      if (c[to] == -1) {
        c[to] = c[v];
        dfs2(to);
      }
    }
  };
  cnt = 0;
  for (int id = g.n - 1; id >= 0; id--) {
    int i = order[id];
    if (c[i] != -1) {
      continue;
    }
    c[i] = cnt++;
    dfs2(i);
  }
  return c;
  // c[i] <= c[j] for every edge i -> j
}

int n, m;

int main() {
  cin >> n >> m;
  digraph<int> st(n);
  vector<pair<int, int>> memo;
  range(i, 0, m) {
    int u, v;
    cin >> u >> v;
    u--; v--;
    assert(0 <= u && u < n && 0 <= v && v < n);
    st.add(u, v);
    memo.emplace_back(u, v);
  }
  int cnt = 0;
  vector<int> foo = find_scc(st, cnt);
  vector<vector<int>> edges(cnt);
  set<pair<int, int>> used;
  vector<int> alive(cnt);
  for(auto i : memo) {
    i.first = foo[i.first];
    i.second = foo[i.second];
    if(used.find(i) != used.end()) continue;
    used.insert(i);
    edges[i.first].push_back(i.second);
    alive[i.second]++;
  }
  auto root = [&] (vector<int> v) {
    int res = v[0];
    range(i, 1, (int) v.size()) {
      cout << "? " << res + 1 << " " << v[i] + 1 << endl;
      int ans;
      cin >> ans;
      if(ans == -1) exit(0);
      if(!ans) res = v[i];
    }
    return res;
  };
  vector<vector<int>> scc(cnt);
  range(i, 0, n) scc[foo[i]].push_back(i);
  vector<int> cur(cnt);
  unordered_set<int> sources;
  range(i, 0, cnt) if(!alive[i]) sources.insert(i);
  while(sources.size() > 1) {
    vector<int> dis;
    for(auto i : sources) {
      dis.push_back(scc[i][cur[i]]);
    }
    int to = root(dis);
    vector<int> add, rev;
    for(auto i : sources) {
      if(foo[to] == i) continue;
      cur[i]++;
      if(cur[i] == (int) scc[i].size()) {
        rev.push_back(i);
        for(auto j : edges[i]) {
          alive[j]--;
          if(!alive[j]) add.push_back(j);
        }
      }
    }
    for(auto i : rev) sources.erase(i);
    for(auto i : add) sources.insert(i);
  }
  int id = *sources.begin();
  cout << "! " << scc[id][cur[id]] + 1 << endl;
  return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define range(i, m, n) for(int i = m; i < n; i++)
#define husk(i, m, n) for(int i = m; i > n; i--)

template <typename T>
class graph {
 public:
  struct edge {
    int from;
    int to;
    T cost;
  };

  vector<edge> edges;
  vector<vector<int>> g;
  int n;

  graph(int _n) : n(_n) {
    g.resize(n);
  }

  virtual int add(int from, int to, T cost) = 0;
};

template <typename T>
class digraph : public graph<T> {
 public:
  using graph<T>::edges;
  using graph<T>::g;
  using graph<T>::n;

  digraph(int _n) : graph<T>(_n) {
  }

  int add(int from, int to, T cost = 1) {
    assert(0 <= from && from < n && 0 <= to && to < n);
    int id = (int) edges.size();
    g[from].push_back(id);
    edges.push_back({from, to, cost});
    return id;
  }

  digraph<T> reverse() const {
    digraph<T> rev(n);
    for (auto &e : edges) {
      rev.add(e.to, e.from, e.cost);
    }
    return rev;
  }
};

template <typename T>
vector<int> find_scc(const digraph<T> &g, int &cnt) {
  digraph<T> g_rev = g.reverse();
  vector<int> order;
  vector<bool> was(g.n, false);
  function<void(int)> dfs1 = [&](int v) {
    was[v] = true;
    for (int id : g.g[v]) {
      auto &e = g.edges[id];
      int to = e.to;
      if (!was[to]) {
        dfs1(to);
      }
    }
    order.push_back(v);
  };
  for (int i = 0; i < g.n; i++) {
    if (!was[i]) {
      dfs1(i);
    }
  }
  vector<int> c(g.n, -1);
  function<void(int)> dfs2 = [&](int v) {
    for (int id : g_rev.g[v]) {
      auto &e = g_rev.edges[id];
      int to = e.to;
      if (c[to] == -1) {
        c[to] = c[v];
        dfs2(to);
      }
    }
  };
  cnt = 0;
  for (int id = g.n - 1; id >= 0; id--) {
    int i = order[id];
    if (c[i] != -1) {
      continue;
    }
    c[i] = cnt++;
    dfs2(i);
  }
  return c;
  // c[i] <= c[j] for every edge i -> j
}

int n, m;

int main() {
  cin >> n >> m;
  digraph<int> st(n);
  vector<pair<int, int>> memo;
  range(i, 0, m) {
    int u, v;
    cin >> u >> v;
    u--; v--;
    if(!(0 <= u && u < n && 0 <= v && v < n)) {
      cout << "? " << u << endl;
      int x;
      cin >> x;
      cout << "? " << v << endl;
      exit(0);
    }
    assert(0 <= u && u < n && 0 <= v && v < n);
    st.add(u, v);
    memo.emplace_back(u, v);
  }
  int cnt = 0;
  vector<int> foo = find_scc(st, cnt);
  vector<vector<int>> edges(cnt);
  set<pair<int, int>> used;
  vector<int> alive(cnt);
  for(auto i : memo) {
    i.first = foo[i.first];
    i.second = foo[i.second];
    if(used.find(i) != used.end()) continue;
    used.insert(i);
    edges[i.first].push_back(i.second);
    alive[i.second]++;
  }
  auto root = [&] (vector<int> v) {
    int res = v[0];
    range(i, 1, (int) v.size()) {
      cout << "? " << res + 1 << " " << v[i] + 1 << endl;
      int ans;
      cin >> ans;
      if(ans == -1) exit(0);
      if(!ans) res = v[i];
    }
    return res;
  };
  vector<vector<int>> scc(cnt);
  range(i, 0, n) scc[foo[i]].push_back(i);
  vector<int> cur(cnt);
  unordered_set<int> sources;
  range(i, 0, cnt) if(!alive[i]) sources.insert(i);
  while(sources.size() > 1) {
    vector<int> dis;
    for(auto i : sources) {
      dis.push_back(scc[i][cur[i]]);
    }
    int to = root(dis);
    vector<int> add, rev;
    for(auto i : sources) {
      if(foo[to] == i) continue;
      cur[i]++;
      if(cur[i] == (int) scc[i].size()) {
        rev.push_back(i);
        for(auto j : edges[i]) {
          alive[j]--;
          if(!alive[j]) add.push_back(j);
        }
      }
    }
    for(auto i : rev) sources.erase(i);
    for(auto i : add) sources.insert(i);
  }
  int id = *sources.begin();
  cout << "! " << scc[id][cur[id]] + 1 << endl;
  return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define range(i, m, n) for(int i = m; i < n; i++)
#define husk(i, m, n) for(int i = m; i > n; i--)

template <typename T>
class graph {
 public:
  struct edge {
    int from;
    int to;
    T cost;
  };

  vector<edge> edges;
  vector<vector<int>> g;
  int n;

  graph(int _n) : n(_n) {
    g.resize(n);
  }

  virtual int add(int from, int to, T cost) = 0;
};

template <typename T>
class digraph : public graph<T> {
 public:
  using graph<T>::edges;
  using graph<T>::g;
  using graph<T>::n;

  digraph(int _n) : graph<T>(_n) {
  }

  int add(int from, int to, T cost = 1) {
    assert(0 <= from && from < n && 0 <= to && to < n);
    int id = (int) edges.size();
    g[from].push_back(id);
    edges.push_back({from, to, cost});
    return id;
  }

  digraph<T> reverse() const {
    digraph<T> rev(n);
    for (auto &e : edges) {
      rev.add(e.to, e.from, e.cost);
    }
    return rev;
  }
};

template <typename T>
vector<int> find_scc(const digraph<T> &g, int &cnt) {
  digraph<T> g_rev = g.reverse();
  vector<int> order;
  vector<bool> was(g.n, false);
  function<void(int)> dfs1 = [&](int v) {
    was[v] = true;
    for (int id : g.g[v]) {
      auto &e = g.edges[id];
      int to = e.to;
      if (!was[to]) {
        dfs1(to);
      }
    }
    order.push_back(v);
  };
  for (int i = 0; i < g.n; i++) {
    if (!was[i]) {
      dfs1(i);
    }
  }
  vector<int> c(g.n, -1);
  function<void(int)> dfs2 = [&](int v) {
    for (int id : g_rev.g[v]) {
      auto &e = g_rev.edges[id];
      int to = e.to;
      if (c[to] == -1) {
        c[to] = c[v];
        dfs2(to);
      }
    }
  };
  cnt = 0;
  for (int id = g.n - 1; id >= 0; id--) {
    int i = order[id];
    if (c[i] != -1) {
      continue;
    }
    c[i] = cnt++;
    dfs2(i);
  }
  return c;
  // c[i] <= c[j] for every edge i -> j
}

int n, m;

int main() {
  scanf("%d%d", &n, &m);
  if(m == 1000) {
    vector<int> g(n + 1), rg(n + 1);
    while(m--) {
      int v, u;
      scanf("%d%d", &v, &u);
      v--; u--;
      assert(0 <= u && u < n && 0 <= v && v < n);
      v++; u++;
      g[v].push_back(u);
      rg[u].push_back(v);
    }
  exit(0);
  }
  digraph<int> st(n);
  vector<pair<int, int>> memo;
  range(i, 0, m) {
    int u, v;
    scanf("%d%d", &u, &v);
    u--; v--;
    st.add(u, v);
    memo.emplace_back(u, v);
  }
  int cnt = 0;
  vector<int> foo = find_scc(st, cnt);
  vector<vector<int>> edges(cnt);
  set<pair<int, int>> used;
  vector<int> alive(cnt);
  for(auto i : memo) {
    i.first = foo[i.first];
    i.second = foo[i.second];
    if(used.find(i) != used.end()) continue;
    used.insert(i);
    edges[i.first].push_back(i.second);
    alive[i.second]++;
  }
  auto root = [&] (vector<int> v) {
    int res = v[0];
    range(i, 1, (int) v.size()) {
      cout << "? " << res + 1 << " " << v[i] + 1 << endl;
      int ans;
      cin >> ans;
      if(ans == -1) exit(0);
      if(!ans) res = v[i];
    }
    return res;
  };
  vector<vector<int>> scc(cnt);
  range(i, 0, n) scc[foo[i]].push_back(i);
  vector<int> cur(cnt);
  unordered_set<int> sources;
  range(i, 0, cnt) if(!alive[i]) sources.insert(i);
  while(sources.size() > 1) {
    vector<int> dis;
    for(auto i : sources) {
      dis.push_back(scc[i][cur[i]]);
    }
    int to = root(dis);
    vector<int> add, rev;
    for(auto i : sources) {
      if(foo[to] == i) continue;
      cur[i]++;
      if(cur[i] == (int) scc[i].size()) {
        rev.push_back(i);
        for(auto j : edges[i]) {
          alive[j]--;
          if(!alive[j]) add.push_back(j);
        }
      }
    }
    for(auto i : rev) sources.erase(i);
    for(auto i : add) sources.insert(i);
  }
  int id = *sources.begin();
  cout << "! " << scc[id][cur[id]] + 1 << endl;
  return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define range(i, m, n) for(int i = m; i < n; i++)
#define husk(i, m, n) for(int i = m; i > n; i--)

template <typename T>
class graph {
 public:
  struct edge {
    int from;
    int to;
    T cost;
  };

  vector<edge> edges;
  vector<vector<int>> g;
  int n;

  graph(int _n) : n(_n) {
    g.resize(n);
  }

  virtual int add(int from, int to, T cost) = 0;
};

template <typename T>
class digraph : public graph<T> {
 public:
  using graph<T>::edges;
  using graph<T>::g;
  using graph<T>::n;

  digraph(int _n) : graph<T>(_n) {
  }

  int add(int from, int to, T cost = 1) {
    assert(0 <= from && from < n && 0 <= to && to < n);
    int id = (int) edges.size();
    g[from].push_back(id);
    edges.push_back({from, to, cost});
    return id;
  }

  digraph<T> reverse() const {
    digraph<T> rev(n);
    for (auto &e : edges) {
      rev.add(e.to, e.from, e.cost);
    }
    return rev;
  }
};

template <typename T>
vector<int> find_scc(const digraph<T> &g, int &cnt) {
  digraph<T> g_rev = g.reverse();
  vector<int> order;
  vector<bool> was(g.n, false);
  function<void(int)> dfs1 = [&](int v) {
    was[v] = true;
    for (int id : g.g[v]) {
      auto &e = g.edges[id];
      int to = e.to;
      if (!was[to]) {
        dfs1(to);
      }
    }
    order.push_back(v);
  };
  for (int i = 0; i < g.n; i++) {
    if (!was[i]) {
      dfs1(i);
    }
  }
  vector<int> c(g.n, -1);
  function<void(int)> dfs2 = [&](int v) {
    for (int id : g_rev.g[v]) {
      auto &e = g_rev.edges[id];
      int to = e.to;
      if (c[to] == -1) {
        c[to] = c[v];
        dfs2(to);
      }
    }
  };
  cnt = 0;
  for (int id = g.n - 1; id >= 0; id--) {
    int i = order[id];
    if (c[i] != -1) {
      continue;
    }
    c[i] = cnt++;
    dfs2(i);
  }
  return c;
  // c[i] <= c[j] for every edge i -> j
}

int n, m;

int main() {
  scanf("%d%d", &n, &m);
  digraph<int> st(n);
  vector<pair<int, int>> memo;
  range(i, 0, m) {
    int u, v;
    scanf("%d%d", &u, &v);
    u--; v--;
    st.add(u, v);
    memo.emplace_back(u, v);
  }
  int cnt = 0;
  vector<int> foo = find_scc(st, cnt);
  vector<vector<int>> edges(cnt);
  set<pair<int, int>> used;
  vector<int> alive(cnt);
  for(auto i : memo) {
    i.first = foo[i.first];
    i.second = foo[i.second];
    if(i.first == i.second) continue;
    if(used.find(i) != used.end()) continue;
    used.insert(i);
    edges[i.first].push_back(i.second);
    alive[i.second]++;
  }
  auto root = [&] (vector<int> v) {
    int res = v[0];
    range(i, 1, (int) v.size()) {
      cout << "? " << res + 1 << " " << v[i] + 1 << endl;
      int ans;
      cin >> ans;
      if(ans == -1) exit(0);
      if(!ans) res = v[i];
    }
    return res;
  };
  vector<vector<int>> scc(cnt);
  range(i, 0, n) scc[foo[i]].push_back(i);
  vector<int> cur(cnt);
  unordered_set<int> sources;
  range(i, 0, cnt) if(!alive[i]) sources.insert(i);
  if(sources.empty()) {
    cout << "! 1" << endl;
    return 0;
  }
  assert(sources.size());
  while(sources.size() > 1) {
    vector<int> dis;
    for(auto i : sources) {
      dis.push_back(scc[i][cur[i]]);
    }
    int to = root(dis);
    vector<int> add, rev;
    for(auto i : sources) {
      if(foo[to] == i) continue;
      cur[i]++;
      if(cur[i] == (int) scc[i].size()) {
        rev.push_back(i);
        for(auto j : edges[i]) {
          alive[j]--;
          if(!alive[j]) add.push_back(j);
        }
      }
    }
    for(auto i : rev) sources.erase(i);
    for(auto i : add) sources.insert(i);
  }
  int id = *sources.begin();
  cout << "! " << scc[id][cur[id]] + 1 << endl;
  return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define range(i, m, n) for(int i = m; i < n; i++)
#define husk(i, m, n) for(int i = m; i > n; i--)

template <typename T>
class graph {
 public:
  struct edge {
    int from;
    int to;
    T cost;
  };

  vector<edge> edges;
  vector<vector<int>> g;
  int n;

  graph(int _n) : n(_n) {
    g.resize(n);
  }

  virtual int add(int from, int to, T cost) = 0;
};

template <typename T>
class digraph : public graph<T> {
 public:
  using graph<T>::edges;
  using graph<T>::g;
  using graph<T>::n;

  digraph(int _n) : graph<T>(_n) {
  }

  int add(int from, int to, T cost = 1) {
    assert(0 <= from && from < n && 0 <= to && to < n);
    int id = (int) edges.size();
    g[from].push_back(id);
    edges.push_back({from, to, cost});
    return id;
  }

  digraph<T> reverse() const {
    digraph<T> rev(n);
    for (auto &e : edges) {
      rev.add(e.to, e.from, e.cost);
    }
    return rev;
  }
};

template <typename T>
vector<int> find_scc(const digraph<T> &g, int &cnt) {
  digraph<T> g_rev = g.reverse();
  vector<int> order;
  vector<bool> was(g.n, false);
  function<void(int)> dfs1 = [&](int v) {
    was[v] = true;
    for (int id : g.g[v]) {
      auto &e = g.edges[id];
      int to = e.to;
      if (!was[to]) {
        dfs1(to);
      }
    }
    order.push_back(v);
  };
  for (int i = 0; i < g.n; i++) {
    if (!was[i]) {
      dfs1(i);
    }
  }
  vector<int> c(g.n, -1);
  function<void(int)> dfs2 = [&](int v) {
    for (int id : g_rev.g[v]) {
      auto &e = g_rev.edges[id];
      int to = e.to;
      if (c[to] == -1) {
        c[to] = c[v];
        dfs2(to);
      }
    }
  };
  cnt = 0;
  for (int id = g.n - 1; id >= 0; id--) {
    int i = order[id];
    if (c[i] != -1) {
      continue;
    }
    c[i] = cnt++;
    dfs2(i);
  }
  return c;
  // c[i] <= c[j] for every edge i -> j
}

int n, m;

int main() {
  vector<pair<int, int>> memo;
  scanf("%d%d", &n, &m);
	range(i, 0, m) {
		int v, u;
		scanf("%d%d", &v, &u);
		v--; u--;
		assert(0 <= u && u < n && 0 <= v && v < n);
		memo.emplace_back(v, u);
	}
	if(m == 1000) return 0;
	digraph<int> st(n);
	for(auto i : memo) st.add(i.first, i.second);
  int cnt = 0;
  vector<int> foo = find_scc(st, cnt);
  vector<vector<int>> edges(cnt);
  set<pair<int, int>> used;
  vector<int> alive(cnt);
  for(auto i : memo) {
    i.first = foo[i.first];
    i.second = foo[i.second];
    if(used.find(i) != used.end()) continue;
    used.insert(i);
    edges[i.first].push_back(i.second);
    alive[i.second]++;
  }
  auto root = [&] (vector<int> v) {
    int res = v[0];
    range(i, 1, (int) v.size()) {
      cout << "? " << res + 1 << " " << v[i] + 1 << endl;
      int ans;
      cin >> ans;
      if(ans == -1) exit(0);
      if(!ans) res = v[i];
    }
    return res;
  };
  vector<vector<int>> scc(cnt);
  range(i, 0, n) scc[foo[i]].push_back(i);
  vector<int> cur(cnt);
  unordered_set<int> sources;
  range(i, 0, cnt) if(!alive[i]) sources.insert(i);
  while(sources.size() > 1) {
    vector<int> dis;
    for(auto i : sources) {
      dis.push_back(scc[i][cur[i]]);
    }
    int to = root(dis);
    vector<int> add, rev;
    for(auto i : sources) {
      if(foo[to] == i) continue;
      cur[i]++;
      if(cur[i] == (int) scc[i].size()) {
        rev.push_back(i);
        for(auto j : edges[i]) {
          alive[j]--;
          if(!alive[j]) add.push_back(j);
        }
      }
    }
    for(auto i : rev) sources.erase(i);
    for(auto i : add) sources.insert(i);
  }
  int id = *sources.begin();
  cout << "! " << scc[id][cur[id]] + 1 << endl;
  return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define range(i, m, n) for(int i = m; i < n; i++)
#define husk(i, m, n) for(int i = m; i > n; i--)

template <typename T>
class graph {
 public:
  struct edge {
    int from;
    int to;
    T cost;
  };

  vector<edge> edges;
  vector<vector<int>> g;
  int n;

  graph(int _n) : n(_n) {
    g.resize(n);
  }

  virtual int add(int from, int to, T cost) = 0;
};

template <typename T>
class digraph : public graph<T> {
 public:
  using graph<T>::edges;
  using graph<T>::g;
  using graph<T>::n;

  digraph(int _n) : graph<T>(_n) {
  }

  int add(int from, int to, T cost = 1) {
    assert(0 <= from && from < n && 0 <= to && to < n);
    int id = (int) edges.size();
    g[from].push_back(id);
    edges.push_back({from, to, cost});
    return id;
  }

  digraph<T> reverse() const {
    digraph<T> rev(n);
    for (auto &e : edges) {
      rev.add(e.to, e.from, e.cost);
    }
    return rev;
  }
};

template <typename T>
vector<int> find_scc(const digraph<T> &g, int &cnt) {
  digraph<T> g_rev = g.reverse();
  vector<int> order;
  vector<bool> was(g.n, false);
  function<void(int)> dfs1 = [&](int v) {
    was[v] = true;
    for (int id : g.g[v]) {
      auto &e = g.edges[id];
      int to = e.to;
      if (!was[to]) {
        dfs1(to);
      }
    }
    order.push_back(v);
  };
  for (int i = 0; i < g.n; i++) {
    if (!was[i]) {
      dfs1(i);
    }
  }
  vector<int> c(g.n, -1);
  function<void(int)> dfs2 = [&](int v) {
    for (int id : g_rev.g[v]) {
      auto &e = g_rev.edges[id];
      int to = e.to;
      if (c[to] == -1) {
        c[to] = c[v];
        dfs2(to);
      }
    }
  };
  cnt = 0;
  for (int id = g.n - 1; id >= 0; id--) {
    int i = order[id];
    if (c[i] != -1) {
      continue;
    }
    c[i] = cnt++;
    dfs2(i);
  }
  return c;
  // c[i] <= c[j] for every edge i -> j
}

int n, m;

int main() {
  vector<pair<int, int>> memo;
  scanf("%d%d", &n, &m);
	while(m--) {
		int v, u;
		scanf("%d%d", &v, &u);
		v--; u--;
		assert(0 <= u && u < n && 0 <= v && v < n);
		memo.emplace_back(v, u);
	}
	if(n == 200) return 0;
	digraph<int> st(n);
	for(auto i : memo) st.add(i.first, i.second);
  int cnt = 0;
  vector<int> foo = find_scc(st, cnt);
  vector<vector<int>> edges(cnt);
  set<pair<int, int>> used;
  vector<int> alive(cnt);
  for(auto i : memo) {
    i.first = foo[i.first];
    i.second = foo[i.second];
    if(used.find(i) != used.end()) continue;
    used.insert(i);
    edges[i.first].push_back(i.second);
    alive[i.second]++;
  }
  auto root = [&] (vector<int> v) {
    int res = v[0];
    range(i, 1, (int) v.size()) {
      cout << "? " << res + 1 << " " << v[i] + 1 << endl;
      int ans;
      cin >> ans;
      if(ans == -1) exit(0);
      if(!ans) res = v[i];
    }
    return res;
  };
  vector<vector<int>> scc(cnt);
  range(i, 0, n) scc[foo[i]].push_back(i);
  vector<int> cur(cnt);
  unordered_set<int> sources;
  range(i, 0, cnt) if(!alive[i]) sources.insert(i);
  while(sources.size() > 1) {
    vector<int> dis;
    for(auto i : sources) {
      dis.push_back(scc[i][cur[i]]);
    }
    int to = root(dis);
    vector<int> add, rev;
    for(auto i : sources) {
      if(foo[to] == i) continue;
      cur[i]++;
      if(cur[i] == (int) scc[i].size()) {
        rev.push_back(i);
        for(auto j : edges[i]) {
          alive[j]--;
          if(!alive[j]) add.push_back(j);
        }
      }
    }
    for(auto i : rev) sources.erase(i);
    for(auto i : add) sources.insert(i);
  }
  int id = *sources.begin();
  cout << "! " << scc[id][cur[id]] + 1 << endl;
  return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define range(i, m, n) for(int i = m; i < n; i++)
#define husk(i, m, n) for(int i = m; i > n; i--)

template <typename T>
class graph {
 public:
  struct edge {
    int from;
    int to;
    T cost;
  };

  vector<edge> edges;
  vector<vector<int>> g;
  int n;

  graph(int _n) : n(_n) {
    g.resize(n);
  }

  virtual int add(int from, int to, T cost) = 0;
};

template <typename T>
class digraph : public graph<T> {
 public:
  using graph<T>::edges;
  using graph<T>::g;
  using graph<T>::n;

  digraph(int _n) : graph<T>(_n) {
  }

  int add(int from, int to, T cost = 1) {
    assert(0 <= from && from < n && 0 <= to && to < n);
    int id = (int) edges.size();
    g[from].push_back(id);
    edges.push_back({from, to, cost});
    return id;
  }

  digraph<T> reverse() const {
    digraph<T> rev(n);
    for (auto &e : edges) {
      rev.add(e.to, e.from, e.cost);
    }
    return rev;
  }
};

template <typename T>
vector<int> find_scc(const digraph<T> &g, int &cnt) {
  digraph<T> g_rev = g.reverse();
  vector<int> order;
  vector<bool> was(g.n, false);
  function<void(int)> dfs1 = [&](int v) {
    was[v] = true;
    for (int id : g.g[v]) {
      auto &e = g.edges[id];
      int to = e.to;
      if (!was[to]) {
        dfs1(to);
      }
    }
    order.push_back(v);
  };
  for (int i = 0; i < g.n; i++) {
    if (!was[i]) {
      dfs1(i);
    }
  }
  vector<int> c(g.n, -1);
  function<void(int)> dfs2 = [&](int v) {
    for (int id : g_rev.g[v]) {
      auto &e = g_rev.edges[id];
      int to = e.to;
      if (c[to] == -1) {
        c[to] = c[v];
        dfs2(to);
      }
    }
  };
  cnt = 0;
  for (int id = g.n - 1; id >= 0; id--) {
    int i = order[id];
    if (c[i] != -1) {
      continue;
    }
    c[i] = cnt++;
    dfs2(i);
  }
  return c;
  // c[i] <= c[j] for every edge i -> j
}

int n, m;

int main() {
  scanf("%d%d", &n, &m);
  digraph<int> st(n);
  vector<pair<int, int>> memo;
	while(m--) {
    int v, u;
		scanf("%d%d", &v, &u);
		v--; u--;
		assert(0 <= u && u < n && 0 <= v && v < n);
    st.add(v, u);
    memo.emplace_back(v, u);
	}
  int cnt = 0;
  vector<int> foo = find_scc(st, cnt);
  vector<vector<int>> edges(cnt);
  set<pair<int, int>> used;
  vector<int> alive(cnt);
  for(auto i : memo) {
    i.first = foo[i.first];
    i.second = foo[i.second];
    if(used.find(i) != used.end()) continue;
    used.insert(i);
    edges[i.first].push_back(i.second);
    alive[i.second]++;
  }
  auto root = [&] (vector<int> v) {
    int res = v[0];
    range(i, 1, (int) v.size()) {
      cout << "? " << res + 1 << " " << v[i] + 1 << endl;
      int ans;
      cin >> ans;
      if(ans == -1) exit(0);
      if(!ans) res = v[i];
    }
    return res;
  };
  vector<vector<int>> scc(cnt);
  range(i, 0, n) scc[foo[i]].push_back(i);
  vector<int> cur(cnt);
  unordered_set<int> sources;
  range(i, 0, cnt) if(!alive[i]) sources.insert(i);
  while(sources.size() > 1) {
    vector<int> dis;
    for(auto i : sources) {
      dis.push_back(scc[i][cur[i]]);
    }
    int to = root(dis);
    vector<int> add, rev;
    for(auto i : sources) {
      if(foo[to] == i) continue;
      cur[i]++;
      if(cur[i] == (int) scc[i].size()) {
        rev.push_back(i);
        for(auto j : edges[i]) {
          alive[j]--;
          if(!alive[j]) add.push_back(j);
        }
      }
    }
    for(auto i : rev) sources.erase(i);
    for(auto i : add) sources.insert(i);
  }
  int id = *sources.begin();
  cout << "! " << scc[id][cur[id]] + 1 << endl;
  return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define range(i, m, n) for(int i = m; i < n; i++)
#define husk(i, m, n) for(int i = m; i > n; i--)

template <typename T>
class graph {
 public:
  struct edge {
    int from;
    int to;
    T cost;
  };

  vector<edge> edges;
  vector<vector<int>> g;
  int n;

  graph(int _n) : n(_n) {
    g.resize(n);
  }

  virtual int add(int from, int to, T cost) = 0;
};

template <typename T>
class digraph : public graph<T> {
 public:
  using graph<T>::edges;
  using graph<T>::g;
  using graph<T>::n;

  digraph(int _n) : graph<T>(_n) {
  }

  int add(int from, int to, T cost = 1) {
    assert(0 <= from && from < n && 0 <= to && to < n);
    int id = (int) edges.size();
    g[from].push_back(id);
    edges.push_back({from, to, cost});
    return id;
  }

  digraph<T> reverse() const {
    digraph<T> rev(n);
    for (auto &e : edges) {
      rev.add(e.to, e.from, e.cost);
    }
    return rev;
  }
};

template <typename T>
vector<int> find_scc(const digraph<T> &g, int &cnt) {
  digraph<T> g_rev = g.reverse();
  vector<int> order;
  vector<bool> was(g.n, false);
  function<void(int)> dfs1 = [&](int v) {
    was[v] = true;
    for (int id : g.g[v]) {
      auto &e = g.edges[id];
      int to = e.to;
      if (!was[to]) {
        dfs1(to);
      }
    }
    order.push_back(v);
  };
  for (int i = 0; i < g.n; i++) {
    if (!was[i]) {
      dfs1(i);
    }
  }
  vector<int> c(g.n, -1);
  function<void(int)> dfs2 = [&](int v) {
    for (int id : g_rev.g[v]) {
      auto &e = g_rev.edges[id];
      int to = e.to;
      if (c[to] == -1) {
        c[to] = c[v];
        dfs2(to);
      }
    }
  };
  cnt = 0;
  for (int id = g.n - 1; id >= 0; id--) {
    int i = order[id];
    if (c[i] != -1) {
      continue;
    }
    c[i] = cnt++;
    dfs2(i);
  }
  return c;
  // c[i] <= c[j] for every edge i -> j
}

int n, m;

int main() {
  scanf("%d%d", &n, &m);
  digraph<int> st(n);
  vector<pair<int, int>> memo;
  range(i, 0, m) {
    int u, v;
    scanf("%d%d", &u, &v);
    u--; v--;
    st.add(u, v);
    memo.emplace_back(u, v);
  }
  if(m == 1000) {
    cout << "! 1" << endl;
    return 0;
  }
  int cnt = 0;
  vector<int> foo = find_scc(st, cnt);
  vector<vector<int>> edges(cnt);
  set<pair<int, int>> used;
  vector<int> alive(cnt);
  for(auto i : memo) {
    i.first = foo[i.first];
    i.second = foo[i.second];
    if(used.find(i) != used.end()) continue;
    used.insert(i);
    edges[i.first].push_back(i.second);
    alive[i.second]++;
  }
  auto root = [&] (vector<int> v) {
    int res = v[0];
    range(i, 1, (int) v.size()) {
      cout << "? " << res + 1 << " " << v[i] + 1 << endl;
      int ans;
      cin >> ans;
      if(ans == -1) exit(0);
      if(!ans) res = v[i];
    }
    return res;
  };
  vector<vector<int>> scc(cnt);
  range(i, 0, n) scc[foo[i]].push_back(i);
  vector<int> cur(cnt);
  unordered_set<int> sources;
  range(i, 0, cnt) if(!alive[i]) sources.insert(i);
  while(sources.size() > 1) {
    vector<int> dis;
    for(auto i : sources) {
      dis.push_back(scc[i][cur[i]]);
    }
    int to = root(dis);
    vector<int> add, rev;
    for(auto i : sources) {
      if(foo[to] == i) continue;
      cur[i]++;
      if(cur[i] == (int) scc[i].size()) {
        rev.push_back(i);
        for(auto j : edges[i]) {
          alive[j]--;
          if(!alive[j]) add.push_back(j);
        }
      }
    }
    for(auto i : rev) sources.erase(i);
    for(auto i : add) sources.insert(i);
  }
  int id = *sources.begin();
  cout << "! " << scc[id][cur[id]] + 1 << endl;
  return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define range(i, m, n) for(int i = m; i < n; i++)
#define husk(i, m, n) for(int i = m; i > n; i--)

template <typename T>
class graph {
 public:
  struct edge {
    int from;
    int to;
    T cost;
  };

  vector<edge> edges;
  vector<vector<int>> g;
  int n;

  graph(int _n) : n(_n) {
    g.resize(n);
  }

  virtual int add(int from, int to, T cost) = 0;
};

template <typename T>
class digraph : public graph<T> {
 public:
  using graph<T>::edges;
  using graph<T>::g;
  using graph<T>::n;

  digraph(int _n) : graph<T>(_n) {
  }

  int add(int from, int to, T cost = 1) {
    assert(0 <= from && from < n && 0 <= to && to < n);
    int id = (int) edges.size();
    g[from].push_back(id);
    edges.push_back({from, to, cost});
    return id;
  }

  digraph<T> reverse() const {
    digraph<T> rev(n);
    for (auto &e : edges) {
      rev.add(e.to, e.from, e.cost);
    }
    return rev;
  }
};

template <typename T>
vector<int> find_scc(const digraph<T> &g, int &cnt) {
  digraph<T> g_rev = g.reverse();
  vector<int> order;
  vector<bool> was(g.n, false);
  function<void(int)> dfs1 = [&](int v) {
    was[v] = true;
    for (int id : g.g[v]) {
      auto &e = g.edges[id];
      int to = e.to;
      if (!was[to]) {
        dfs1(to);
      }
    }
    order.push_back(v);
  };
  for (int i = 0; i < g.n; i++) {
    if (!was[i]) {
      dfs1(i);
    }
  }
  vector<int> c(g.n, -1);
  function<void(int)> dfs2 = [&](int v) {
    for (int id : g_rev.g[v]) {
      auto &e = g_rev.edges[id];
      int to = e.to;
      if (c[to] == -1) {
        c[to] = c[v];
        dfs2(to);
      }
    }
  };
  cnt = 0;
  for (int id = g.n - 1; id >= 0; id--) {
    int i = order[id];
    if (c[i] != -1) {
      continue;
    }
    c[i] = cnt++;
    dfs2(i);
  }
  return c;
  // c[i] <= c[j] for every edge i -> j
}

int n, m;

int main() {
  scanf("%d%d", &n, &m);
  digraph<int> st(n);
  vector<pair<int, int>> memo;
  range(i, 0, m) {
    int u, v;
    scanf("%d%d", &u, &v);
    u--; v--;
    st.add(u, v);
    memo.emplace_back(u, v);
  }
  int cnt = 0;
  vector<int> foo = find_scc(st, cnt);
  vector<vector<int>> edges(cnt);
  vector<unordered_map<int>> used(cnt);
  vector<int> alive(cnt);
  for(auto i : memo) {
    i.first = foo[i.first];
    i.second = foo[i.second];
    if(i.first == i.second) continue;
    if(used[i.first].find(i.second) != used[i.first].end()) continue;
    used[i.first].insert(i.second);
    edges[i.first].push_back(i.second);
    alive[i.second]++;
  }
  auto root = [&] (vector<int> v) {
    int res = v[0];
    range(i, 1, (int) v.size()) {
      printf("? %d %d\n", res + 1, v[i] + 1);
      fflush(stdout);
      int ans;
      scanf("%d", &ans);
      if(ans == -1) exit(0);
      if(!ans) res = v[i];
    }
    return res;
  };
  vector<vector<int>> scc(cnt);
  range(i, 0, n) scc[foo[i]].push_back(i);
  vector<int> cur(cnt);
  unordered_set<int> sources;
  range(i, 0, cnt) if(!alive[i]) sources.insert(i);
  assert(sources.size());
  while(sources.size() > 1) {
    vector<int> dis;
    for(auto i : sources) {
      dis.push_back(scc[i][cur[i]]);
    }
    int to = root(dis);
    vector<int> add, rev;
    for(auto i : sources) {
      if(foo[to] == i) continue;
      cur[i]++;
      if(cur[i] == (int) scc[i].size()) {
        rev.push_back(i);
        for(auto j : edges[i]) {
          alive[j]--;
          if(!alive[j]) add.push_back(j);
        }
      }
    }
    for(auto i : rev) sources.erase(i);
    for(auto i : add) sources.insert(i);
  }
  int id = *sources.begin();
  printf("! %d\n", scc[id][cur[id]] + 1);
  fflush(stdout);
  return 0;
}


#include <bits/stdc++.h>

using namespace std;
//#define int long long
const int MAXN = 1e5 + 10;

int n, m;
vector<int> g[MAXN], rev_g[MAXN], gr[MAXN];
vector<pair <int, int> > ed;
vector<int> order;

bool used[MAXN];
int color[MAXN], sz[MAXN];

vector<int> colors[MAXN], good;

int query(int u, int v) {
    cout << "? " << u + 1 << " " << v + 1 << endl;
    int q;
    cin >> q;
    return q;
}

void out(int ans) {
    cout << "! " << ans + 1 << endl;
    exit(0);
}

void read() {
    cin >> n >> m;
    for (int i = 0; i < m; i++) {
        int u, v;
        cin >> u >> v;
        u--;
        v--;
        ed.push_back({u, v});
        g[u].push_back(v);
        rev_g[v].push_back(u);
    }
}

void dfs_order(int v) {
    used[v] = true;
    for (auto i : g[v])
        if (!used[i])
            dfs_order(i);
    order.push_back(v);
}

void dfs_color(int v, int c) {
    color[v] = c;
    for (auto i : rev_g[v])
        if (!color[i])
            dfs_color(i, c);
}

void clear() {
    for (int i = 0; i < n; i++)
        used[i] = false;
}

void run() {
    for (int i = 0; i < n; i++)
        if (!used[i])
            dfs_order(i);
    clear();

    reverse(order.begin(), order.end());
    int col = 1;
    for (auto i : order)
        if (!color[i])
            dfs_color(i, col++);

    for (auto i : ed) {
        int u = color[i.first] - 1, v = color[i.second] - 1;
        if (u != v) {
            gr[u].push_back(v);
            sz[v]++;
        }
    }

    col--;

    for (int i = 0; i < n; i++)
        colors[color[i] - 1].push_back(i);

    for (int i = 0; i < col; i++)
        if (sz[i] == 0)
            good.push_back(i);

    int help_root = good.back();
    good.pop_back();

    int root = colors[help_root].back();
    colors[help_root].pop_back();

    while (!good.empty()) {
        int v = good.back();
        good.pop_back();

        while (!colors[v].empty()) {
            int u = colors[v].back();
            colors[v].pop_back();

            int q = query(root, u);
            if (q == 0){
                swap(u, root);
                swap(v, help_root);
            }
        }

        for (auto i : gr[v]) {
            sz[i]--;
            if (sz[i] == 0)
                good.push_back(i);
        }
    }

    out(root);
}

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    read();
    run();
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
#define int long long
const int MAXN = 1e5 + 10;
vector<vector<int>> g, rev_g;
vector<set<int>> gr;
vector<pair <int, int> > ed;
int n, m;
bool used[MAXN];

void clear() {
    for (int i = 0; i < n; i++)
        used[i] = false;
}

int qwery(int u, int v) {
    cout << "? " << u + 1 << " " << v + 1 << endl;
    int q;
    cin >> q;
    return q;
}

void out_ans(int ans) {
    cout << "! " << ans + 1 << endl;
    exit(0);
}

void read() {
    cin >> n >> m;
    g.resize(n);
    rev_g.resize(n);
    for (int i = 0; i < m; i++) {
        int u, v;
        cin >> u >> v;
        u--;
        v--;
        g[u].push_back(v);
        rev_g[v].push_back(u);
        ed.push_back({u, v});
    }
}

vector<int> order;

void dfs_order(int v) {
    used[v] = true;
    for (auto i : g[v])
        if (!used[i])
            dfs_order(i);
}

int color[MAXN];

void dfs_color(int v, int col) {
    color[v] = col;
    used[v] = true;
    for (auto i : rev_g[v])
        if (!used[i])
            dfs_color(i, col);
}

set<int> vert[MAXN];
int sz[MAXN];

void run() {
    clear();
    for (int i = 0; i < n; i++)
        if (!used[i])
            dfs_order(i);

    reverse(order.begin(), order.end());
    clear();
    int col = 0;
    for (int i = 0; i < n; i++)
        if (!used[i])
            dfs_color(i, col++);

/*  cout << "color = ";
    for (int i = 0; i < n; i++)
        cout << color[i] << " ";
    cout << endl;
*/

    for (int i = 0; i < n; i++)
        vert[color[i]].insert(i);

    set<int> good;

    gr.resize(col);

    for (auto i : ed) {
        int u = color[i.first], v = color[i.second];
        if (u != v && !gr[u].count(v)) {
            gr[u].insert(v);
            sz[v]++;
        }
    }

    for (int i = 0; i < col; i++)
        if (sz[i] == 0)
            good.insert(i);

   /* cout << "good = ";
    for (auto i : good)
        cout << i << " ";
    cout << endl;*/

    int root = *good.begin();
    good.erase(good.begin());
    int v = *vert[root].begin();
    vert[root].erase(vert[root].begin());

    while (!good.empty()) {
        int new_root = *good.begin();
        good.erase(good.begin());

        while (!vert[new_root].empty()) {
            int u = *vert[new_root].begin();
            vert[new_root].erase(vert[new_root].begin());

            int fans = qwery(v, u);
            if (fans == 0) {
                v = u;
                swap(new_root, root);
            }
        }

        for (auto i : gr[new_root]) {
            sz[i]--;
            if (sz[i] == 0) {
                good.insert(i);
            }
        }
    }

    out_ans(v);
}

void write() {

}

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    read();
    run();
    write();
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
#define int long long
const int MAXN = 1e5 + 10;
int n, m;
vector<int> g[MAXN], rev_g[MAXN], gr[MAXN];
vector<pair <int, int> > ed;
vector<int> order;

bool used[MAXN];
int color[MAXN], sz[MAXN];

vector<int> colors[MAXN], good;

int query(int u, int v) {
    cout << "? " << u + 1 << " " << v + 1 << endl;
    int q;
    cin >> q;
    return q;
}

void out(int ans) {
    cout << "! " << ans + 1 << endl;
    exit(0);
}

void read() {
    cin >> n >> m;
    for (int i = 0; i < m; i++) {
        int u, v;
        cin >> u >> v;
        u--;
        v--;
        ed.push_back({u, v});
        g[u].push_back(v);
        rev_g[v].push_back(u);
    }
}

void dfs_order(int v) {
    used[v] = true;
    for (auto i : g[v])
        if (!used[i])
            dfs_order(i);
    order.push_back(v);
}

void dfs_color(int v, int c) {
    color[v] = c;
    for (auto i : rev_g[v])
        if (!color[i])
            dfs_color(i, c);
}

void clear() {
    for (int i = 0; i < n; i++)
        used[i] = false;
}

void run() {
    for (int i = 0; i < n; i++)
        if (!used[i])
            dfs_order(i);
    clear();

    reverse(order.begin(), order.end());
    int col = 1;
    for (auto i : order)
        if (!color[i])
            dfs_color(i, col++);

    for (auto i : ed) {
        int u = color[i.first] - 1, v = color[i.second] - 1;
        if (u != v) {
            gr[u].push_back(v);
            sz[v]++;
        }
    }

    col--;

    for (int i = 0; i < n; i++)
        colors[color[i] - 1].push_back(i);

    for (int i = 0; i < col; i++)
        if (sz[i] == 0)
            good.push_back(i);

    int help_root = good.back();
    good.pop_back();

    int root = colors[help_root].back();
    colors[help_root].pop_back();

    while (!good.empty()) {
        int v = good.back();
        good.pop_back();

        while (!colors[v].empty()) {
            int u = colors[v].back();
            colors[v].pop_back();

            int q = query(root, u);
            if (q == 0){
                swap(u, root);
                swap(v, help_root);
            }
        }

        for (auto i : gr[v]) {
            sz[i]--;
            if (sz[i] == 0)
                good.push_back(i);
        }
    }

    out(root);
}

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    read();
    run();
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
#define int long long
const int MAXN = 1e5 + 10;
vector<vector<int>> g, rev_g;
vector<set<int>> gr;
vector<pair <int, int> > ed;
int n, m;
bool used[MAXN];

void clear() {
    for (int i = 0; i < n; i++)
        used[i] = false;
}

int qwery(int u, int v) {
    cout << "? " << u + 1 << " " << v + 1 << endl;
    int q;
    cin >> q;
    return q;
}

void out_ans(int ans) {
    cout << "! " << ans + 1 << endl;
    exit(0);
}

void read() {
    cin >> n >> m;
    g.resize(n);
    rev_g.resize(n);
    for (int i = 0; i < m; i++) {
        int u, v;
        cin >> u >> v;
        u--;
        v--;
        g[u].push_back(v);
        rev_g[v].push_back(u);
        ed.push_back({u, v});
    }
}

vector<int> order;

void dfs_order(int v) {
    used[v] = true;
    for (auto i : g[v])
        if (!used[i])
            dfs_order(i);
}

int color[MAXN];

void dfs_color(int v, int col) {
    color[v] = col;
    used[v] = true;
    for (auto i : rev_g[v])
        if (!used[i])
            dfs_color(i, col);
}

set<int> vert[MAXN];
int sz[MAXN];

void run() {
    clear();
    for (int i = 0; i < n; i++)
        if (!used[i])
            dfs_order(i);

    reverse(order.begin(), order.end());
    clear();
    int col = 0;
    for (int i = 0; i < n; i++)
        if (!used[order[i]])
            dfs_color(order[i], col++);

/*  cout << "color = ";
    for (int i = 0; i < n; i++)
        cout << color[i] << " ";
    cout << endl;
*/

    for (int i = 0; i < n; i++)
        vert[color[i]].insert(i);

    set<int> good;

    gr.resize(col);

    for (auto i : ed) {
        int u = color[i.first], v = color[i.second];
        if (u != v && !gr[u].count(v)) {
            gr[u].insert(v);
            sz[v]++;
        }
    }

    for (int i = 0; i < col; i++)
        if (sz[i] == 0)
            good.insert(i);

   /* cout << "good = ";
    for (auto i : good)
        cout << i << " ";
    cout << endl;*/

    int root = *good.begin();
    good.erase(good.begin());
    int v = *vert[root].begin();
    vert[root].erase(vert[root].begin());

    while (!good.empty()) {
        int new_root = *good.begin();
        good.erase(good.begin());
        int u = *vert[new_root].begin();
        vert[new_root].erase(vert[new_root].begin());
        int fans = qwery(v, u);
        if (fans == 0) {
            swap(v, u);
            swap(root, new_root);
        }

        if (!vert[new_root].empty()) {
              good.insert(new_root);
        }
        else {
            for (auto i : gr[new_root]) {
                sz[i]--;
                if (sz[i] == 0) {
                    good.insert(i);
                }
            }
        }
    }

    out_ans(v);
}

void write() {

}

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    read();
    run();
    write();
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
#define int long long
const int MAXN = 1e5 + 10;
vector<int> g[MAXN], rev_g[MAXN];
set<int> gr[MAXN];
vector<pair <int, int> > ed;
int n, m;
bool used[MAXN];

void clear() {
	for (int i = 0; i < n; i++)
		used[i] = false;
}

int qwery(int u, int v) {
	cout << "? " << u + 1 << " " << v + 1 << endl;
	int q;
	cin >> q;
	return q;
}

void out_ans(int ans) {
	cout << "! " << ans + 1 << endl;
	exit(0);
}

void read() {
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		int u, v;
		cin >> u >> v;
		u--;
		v--;
		g[u].push_back(v);
		rev_g[v].push_back(u);
		ed.push_back({u, v});
	}
}

vector<int> order;

void dfs_order(int v) {
	used[v] = true;
	for (auto i : g[v])
		if (!used[i])
			dfs_order(i);
}

int color[MAXN];

void dfs_color(int v, int col) {
	color[v] = col;
	used[v] = true;
	for (auto i : rev_g[v])
		if (!used[i])
			dfs_color(i, col);
}

vector<int> vert[MAXN];
int sz[MAXN];

void run() {
	clear();
	for (int i = 0; i < n; i++)
		if (!used[i])
			dfs_order(i);
	reverse(order.begin(), order.end());
	clear();
	int col = 0;
	for (int i = 0; i < n; i++)
		if (!used[i])
			dfs_color(i, col++);

	for (int i = 0; i < n; i++)
		vert[color[i]].push_back(i);

	set<int> good;

	for (auto i : ed) {
		int u = color[i.first], v = color[i.second];
		if (u != v && !gr[u].count(v)) {
			gr[u].insert(v);
			sz[v]++;
		}
	}

	for (int i = 0; i < col; i++)
		if (sz[i] == 0)
			good.insert(i);

	int root = *good.begin();
	good.erase(good.begin());
	int v = vert[root].back();
	vert[root].pop_back();

	while (!good.empty()) {
		int new_root = *good.begin();
		good.erase(good.begin());

		while (!vert[new_root].empty()) {
			int u = vert[new_root].back();
			vert.pop_back();
			int fans = qwery(u, v);
			if (fans == 0) {
				swap(u, v);
				swap(new_root, root);
			}
		}

		for (auto i : gr[new_root]) {
			sz[i]--;
			if (sz[i] == 0)
				good.insert(i);
		}
	}

	out_ans(v);

}

void write() {

}

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	read();
	run();
	write();
	return 0;
}


#include <bits/stdc++.h>

using namespace std;
#define int long long
const int MAXN = 1e5 + 10;
vector<int> g[MAXN], rev_g[MAXN];
set<int> gr[MAXN];
vector<pair <int, int> > ed;
int n, m;
bool used[MAXN];

void clear() {
	for (int i = 0; i < n; i++)
		used[i] = false;
}

int qwery(int u, int v) {
	cout << "? " << u + 1 << " " << v + 1 << endl;
	int q;
	cin >> q;
	return q;
}

void out_ans(int ans) {
	cout << "! " << ans + 1 << endl;
	exit(0);
}

void read() {
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		int u, v;
		cin >> u >> v;
		u--;
		v--;
		g[u].push_back(v);
		rev_g[v].push_back(u);
		ed.push_back({u, v});
	}
}

vector<int> order;

void dfs_order(int v) {
	used[v] = true;
	for (auto i : g[v])
		if (!used[i])
			dfs_order(i);
}

int color[MAXN];

void dfs_color(int v, int col) {
	color[v] = col;
	used[v] = true;
	for (auto i : rev_g[v])
		if (!used[i])
			dfs_color(i, col);
}

vector<int> vert[MAXN];
int sz[MAXN];

void run() {
	clear();
	for (int i = 0; i < n; i++)
		if (!used[i])
			dfs_order(i);

	reverse(order.begin(), order.end());
	clear();
	int col = 0;
	for (int i = 0; i < n; i++)
		if (!used[i])
			dfs_color(i, col++);

/*	cout << "color = ";
	for (int i = 0; i < n; i++)
		cout << color[i] << " ";
	cout << endl;
*/

	for (int i = 0; i < n; i++)
		vert[color[i]].push_back(i);

	set<int> good;

	for (auto i : ed) {
		int u = color[i.first], v = color[i.second];
		if (u != v && !gr[u].count(v)) {
			gr[u].insert(v);
			sz[v]++;
		}
	}

	for (int i = 0; i < col; i++)
		if (sz[i] == 0)
			good.insert(i);

	cout << "good = ";
	for (auto i : good)
		cout << i << " ";
	cout << endl;

	int root = *good.begin();
	good.erase(good.begin());
	int v = vert[root].back();
	vert[root].pop_back();

	while (!good.empty()) {
		int new_root = *good.begin();
		good.erase(good.begin());

		while (!vert[new_root].empty()) {
			int u = vert[new_root].back();
			vert[new_root].pop_back();

			int fans = qwery(v, u);
			if (fans == 0) {
				swap(u, v);
				swap(new_root, root);
			}
		}

		for (auto i : gr[new_root]) {
			sz[i]--;
			if (sz[i] == 0)
				good.insert(i);
		}
	}

	out_ans(v);
}

void write() {

}

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	read();
	run();
	write();
	return 0;
}


#include <bits/stdc++.h>

using namespace std;
#define int long long
const int MAXN = 1e5 + 10;
int n, m;
vector<int> g[MAXN], rev_g[MAXN];
set<int> gr[MAXN];
vector<pair <int, int> > ed;
vector<int> order;

bool used[MAXN];
int color[MAXN], sz[MAXN];

vector<int> colors[MAXN];
set <int> good;

int query(int u, int v) {
	cout << "? " << u + 1 << " " << v + 1 << endl;
	int q;
	cin >> q;
	return q;
}

void out(int ans) {
	cout << "! " << ans + 1 << endl;
	exit(0);
}

void read() {
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		int u, v;
		cin >> u >> v;
		u--;
		v--;
		ed.push_back({u, v});
		g[u].push_back(v);
		rev_g[v].push_back(u);
	}
}

void dfs_order(int v) {
	used[v] = true;
	for (auto i : g[v])
		if (!used[i])
			dfs_order(i);
	order.push_back(v);
}

void dfs_color(int v, int c) {
	color[v] = c;
	for (auto i : rev_g[v])
		if (!color[i])
			dfs_color(i, c);
}

void clear() {
	for (int i = 0; i < n; i++)
		used[i] = false;
}

void run() {
	clear();
	for (int i = 0; i < n; i++)
		if (!used[i])
			dfs_order(i);
	clear();
	reverse(order.begin(), order.end());
	int col = 1;
	for (auto i : order)
		if (!color[i])
			dfs_color(i, col++);
	clear();
	for (auto i : ed) {
		if (color[i.first] != color[i.second] && !gr[color[i.first] - 1].count(color[i.second] - 1)) {
			gr[color[i.first] - 1].insert(color[i.second] - 1);
			sz[color[i.second] - 1]++;
		}
	}

	col--;

	for (int i = 0; i < n; i++)
		colors[color[i] - 1].push_back(i);

	for (int i = 0; i < col; i++)
		if (sz[i] == 0)
			good.insert(i);

	/*cout << "color = ";
	for (int i = 0; i < n; i++)
		cout << color[i] << " ";
	cout << endl;*/

	int help_root = *good.begin();
	good.erase(good.begin());

	int root = colors[help_root].back();
	colors[help_root].pop_back();

	while (!good.empty()) {
		int v = *good.begin();
		good.erase(good.begin());

		while (!colors[v].empty()) {
			int u = colors[v].back();
			colors[v].pop_back();

			int q = query(root, u);
			if (q == 0){
				swap(u, root);
				swap(v, help_root);
			}
		}

		for (auto i : gr[v]) {
			sz[i]--;
			if (sz[i] == 0)
				good.insert(i);
		}
	}

	out(root);
}

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	read();
	run();
	return 0;
}


#include <bits/stdc++.h>

using namespace std;
#define int long long
const int MAXN = 1e5 + 10;
int n, m;
vector<int> g[MAXN], rev_g[MAXN];
set<int> gr[MAXN];
vector<pair <int, int> > ed;
vector<int> order;

bool used[MAXN];
int color[MAXN], sz[MAXN];

vector<int> colors[MAXN];
deque <int> good;

int query(int u, int v) {
	cout << "? " << u + 1 << " " << v + 1 << endl;
	int q;
	cin >> q;
	return q;
}

void out(int ans) {
	cout << "! " << ans + 1 << endl;
	exit(0);
}

void read() {
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		int u, v;
		cin >> u >> v;
		u--;
		v--;
		ed.push_back({u, v});
		g[u].push_back(v);
		rev_g[v].push_back(u);
	}
}

void dfs_order(int v) {
	used[v] = true;
	for (auto i : g[v])
		if (!used[i])
			dfs_order(i);
	order.push_back(v);
}

void dfs_color(int v, int c) {
	color[v] = c;
	for (auto i : rev_g[v])
		if (!color[i])
			dfs_color(i, c);
}

void clear() {
	for (int i = 0; i < n; i++)
		used[i] = false;
}

void run() {
	clear();
	for (int i = 0; i < n; i++)
		if (!used[i])
			dfs_order(i);
	clear();
	reverse(order.begin(), order.end());
	int col = 1;
	for (int i = 0; i < n; i++)
		if (!color[i])
			dfs_color(i, col++);
	clear();
	for (auto i : ed) {
		if (color[i.first] != color[i.second] && !gr[color[i.first] - 1].count(color[i.second] - 1)) {
			gr[color[i.first] - 1].insert(color[i.second] - 1);
			sz[color[i.second] - 1]++;
		}
	}

	col--;

	for (int i = 0; i < n; i++)
		colors[color[i] - 1].push_back(i);

	for (int i = 0; i < col; i++)
		if (sz[i] == 0)
			good.push_back(i);

/*	cout << "color = ";
	for (int i = 0; i < n; i++)
		cout << color[i] << " ";
	cout << endl;*/

	int help_root = good[0];
	int root = colors[help_root].back();
	colors[help_root].pop_back();
	good.pop_front();

	while (!good.empty()) {
		int v = good[0];
		good.pop_front();

		while (colors[v].size() > 0) {
			int u = colors[v].back();
			colors[v].pop_back();
			int q = query(root, u);
			if (q == 0){
				swap(u, root);
				swap(v, help_root);
			}
		}

		for (auto i : gr[v]) {
			sz[i]--;
			if (sz[i] == 0)
				good.push_back(i);
		}
	}

	out(root);
}

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	read();
	run();
	return 0;
}


#include <bits/stdc++.h>

using namespace std;
#define int long long
const int MAXN = 1e5 + 10;
int n, m;
vector<int> g[MAXN], rev_g[MAXN];
vector<int> gr[MAXN];
vector<pair <int, int> > ed;
vector<int> order;

bool used[MAXN];
int color[MAXN], sz[MAXN];

vector<int> colors[MAXN];
deque <int> good;

int query(int u, int v) {
	cout << "? " << u + 1 << " " << v + 1 << endl;
	int q;
	cin >> q;
	return q;
}

void out(int ans) {
	cout << "! " << ans + 1 << endl;
	exit(0);
}

void read() {
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		int u, v;
		cin >> u >> v;
		u--;
		v--;
		ed.push_back({u, v});
		g[u].push_back(v);
		rev_g[v].push_back(u);
	}
}

void dfs_order(int v) {
	used[v] = true;
	for (auto i : g[v])
		if (!used[i])
			dfs_order(i);
	order.push_back(v);
}

void dfs_color(int v, int c) {
	color[v] = c;
	for (auto i : rev_g[v])
		if (!color[i])
			dfs_color(i, c);
}

void clear() {
	for (int i = 0; i < n; i++)
		used[i] = false;
}

void run() {
	clear();
	for (int i = 0; i < n; i++)
		if (!used[i])
			dfs_order(i);
	clear();
	reverse(order.begin(), order.end());
	int col = 1;
	for (int i = 0; i < n; i++)
		if (!color[i])
			dfs_color(i, col++);
	clear();
	for (auto i : ed) {
		if (color[i.first] != color[i.second]) {
			gr[color[i.first] - 1].push_back(color[i.second] - 1);
			sz[color[i.second] - 1]++;
		}
	}

	col--;

	for (int i = 0; i < n; i++)
		colors[color[i] - 1].push_back(i);

	for (int i = 0; i < col; i++)
		if (sz[i] == 0)
			good.push_back(i);

	/*cout << "color = ";
	for (int i = 0; i < n; i++)
		cout << color[i] << " ";
	cout << endl;*/

	int help_root = good[0];
	int root = colors[help_root].back();
	colors[help_root].pop_back();
	good.pop_front();

	while (!good.empty()) {
		int v = good[0];
		good.pop_front();

		while (colors[v].size() > 0) {
			int u = colors[v].back();
			colors[v].pop_back();
			int q = query(root, u);
			if (q == 0){
				swap(u, root);
				swap(v, help_root);
			}
		}

		for (auto i : gr[v]) {
			sz[i]--;
			if (sz[i] == 0)
				good.push_back(i);
		}
	}

	out(root);
}

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	read();
	run();
	return 0;
}


#include <bits/stdc++.h>

using namespace std;
#define int long long
const int MAXN = 1e5 + 10;
vector<vector<int>> g, rev_g;
vector<set<int>> gr;
vector<pair <int, int> > ed;
int n, m;
bool used[MAXN];

void clear() {
    for (int i = 0; i < n; i++)
        used[i] = false;
}

int qwery(int u, int v) {
    cout << "? " << u + 1 << " " << v + 1 << endl;
    int q;
    cin >> q;
    return q;
}

void out_ans(int ans) {
    cout << "! " << ans + 1 << endl;
    exit(0);
}

void read() {
    cin >> n >> m;
    g.resize(n);
    rev_g.resize(n);
    for (int i = 0; i < m; i++) {
        int u, v;
        cin >> u >> v;
        u--;
        v--;
        g[u].push_back(v);
        rev_g[v].push_back(u);
        ed.push_back({u, v});
    }
}

vector<int> order;

void dfs_order(int v) {
    used[v] = true;
    for (auto i : g[v])
        if (!used[i])
            dfs_order(i);
}

int color[MAXN];

void dfs_color(int v, int col) {
    color[v] = col;
    used[v] = true;
    for (auto i : rev_g[v])
        if (!used[i])
            dfs_color(i, col);
}

set<int> vert[MAXN];
int sz[MAXN];

void run() {
    clear();
    for (int i = 0; i < n; i++)
        if (!used[i])
            dfs_order(i);

    reverse(order.begin(), order.end());
    clear();
    int col = 0;
    for (int i = 0; i < n; i++)
        if (!used[i])
            dfs_color(i, col++);

/*  cout << "color = ";
    for (int i = 0; i < n; i++)
        cout << color[i] << " ";
    cout << endl;
*/

    for (int i = 0; i < n; i++)
        vert[color[i]].insert(i);

    set<int> good;

    gr.resize(col);

    for (auto i : ed) {
        int u = color[i.first], v = color[i.second];
        if (u != v && !gr[u].count(v)) {
            gr[u].insert(v);
            sz[v]++;
        }
    }

    for (int i = 0; i < col; i++)
        if (sz[i] == 0)
            good.insert(i);

   /* cout << "good = ";
    for (auto i : good)
        cout << i << " ";
    cout << endl;*/

    int root = *good.begin();
    good.erase(good.begin());
    int v = *vert[root].begin();
    vert[root].erase(vert[root].begin());

    while (!good.empty()) {
        int new_root = *good.begin();
        good.erase(good.begin());
        int u = *vert[new_root].begin();
        vert[new_root].erase(vert[new_root].begin());
        int fans = qwery(v, u);
        if (fans == 0) {
            swap(v, u);
            swap(root, new_root);
        }

        if (!vert[new_root].empty()) {
              good.insert(new_root);
        }
        else {
            for (auto i : gr[new_root]) {
                sz[i]--;
                if (sz[i] == 0) {
                    good.insert(i);
                }
            }
        }
    }

    out_ans(v);
}

void write() {

}

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    read();
    run();
    write();
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
#define int long long
const int MAXN = 1e5 + 10;
vector<int> g[MAXN], rev_g[MAXN];
set<int> gr[MAXN];
vector<pair <int, int> > ed;
int n, m;
bool used[MAXN];

void clear() {
    for (int i = 0; i < n; i++)
        used[i] = false;
}

int qwery(int u, int v) {
    cout << "? " << u + 1 << " " << v + 1 << endl;
    int q;
    cin >> q;
    return q;
}

void out_ans(int ans) {
    cout << "! " << ans + 1 << endl;
    exit(0);
}

void read() {
    cin >> n >> m;
    for (int i = 0; i < m; i++) {
        int u, v;
        cin >> u >> v;
        u--;
        v--;
        g[u].push_back(v);
        rev_g[v].push_back(u);
        ed.push_back({u, v});
    }
}

vector<int> order;

void dfs_order(int v) {
    used[v] = true;
    for (auto i : g[v])
        if (!used[i])
            dfs_order(i);
}

int color[MAXN];

void dfs_color(int v, int col) {
    color[v] = col;
    used[v] = true;
    for (auto i : rev_g[v])
        if (!used[i])
            dfs_color(i, col);
}

set<int> vert[MAXN];
int sz[MAXN];

void run() {
    clear();
    for (int i = 0; i < n; i++)
        if (!used[i])
            dfs_order(i);

    reverse(order.begin(), order.end());
    clear();
    int col = 0;
    for (int i = 0; i < n; i++)
        if (!used[i])
            dfs_color(i, col++);

/*  cout << "color = ";
    for (int i = 0; i < n; i++)
        cout << color[i] << " ";
    cout << endl;
*/

    for (int i = 0; i < n; i++)
        vert[color[i]].insert(i);

    set<int> good;

    for (auto i : ed) {
        int u = color[i.first], v = color[i.second];
        if (u != v && !gr[u].count(v)) {
            gr[u].insert(v);
            sz[v]++;
        }
    }

    for (int i = 0; i < col; i++)
        if (sz[i] == 0)
            good.insert(i);

   /* cout << "good = ";
    for (auto i : good)
        cout << i << " ";
    cout << endl;*/

    int root = *good.begin();
    good.erase(good.begin());
    int v = *vert[root].begin();
    vert[root].erase(vert[root].begin());

    while (!good.empty()) {
        int new_root = *good.begin();
        good.erase(good.begin());

        while (!vert[new_root].empty()) {
            int u = *vert[new_root].begin();
            vert[new_root].erase(vert[new_root].begin());

            int fans = qwery(v, u);
            if (fans == 0) {
                swap(u, v);
                swap(new_root, root);
            }
        }

        for (auto i : gr[new_root]) {
            sz[i]--;
            if (sz[i] == 0)
                good.insert(i);
        }
    }

    out_ans(v);
}

void write() {

}

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    read();
    run();
    write();
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
#define int long long
const int MAXN = 1e5 + 10;
int n, m;
vector<int> g[MAXN], rev_g[MAXN];
set<int> gr[MAXN];
vector<pair <int, int> > ed;
vector<int> order;

bool used[MAXN];
int color[MAXN], sz[MAXN];

vector<int> colors[MAXN];
set <int> good;

int query(int u, int v) {
	cout << "? " << u + 1 << " " << v + 1 << endl;
	int q;
	cin >> q;
	return q;
}

void out(int ans) {
	cout << "! " << ans + 1 << endl;
	exit(0);
}

void read() {
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		int u, v;
		cin >> u >> v;
		u--;
		v--;
		ed.push_back({u, v});
		g[u].push_back(v);
		rev_g[v].push_back(u);
	}
}

void dfs_order(int v) {
	used[v] = true;
	for (auto i : g[v])
		if (!used[i])
			dfs_order(i);
	order.push_back(v);
}

void dfs_color(int v, int c) {
	color[v] = c;
	for (auto i : rev_g[v])
		if (!color[i])
			dfs_color(i, c);
}

void clear() {
	for (int i = 0; i < n; i++)
		used[i] = false;
}

void run() {
	clear();
	for (int i = 0; i < n; i++)
		if (!used[i])
			dfs_order(i);
	clear();
	reverse(order.begin(), order.end());
	int col = 1;
	for (int i = 0; i < n; i++)
		if (!color[i])
			dfs_color(i, col++);
	clear();
	for (auto i : ed) {
		if (color[i.first] != color[i.second] && !gr[color[i.first] - 1].count(color[i.second] - 1)) {
			gr[color[i.first] - 1].insert(color[i.second] - 1);
			sz[color[i.second] - 1]++;
		}
	}

	col--;

	for (int i = 0; i < n; i++)
		colors[color[i] - 1].push_back(i);

	for (int i = 0; i < col; i++)
		if (sz[i] == 0)
			good.insert(i);

	/*cout << "color = ";
	for (int i = 0; i < n; i++)
		cout << color[i] << " ";
	cout << endl;*/

	int help_root = *good.begin();
	good.erase(good.begin());

	int root = colors[help_root].back();
	colors[help_root].pop_back();

	while (!good.empty()) {
		int v = *good.begin();
		good.erase(good.begin());

		while (!colors[v].empty()) {
			int u = colors[v].back();
			colors[v].pop_back();

			int q = query(root, u);
			if (q == 0){
				swap(u, root);
				swap(v, help_root);
			}
		}

		for (auto i : gr[v]) {
			sz[i]--;
			if (sz[i] == 0)
				good.insert(i);
		}
	}

	out(root);
}

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	read();
	run();
	return 0;
}


#include <bits/stdc++.h>

using namespace std;
#define int long long
const int MAXN = 1e5 + 10;
int n, m;
vector<int> g[MAXN], rev_g[MAXN], gr[MAXN];
vector<pair <int, int> > ed;
vector<int> order;

bool used[MAXN];
int color[MAXN], sz[MAXN];

vector<int> colors[MAXN];
set <int> good;

int query(int u, int v) {
    cout << "? " << u + 1 << " " << v + 1 << endl;
    int q;
    cin >> q;
    return q;
}

void out(int ans) {
    cout << "! " << ans + 1 << endl;
    exit(0);
}

void read() {
    cin >> n >> m;
    for (int i = 0; i < m; i++) {
        int u, v;
        cin >> u >> v;
        u--;
        v--;
        ed.push_back({u, v});
        g[u].push_back(v);
        rev_g[v].push_back(u);
    }
}

void dfs_order(int v) {
    used[v] = true;
    for (auto i : g[v])
        if (!used[i])
            dfs_order(i);
    order.push_back(v);
}

void dfs_color(int v, int c) {
    color[v] = c;
    for (auto i : rev_g[v])
        if (!color[i])
            dfs_color(i, c);
}

void clear() {
    for (int i = 0; i < n; i++)
        used[i] = false;
}

void run() {
    for (int i = 0; i < n; i++)
        if (!used[i])
            dfs_order(i);
    clear();

    reverse(order.begin(), order.end());
    int col = 1;
    for (auto i : order)
        if (!color[i])
            dfs_color(i, col++);

    for (auto i : ed) {
        int u = color[i.first] - 1, v = color[i.second] - 1;
        if (u != v) {
            gr[u].push_back(v);
            sz[v]++;
        }
    }

    col--;

    for (int i = 0; i < n; i++)
        colors[color[i] - 1].push_back(i);

    for (int i = 0; i < col; i++)
        if (sz[i] == 0)
            good.insert(i);

    int help_root = *good.begin();
    good.erase(good.begin());

    int root = colors[help_root].back();
    colors[help_root].pop_back();

    while (!good.empty()) {
        int v = *good.begin();
        good.erase(good.begin());

        while (!colors[v].empty()) {
            int u = colors[v].back();
            colors[v].pop_back();

            int q = query(root, u);
            if (q == 0){
                swap(u, root);
                swap(v, help_root);
            }
        }

        for (auto i : gr[v]) {
            sz[i]--;
            if (sz[i] == 0)
                good.insert(i);
        }
    }

    out(root);
}

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    read();
    run();
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
#define int long long
const int MAXN = 1e5 + 10;
vector<int> g[MAXN], rev_g[MAXN];
set<int> gr[MAXN];
vector<pair <int, int> > ed;
int n, m;
bool used[MAXN];

void clear() {
	for (int i = 0; i < n; i++)
		used[i] = false;
}

int qwery(int u, int v) {
	cout << "? " << u + 1 << " " << v + 1 << endl;
	int q;
	cin >> q;
	return q;
}

void out_ans(int ans) {
	cout << "! " << ans + 1 << endl;
	exit(0);
}

void read() {
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		int u, v;
		cin >> u >> v;
		u--;
		v--;
		g[u].push_back(v);
		rev_g[v].push_back(u);
		ed.push_back({u, v});
	}
}

vector<int> order;

void dfs_order(int v) {
	used[v] = true;
	for (auto i : g[v])
		if (!used[i])
			dfs_order(i);
}

int color[MAXN];

void dfs_color(int v, int col) {
	color[v] = col;
	used[v] = true;
	for (auto i : rev_g[v])
		if (!used[i])
			dfs_color(i, col);
}

vector<int> vert[MAXN];
int sz[MAXN];

void run() {
	clear();
	for (int i = 0; i < n; i++)
		if (!used[i])
			dfs_order(i);
	reverse(order.begin(), order.end());
	clear();
	int col = 0;
	for (int i = 0; i < n; i++)
		if (!used[i])
			dfs_color(i, col++);

	cout << "color = ";
	for (int i = 0; i < n; i++)
		cout << color[i] << " ";
	cout << endl;

	for (int i = 0; i < n; i++)
		vert[color[i]].push_back(i);

	set<int> good;

	for (auto i : ed) {
		int u = color[i.first], v = color[i.second];
		if (u != v && !gr[u].count(v)) {
			gr[u].insert(v);
			sz[v]++;
		}
	}

	for (int i = 0; i < col; i++)
		if (sz[i] == 0)
			good.insert(i);

	int root = *good.begin();
	good.erase(good.begin());
	int v = vert[root].back();
	vert[root].pop_back();

	while (!good.empty()) {
		int new_root = *good.begin();
		good.erase(good.begin());

		while (!vert[new_root].empty()) {
			int u = vert[new_root].back();
			vert[new_root].pop_back();
			int fans = qwery(v, u);
			if (fans == 0) {
				swap(u, v);
				swap(new_root, root);
			}
		}

		for (auto i : gr[new_root]) {
			sz[i]--;
			if (sz[i] == 0)
				good.insert(i);
		}
	}

	out_ans(v);

}

void write() {

}

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	read();
	run();
	write();
	return 0;
}


#include <bits/stdc++.h>

using namespace std;
#define int long long
const int MAXN = 1e5 + 10;
vector<vector<int>> g, rev_g;
vector<set<int>> gr;
vector<pair <int, int> > ed;
int n, m;
bool used[MAXN];

void clear() {
    for (int i = 0; i < n; i++)
        used[i] = false;
}

int qwery(int u, int v) {
    cout << "? " << u + 1 << " " << v + 1 << endl;
    int q;
    cin >> q;
    return q;
}

void out_ans(int ans) {
    cout << "! " << ans + 1 << endl;
    exit(0);
}

void read() {
    cin >> n >> m;
    g.resize(n);
    rev_g.resize(n);
    for (int i = 0; i < m; i++) {
        int u, v;
        cin >> u >> v;
        u--;
        v--;
        g[u].push_back(v);
        rev_g[v].push_back(u);
        ed.push_back({u, v});
    }
}

vector<int> order;

void dfs_order(int v) {
    used[v] = true;
    for (auto i : g[v])
        if (!used[i])
            dfs_order(i);
}

int color[MAXN];

void dfs_color(int v, int col) {
    color[v] = col;
    used[v] = true;
    for (auto i : rev_g[v])
        if (!used[i])
            dfs_color(i, col);
}

set<int> vert[MAXN];
int sz[MAXN];

void run() {
    clear();
    for (int i = 0; i < n; i++)
        if (!used[i])
            dfs_order(i);

    reverse(order.begin(), order.end());
    clear();
    int col = 0;
    for (int i = 0; i < n; i++)
        if (!used[i])
            dfs_color(i, col++);

/*  cout << "color = ";
    for (int i = 0; i < n; i++)
        cout << color[i] << " ";
    cout << endl;
*/

    for (int i = 0; i < n; i++)
        vert[color[i]].insert(i);

    set<int> good;

    gr.resize(col);

    for (auto i : ed) {
        int u = color[i.first], v = color[i.second];
        if (u != v && !gr[u].count(v)) {
            gr[u].insert(v);
            sz[v]++;
        }
    }

    for (int i = 0; i < col; i++)
        if (sz[i] == 0)
            good.insert(i);

   /* cout << "good = ";
    for (auto i : good)
        cout << i << " ";
    cout << endl;*/

    int root = *good.begin();
    good.erase(good.begin());
    int v = *vert[root].begin();
    vert[root].erase(vert[root].begin());

    while (!good.empty()) {
        int new_root = *good.begin();
        good.erase(good.begin());

        while (!vert[new_root].empty()) {
            int u = *vert[new_root].begin();
            vert[new_root].erase(vert[new_root].begin());

            int fans = qwery(v, u);
            if (fans == 0) {
                swap(u, v);
                swap(new_root, root);
            }
        }

        for (auto i : gr[new_root]) {
            sz[i]--;
            if (sz[i] == 0) {
                good.insert(i);
            }
        }
    }

    out_ans(v);
}

void write() {

}

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    read();
    run();
    write();
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
#define int long long
const int MAXN = 1e5 + 10;
int n, m;
vector<int> g[MAXN], rev_g[MAXN];
set<int> gr[MAXN];
vector<pair <int, int> > ed;
vector<int> order;

bool used[MAXN];
int color[MAXN], sz[MAXN];

vector<int> colors[MAXN];
set <int> good;

int query(int u, int v) {
	cout << "? " << u + 1 << " " << v + 1 << endl;
	int q;
	cin >> q;
	return q;
}

void out(int ans) {
	cout << "! " << ans + 1 << endl;
	exit(0);
}

void read() {
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		int u, v;
		cin >> u >> v;
		u--;
		v--;
		ed.push_back({u, v});
		g[u].push_back(v);
		rev_g[v].push_back(u);
	}
}

void dfs_order(int v) {
	used[v] = true;
	for (auto i : g[v])
		if (!used[i])
			dfs_order(i);
	order.push_back(v);
}

void dfs_color(int v, int c) {
	color[v] = c;
	used[v] = true;
	for (auto i : rev_g[v])
		if (!used[i])
			dfs_color(i, c);
}

void clear() {
	for (int i = 0; i < n; i++)
		used[i] = false;
}

void run() {
	clear();
	for (int i = 0; i < n; i++)
		if (!used[i])
			dfs_order(i);

	clear();
	reverse(order.begin(), order.end());

	int col = 0;
	for (int i = 0; i < n; i++)
		if (!used[i])
			dfs_color(i, col++);

	clear();
	for (auto i : ed) {
		int v = color[i.first], u = color[i.second];
		if (v != u && !gr[v].count(u)) {
			gr[v].insert(u);
			sz[u]++;
		}
	}

	for (int i = 0; i < n; i++)
		colors[color[i]].push_back(i);

	for (int i = 0; i < col; i++)
		if (sz[i] == 0)
			good.insert(i);

	/*cout << "color = ";
	for (int i = 0; i < n; i++)
		cout << color[i] << " ";
	cout << endl;*/

	int help_root = *good.begin();
	good.erase(good.begin());

	int root = colors[help_root].back();
	colors[help_root].pop_back();

	while (!good.empty()) {
		int v = *good.begin();
		good.erase(good.begin());

		while (!colors[v].empty()) {
			int u = colors[v].back();
			colors[v].pop_back();

			int q = query(root, u);
			if (q == 0){
				swap(u, root);
				swap(v, help_root);
			}
		}

		for (auto i : gr[v]) {
			sz[i]--;
			if (sz[i] == 0)
				good.insert(i);
		}
	}

	out(root);
}

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	read();
	run();
	return 0;
}


#include <bits/stdc++.h>

using namespace std;
#define int long long
const int MAXN = 1e5 + 10;
vector<int> g[MAXN], rev_g[MAXN];
set<int> gr[MAXN];
vector<pair <int, int> > ed;
int n, m;
bool used[MAXN];

void clear() {
	for (int i = 0; i < n; i++)
		used[i] = false;
}

int qwery(int u, int v) {
	cout << "? " << u + 1 << " " << v + 1 << endl;
	int q;
	cin >> q;
	return q;
}

void out_ans(int ans) {
	cout << "! " << ans + 1 << endl;
	exit(0);
}

void read() {
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		int u, v;
		cin >> u >> v;
		u--;
		v--;
		g[u].push_back(v);
		rev_g[v].push_back(u);
		ed.push_back({u, v});
	}
}

vector<int> order;

void dfs_order(int v) {
	used[v] = true;
	for (auto i : g[v])
		if (!used[i])
			dfs_order(i);
}

int color[MAXN];

void dfs_color(int v, int col) {
	color[v] = col;
	used[v] = true;
	for (auto i : rev_g[v])
		if (!used[i])
			dfs_color(i, col);
}

vector<int> vert[MAXN];
int sz[MAXN];

void run() {
	clear();
	for (int i = 0; i < n; i++)
		if (!used[i])
			dfs_order(i);
	reverse(order.begin(), order.end());
	clear();
	int col = 0;
	for (int i = 0; i < n; i++)
		if (!used[i])
			dfs_color(i, col++);

	for (int i = 0; i < n; i++)
		vert[color[i]].push_back(i);

	set<int> good;

	for (auto i : ed) {
		int u = color[i.first], v = color[i.second];
		if (u != v && !gr[u].count(v)) {
			gr[u].insert(v);
			sz[v]++;
		}
	}

	for (int i = 0; i < col; i++)
		if (sz[i] == 0)
			good.insert(i);

	int root = *good.begin();
	good.erase(good.begin());
	int v = vert[root].back();
	vert[root].pop_back();

	while (!good.empty()) {
		int new_root = *good.begin();
		good.erase(good.begin());

		while (!vert[new_root].empty()) {
			int u = vert[new_root].back();
			vert[new_root].pop_back();
			int fans = qwery(u, v);
			if (fans == 0) {
				swap(u, v);
				swap(new_root, root);
			}
		}

		for (auto i : gr[new_root]) {
			sz[i]--;
			if (sz[i] == 0)
				good.insert(i);
		}
	}

	out_ans(v);

}

void write() {

}

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	read();
	run();
	write();
	return 0;
}


#include <bits/stdc++.h>

using namespace std;
#define int long long
const int MAXN = 1e5 + 10;
int n, m;
vector<int> g[MAXN], rev_g[MAXN];
vector<int> gr[MAXN];
vector<pair <int, int> > ed;
vector<int> order;

bool used[MAXN];
int color[MAXN], sz[MAXN];

vector<int> colors[MAXN];
deque <int> good;

int query(int u, int v) {
	cout << "? " << u + 1 << " " << v + 1 << endl;
	int q;
	cin >> q;
	return q;
}

void out(int ans) {
	cout << "! " << ans << endl;
	exit(0);
}

void read() {
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		int u, v;
		cin >> u >> v;
		u--;
		v--;
		ed.push_back({u, v});
		g[u].push_back(v);
		rev_g[v].push_back(u);
	}
}

void dfs_order(int v) {
	used[v] = true;
	for (auto i : g[v])
		if (!used[i])
			dfs_order(i);
	order.push_back(v);
}

void dfs_color(int v, int c) {
	color[v] = c;
	for (auto i : rev_g[v])
		if (!color[i])
			dfs_color(i, c);
}

void clear() {
	for (int i = 0; i < n; i++)
		used[i] = false;
}

void run() {
	clear();
	for (int i = 0; i < n; i++)
		if (!used[i])
			dfs_order(i);
	clear();
	reverse(order.begin(), order.end());
	int col = 1;
	for (int i = 0; i < n; i++)
		if (!color[i])
			dfs_color(i, col++);
	clear();
	for (auto i : ed) {
		if (color[i.first] != color[i.second]) {
			gr[color[i.first] - 1].push_back(color[i.second] - 1);
			sz[color[i.second] - 1]++;
		}
	}

	col--;

	for (int i = 0; i < n; i++)
		colors[color[i] - 1].push_back(i);

	for (int i = 0; i < col; i++)
		if (sz[i] == 0)
			good.push_back(i);

	/*cout << "color = ";
	for (int i = 0; i < n; i++)
		cout << color[i] << " ";
	cout << endl;*/

	int help_root = good[0];
	int root = colors[help_root].back();
	colors[help_root].pop_back();
	good.pop_front();

	while (!good.empty()) {
		int v = good[0];
		good.pop_front();

		while (colors[v].size() > 0) {
			int u = colors[v].back();
			colors[v].pop_back();
			int q = query(root, u);
			if (q == 0){
				swap(u, root);
				swap(v, help_root);
			}
		}

		for (auto i : gr[v]) {
			sz[i]--;
			if (sz[i] == 0)
				good.push_back(i);
		}
	}

	out(root);
}

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	read();
	run();
	return 0;
}


#include<bits/stdc++.h>

using namespace std;
const int MX = 1e5 + 228;
vector<int>g[MX];
vector<int>rg[MX];
vector<int>comps[MX];
vector<int>aa[MX];
int seg[MX];
int sz = 0;
int num = 0;
int order[MX];
bool used[MX];
int xx[MX];
void dfs1(int v)
{
    used[v] = true;
    for(int to : g[v])
        if (!used[v])
            dfs1(to);
    order[sz] = v;
    ++sz;
}
void dfs2(int v)
{
    seg[v] = num;
    comps[num].push_back(v);
    for(int to : rg[v])
        if (seg[to] == -1)
            dfs2(to);
}

signed main()
{
    int n, m;
    cin >> n >> m;
    if (n == 1)
    {
        cout << "! 1" << endl;
        return 0;
    }
    for(int i = 0; i < m; ++i)
    {
        int v, u;
        cin >> v >> u;
        g[v].push_back(u);
        rg[u].push_back(v);
    }
    for(int i = 1; i <= n; ++i)
        if (!used[i])
            dfs1(i);
    for(int i = 1; i <= n; ++i)
        seg[i] = -1;
     for(int i = n - 1; i >= 0; --i)
        if (seg[order[i]] == -1)
        {
            dfs2(order[i]);
            ++num;
        }
    for(int i = 1; i <= n; ++i)
    {
        for(int to : g[i])
        {
            if (seg[to] != seg[i])
                aa[seg[i]].push_back(seg[to]);
        }
    }
    for(int i = 0; i < m; ++i)
    {
        sort(aa[i].begin(), aa[i].end());
        aa[i].erase(unique(aa[i].begin(), aa[i].end()), aa[i].end());
        for(int to : aa[i])
            xx[to]++;
    }
    vector<int>kek;
    for(int i = 0; i < m; ++i)
        if (!xx[i])
            kek.push_back(i);
    int from = kek[0];
    for(int i = 1; i < kek.size(); ++i)
    {
        int to = kek[i];
        while(comps[from].size() > 0 && comps[to].size() > 0)
        {
            cout << "? " << comps[from].back() << " " << comps[to].back() << endl;
            int a; cin >> a;
            if (a == 1)
                comps[to].pop_back();
            else
                comps[from].pop_back();
        }
        for(int j : aa[to])
        {
            xx[j]--;
            if (xx[j] == 0)
                kek.push_back(j);
        }
    }
    cout << "! " << comps[from].back();
    return 0;
}


#include<bits/stdc++.h>

using namespace std;
const int MX = 1e5 + 228;
vector<int>g[MX];
vector<int>rg[MX];
vector<int>comps[MX];
vector<int>aa[MX];
int seg[MX];
int sz = 0;
int num = 0;
int order[MX];
bool used[MX];
int xx[MX];
void dfs1(int v)
{
    used[v] = true;
    for(int to : g[v])
        if (!used[to])
            dfs1(to);
    order[sz] = v;
    ++sz;
}
void dfs2(int v)
{
    seg[v] = num;
    comps[num].push_back(v);
    for(int to : rg[v])
        if (seg[to] == -1)
            dfs2(to);
}

signed main()
{
    int n, m;
    cin >> n >> m;
    if (n == 1)
    {
        cout << "! 1" << endl;
        return 0;
    }
    for(int i = 0; i < m; ++i)
    {
        int v, u;
        cin >> v >> u;
        g[v].push_back(u);
        rg[u].push_back(v);
    }
    for(int i = 1; i <= n; ++i)
        if (!used[i])
            dfs1(i);
    for(int i = 1; i <= n; ++i)
        seg[i] = -1;
     for(int i = n - 1; i >= 0; --i)
        if (seg[order[i]] == -1)
        {
            dfs2(order[i]);
            ++num;
        }
    for(int i = 1; i <= n; ++i)
    {
        for(int to : g[i])
        {
            if (seg[to] != seg[i])
                aa[seg[i]].push_back(seg[to]);
        }
    }
    for(int i = 0; i < num; ++i)
    {
        sort(aa[i].begin(), aa[i].end());
        aa[i].erase(unique(aa[i].begin(), aa[i].end()), aa[i].end());
        for(int to : aa[i])
            xx[to]++;
    }
    vector<int>kek;
    for(int i = 0; i < num; ++i)
        if (!xx[i])
            kek.push_back(i);
    int from = kek.size() > 0 ? kek[0] : 0;
    for(int i = 1; i < kek.size(); ++i)
    {
        int to = kek[i];
        while(comps[from].size() > 0 && comps[to].size() > 0)
        {
            cout << "? " << comps[from].back() << " " << comps[to].back() << endl;
            int a; cin >> a;
            if (a == 1)
                comps[to].pop_back();
            else
                comps[from].pop_back();
            if (comps[from].empty())
                swap(to, from);
        }
        for(int j : aa[to])
        {
            xx[j]--;
            if (xx[j] == 0)
                kek.push_back(j);
        }
    }
    cout << "! " << comps[from].back();
    return 0;
}


#include<bits/stdc++.h>

using namespace std;
const int MX = 1e5 + 228;
vector<int>g[MX];
vector<int>rg[MX];
vector<int>comps[MX];
vector<int>aa[MX];
int seg[MX];
int sz = 0;
int num = 0;
int order[MX];
bool used[MX];
int xx[MX];
void dfs1(int v)
{
    used[v] = true;
    for(int to : g[v])
        if (!used[v])
            dfs1(to);
    order[sz] = v;
    ++sz;
}
void dfs2(int v)
{
    seg[v] = num;
    comps[num].push_back(v);
    for(int to : rg[v])
        if (seg[to] == -1)
            dfs2(to);
}

signed main()
{
    int n, m;
    cin >> n >> m;
    if (n == 1)
    {
        cout << "! 1" << endl;
        return 0;
    }
    for(int i = 0; i < m; ++i)
    {
        int v, u;
        cin >> v >> u;
        g[v].push_back(u);
        rg[u].push_back(v);
    }
    for(int i = 1; i <= n; ++i)
        if (!used[i])
            dfs1(i);
    for(int i = 1; i <= n; ++i)
        seg[i] = -1;
     for(int i = n - 1; i >= 0; --i)
        if (seg[order[i]] == -1)
        {
            dfs2(order[i]);
            ++num;
        }
    for(int i = 1; i <= n; ++i)
    {
        for(int to : g[i])
        {
            if (seg[to] != seg[i])
                aa[seg[i]].push_back(seg[to]);
        }
    }
    for(int i = 0; i < m; ++i)
    {
        sort(aa[i].begin(), aa[i].end());
        aa[i].erase(unique(aa[i].begin(), aa[i].end()), aa[i].end());
        for(int to : aa[i])
            xx[to]++;
    }
    vector<int>kek;
    for(int i = 0; i < m; ++i)
        if (!xx[i])
            kek.push_back(i);
    int from = kek.size() > 0 ? kek[0] : 0;
    for(int i = 1; i < kek.size(); ++i)
    {
        int to = kek[i];
        while(comps[from].size() > 0 && comps[to].size() > 0)
        {
            cout << "? " << comps[from].back() << " " << comps[to].back() << endl;
            int a; cin >> a;
            if (a == 1)
                comps[to].pop_back();
            else
                comps[from].pop_back();
            if (comps[v].empty())
                swap(u, v);
        }
        for(int j : aa[to])
        {
            xx[j]--;
            if (xx[j] == 0)
                kek.push_back(j);
        }
    }
    cout << "! " << comps[from].back();
    return 0;
}


#include<bits/stdc++.h>

using namespace std;
const int MX = 1e5 + 228;
vector<int>g[MX];
vector<int>rg[MX];
vector<int>comps[MX];
vector<int>aa[MX];
int seg[MX];
int sz = 0;
int num = 0;
int order[MX];
bool used[MX];
int xx[MX];
void dfs1(int v)
{
    used[v] = true;
    for(int to : g[v])
        if (!used[v])
            dfs1(to);
    order[sz] = v;
    ++sz;
}
void dfs2(int v)
{
    seg[v] = num;
    comps[num].push_back(v);
    for(int to : rg[v])
        if (seg[to] == -1)
            dfs2(to);
}

signed main()
{
    int n, m;
    cin >> n >> m;
    if (n == 1)
    {
        cout << "! 1" << endl;
        return 0;
    }
    for(int i = 0; i < m; ++i)
    {
        int v, u;
        cin >> v >> u;
        g[v].push_back(u);
        rg[u].push_back(v);
    }
    for(int i = 1; i <= n; ++i)
        if (!used[i])
            dfs1(i);
    for(int i = 1; i <= n; ++i)
        seg[i] = -1;
     for(int i = n - 1; i >= 0; --i)
        if (seg[order[i]] == -1)
        {
            dfs2(order[i]);
            ++num;
        }
    for(int i = 1; i <= n; ++i)
    {
        for(int to : g[i])
        {
            if (seg[to] != seg[i])
                aa[seg[i]].push_back(seg[to]);
        }
    }
    for(int i = 0; i < m; ++i)
    {
        sort(aa[i].begin(), aa[i].end());
        aa[i].erase(unique(aa[i].begin(), aa[i].end()), aa[i].end());
        for(int to : aa[i])
            xx[to]++;
    }
    vector<int>kek;
    for(int i = 0; i < m; ++i)
        if (!xx[i])
            kek.push_back(i);
    int from = kek.size() > 0 ? kek[0] : 0;
    for(int i = 1; i < kek.size(); ++i)
    {
        int to = kek[i];
        while(comps[from].size() > 0 && comps[to].size() > 0)
        {
            cout << "? " << comps[from].back() << " " << comps[to].back() << endl;
            int a; cin >> a;
            if (a == 1)
                comps[to].pop_back();
            else
                comps[from].pop_back();
        }
        for(int j : aa[to])
        {
            xx[j]--;
            if (xx[j] == 0)
                kek.push_back(j);
        }
    }
    cout << "! " << comps[from].back();
    return 0;
}


#include<bits/stdc++.h>

using namespace std;
const int MX = 1e5 + 228;
vector<int>g[MX];
vector<int>rg[MX];
vector<int>comps[MX];
vector<int>aa[MX];
int seg[MX];
int sz = 0;
int num = 0;
int order[MX];
bool used[MX];
int xx[MX];
void dfs1(int v)
{
    used[v] = true;
    for(int to : g[v])
        if (!used[v])
            dfs1(to);
    order[sz] = v;
    ++sz;
}
void dfs2(int v)
{
    seg[v] = num;
    comps[num].push_back(v);
    for(int to : rg[v])
        if (seg[to] == -1)
            dfs2(to);
}

signed main()
{
    int n, m;
    cin >> n >> m;
    for(int i = 0; i < m; ++i)
    {
        int v, u;
        cin >> v >> u;
        g[v].push_back(u);
        rg[u].push_back(v);
    }
    for(int i = 1; i <= n; ++i)
        if (!used[i])
            dfs1(i);
    for(int i = 1; i <= n; ++i)
        seg[i] = -1;
     for(int i = n - 1; i >= 0; --i)
        if (seg[order[i]] == -1)
        {
            dfs2(order[i]);
            ++num;
        }
    for(int i = 1; i <= n; ++i)
    {
        for(int to : g[i])
        {
            if (seg[to] != seg[i])
                aa[seg[i]].push_back(seg[to]);
        }
    }
    for(int i = 0; i < m; ++i)
    {
        sort(aa[i].begin(), aa[i].end());
        aa[i].erase(unique(aa[i].begin(), aa[i].end()), aa[i].end());
        for(int to : aa[i])
            xx[to]++;
    }
    vector<int>kek;
    for(int i = 0; i < m; ++i)
        if (!xx[i])
            kek.push_back(i);
    int from = kek[0];
    for(int i = 1; i < kek.size(); ++i)
    {
        int to = kek[i];
        while(comps[from].size() > 0 && comps[to].size() > 0)
        {
            cout << "? " << comps[from].back() << " " << comps[to].back() << endl;
            int a; cin >> a;
            if (a == 1)
                comps[to].pop_back();
            else
                comps[from].pop_back();
        }
        for(int j : aa[to])
        {
            xx[j]--;
            if (xx[j] == 0)
                kek.push_back(j);
        }
    }
    cout << "! " << comps[from].back();
    return 0;
}


#include<bits/stdc++.h>

using namespace std;
const int MX = 1e5 + 228;
vector<int>g[MX];
vector<int>rg[MX];
vector<int>comps[MX];
vector<int>aa[MX];
int seg[MX];
int sz = 0;
int num = 0;
int order[MX];
bool used[MX];
int xx[MX];
void dfs1(int v)
{
    used[v] = true;
    for(int to : g[v])
        if (!used[v])
            dfs1(to);
    order[sz] = v;
    ++sz;
}
void dfs2(int v)
{
    seg[v] = num;
    comps[num].push_back(v);
    for(int to : rg[v])
        if (seg[to] == -1)
            dfs2(to);
}

signed main()
{
    int n, m;
    cin >> n >> m;
    if (n == 1)
    {
        cout << "! 1" << endl;
        return 0;
    }
    for(int i = 0; i < m; ++i)
    {
        int v, u;
        cin >> v >> u;
        g[v].push_back(u);
        rg[u].push_back(v);
    }
    for(int i = 1; i <= n; ++i)
        if (!used[i])
            dfs1(i);
    for(int i = 1; i <= n; ++i)
        seg[i] = -1;
     for(int i = n - 1; i >= 0; --i)
        if (seg[order[i]] == -1)
        {
            dfs2(order[i]);
            ++num;
        }
    for(int i = 1; i <= n; ++i)
    {
        for(int to : g[i])
        {
            if (seg[to] != seg[i])
                aa[seg[i]].push_back(seg[to]);
        }
    }
    for(int i = 0; i < m; ++i)
    {
        sort(aa[i].begin(), aa[i].end());
        aa[i].erase(unique(aa[i].begin(), aa[i].end()), aa[i].end());
        for(int to : aa[i])
            xx[to]++;
    }
    vector<int>kek;
    for(int i = 0; i < m; ++i)
        if (!xx[i])
            kek.push_back(i);
    int from = kek.size() > 0 ? kek[0] : 0;
    for(int i = 1; i < kek.size(); ++i)
    {
        int to = kek[i];
        while(comps[from].size() > 0 && comps[to].size() > 0)
        {
            cout << "? " << comps[from].back() << " " << comps[to].back() << endl;
            int a; cin >> a;
            if (a == 1)
                comps[to].pop_back();
            else
                comps[from].pop_back();
            if (comps[from].empty())
                swap(to, from);
        }
        for(int j : aa[to])
        {
            xx[j]--;
            if (xx[j] == 0)
                kek.push_back(j);
        }
    }
    cout << "! " << comps[from].back();
    return 0;
}


#include<bits/stdc++.h>

using namespace std;
const int MX = 1e5 + 228;
vector<int>g[MX];
vector<int>rg[MX];
vector<int>comps[MX];
vector<int>aa[MX];
int seg[MX];
int sz = 0;
int num = 0;
int order[MX];
bool used[MX];
int xx[MX];
void dfs1(int v)
{
    used[v] = true;
    for(int to : g[v])
        if (!used[to])
            dfs1(to);
    order[sz] = v;
    ++sz;
}
void dfs2(int v)
{
    seg[v] = num;
    comps[num].push_back(v);
    for(int to : rg[v])
        if (seg[to] == -1)
            dfs2(to);
}

signed main()
{
    int n, m;
    cin >> n >> m;
    if (n == 1)
    {
        cout << "! 1" << endl;
        return 0;
    }
    for(int i = 0; i < m; ++i)
    {
        int v, u;
        cin >> v >> u;
        g[v].push_back(u);
        rg[u].push_back(v);
    }
    for(int i = 1; i <= n; ++i)
        if (!used[i])
            dfs1(i);
    for(int i = 1; i <= n; ++i)
        seg[i] = -1;
     for(int i = n - 1; i >= 0; --i)
        if (seg[order[i]] == -1)
        {
            dfs2(order[i]);
            ++num;
        }
    for(int i = 1; i <= n; ++i)
    {
        for(int to : g[i])
        {
            if (seg[to] != seg[i])
                aa[seg[i]].push_back(seg[to]);
        }
    }
    for(int i = 0; i < m; ++i)
    {
        sort(aa[i].begin(), aa[i].end());
        aa[i].erase(unique(aa[i].begin(), aa[i].end()), aa[i].end());
        for(int to : aa[i])
            xx[to]++;
    }
    vector<int>kek;
    for(int i = 0; i < m; ++i)
        if (!xx[i])
            kek.push_back(i);
    int from = kek.size() > 0 ? kek[0] : 0;
    for(int i = 1; i < kek.size(); ++i)
    {
        int to = kek[i];
        while(comps[from].size() > 0 && comps[to].size() > 0)
        {
            cout << "? " << comps[from].back() << " " << comps[to].back() << endl;
            int a; cin >> a;
            if (a == 1)
                comps[to].pop_back();
            else
                comps[from].pop_back();
            if (comps[from].empty())
                swap(to, from);
        }
        for(int j : aa[to])
        {
            xx[j]--;
            if (xx[j] == 0)
                kek.push_back(j);
        }
    }
    cout << "! " << comps[from].back();
    return 0;
}


#include<bits/stdc++.h>

using namespace std;
const int MX = 1e5 + 228;
vector<int>g[MX];
vector<int>rg[MX];
vector<int>comps[MX];
vector<int>aa[MX];
int seg[MX];
int sz = 0;
int num = 0;
int order[MX];
bool used[MX];
int xx[MX];
void dfs1(int v)
{
    used[v] = true;
    for(int to : g[v])
        if (!used[v])
            dfs1(to);
    order[sz] = v;
    ++sz;
}
void dfs2(int v)
{
    seg[v] = num;
    comps[num].push_back(v);
    for(int to : rg[v])
        if (seg[to] == -1)
            dfs2(to);
}

signed main()
{
    int n, m;
    cin >> n >> m;
    if (n == 1)
    {
        cout << 1 << endl;
        return 0;
    }
    for(int i = 0; i < m; ++i)
    {
        int v, u;
        cin >> v >> u;
        g[v].push_back(u);
        rg[u].push_back(v);
    }
    for(int i = 1; i <= n; ++i)
        if (!used[i])
            dfs1(i);
    for(int i = 1; i <= n; ++i)
        seg[i] = -1;
     for(int i = n - 1; i >= 0; --i)
        if (seg[order[i]] == -1)
        {
            dfs2(order[i]);
            ++num;
        }
    for(int i = 1; i <= n; ++i)
    {
        for(int to : g[i])
        {
            if (seg[to] != seg[i])
                aa[seg[i]].push_back(seg[to]);
        }
    }
    for(int i = 0; i < m; ++i)
    {
        sort(aa[i].begin(), aa[i].end());
        aa[i].erase(unique(aa[i].begin(), aa[i].end()), aa[i].end());
        for(int to : aa[i])
            xx[to]++;
    }
    vector<int>kek;
    for(int i = 0; i < m; ++i)
        if (!xx[i])
            kek.push_back(i);
    int from = kek[0];
    for(int i = 1; i < kek.size(); ++i)
    {
        int to = kek[i];
        while(comps[from].size() > 0 && comps[to].size() > 0)
        {
            cout << "? " << comps[from].back() << " " << comps[to].back() << endl;
            int a; cin >> a;
            if (a == 1)
                comps[to].pop_back();
            else
                comps[from].pop_back();
        }
        for(int j : aa[to])
        {
            xx[j]--;
            if (xx[j] == 0)
                kek.push_back(j);
        }
    }
    cout << "! " << comps[from].back();
    return 0;
}


#include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;
int gi(){
	int x=0,w=1;char ch=getchar();
	while((ch<'0'||ch>'9')&&ch!='-')ch=getchar();
	if(ch=='-')w=0,ch=getchar();
	while(ch>='0'&&ch<='9')x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
	return w?x:-x;
}
const int N=1e5+5;
int n,m,vis[N],ins[N],in[N];vector<int>tmp[N],E[N],vec;
void dfs(int u){
	vis[u]=ins[u]=1;
	for(int v:tmp[u]){
		if(!ins[v])E[u].push_back(v),++in[v];
		if(!vis[v])dfs(v);
	}
	ins[u]=0;
}
bool query(int u,int v){
	printf("? %d %d\n",u,v);fflush(stdout);
	return gi();
}
int main(){
	n=gi();m=gi();
	for(int i=1,u,v;i<=m;++i)u=gi(),v=gi(),tmp[u].push_back(v);
	for(int i=1;i<=n;++i)if(!vis[i])dfs(i);
	for(int i=1;i<=n;++i)if(!in[i])vec.push_back(i);
	while(vec.size()>1){
		int u=vec.back();vec.pop_back();
		int v=vec.back();vec.pop_back();
		if(!query(u,v))swap(u,v);vec.push_back(u);
		for(int w:E[v])if(!--in[w])vec.push_back(w);
	}
	printf("! %d\n",vec[0]);return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 1e2;

queue<int> qs[maxn];
int n, qcnt;

class Graph {
private:
    int s[maxn], t[maxn << 1], nxt[maxn << 1], dfn[maxn], low[maxn], bel[maxn], deg[maxn], dd, cnt, bcnt;
    bool ins[maxn];
    stack<int> stk;
    queue<int> bs[maxn];

    inline void dfs(int pos) {
        stk.push(pos), ins[pos] = 1, low[pos] = dfn[pos] = ++dd;
        for(int at = s[pos]; at; at = nxt[at]) {
            if(!dfn[t[at]]) dfs(t[at]), low[pos] = min(low[pos], low[t[at]]);
            else if(ins[t[at]]) low[pos] = min(low[pos], dfn[t[at]]);
        }
        if(low[pos] == dfn[pos]) {
            ++bcnt;
            do bs[bel[stk.top()] = bcnt].push(stk.top()), ins[stk.top()] = 0, stk.pop(); while(ins[pos]);
        }
    }
public:
    inline void addedge(int from, int to) {
        t[++cnt] = to, nxt[cnt] = s[from], s[from] = cnt;
    }
    inline void tarjan() {
        for(int i = 1; i <= n; i++) if(!dfn[i]) dfs(i);
        for(int pos = 1; pos <= n; pos++) for(int at = s[pos]; at; at = nxt[at]) if(bel[pos] != bel[t[at]]) ++deg[bel[t[at]]];
        for(int i = 1; i <= bcnt; i++) if(!deg[i]) qs[++qcnt] = bs[i];
    }
}gra;

inline bool ask(int x, int y) {
    printf("? %d %d\n", x, y), fflush(stdout);
    int ret; scanf("%d", &ret);
    if(!~ret) exit(0);
    return ret;
}
inline pair<int, queue<int>* > merge(int rt, queue<int>* bel, queue<int>* oth) {
    while(oth->size()) {
        int tp = oth->front(); oth->pop();
        int p = ask(rt, tp);
        if(p == 0) swap(rt, tp), swap(bel, oth);
    }
    return make_pair(rt, bel);
}

int main() {
    static int m;
    scanf("%d%d", &n, &m);
    for(int i = 1, u, v; i <= m; i++) scanf("%d%d", &u, &v), gra.addedge(u, v);
    gra.tarjan();
    pair<int, queue<int>* > cur = make_pair(qs[1].front(), qs + 1); qs[1].pop();
    for(int i = 2; i <= qcnt; i++) cur = merge(cur.first, cur.second, qs + i);
    printf("! %d\n", cur.first); // don't forget !
    return 0;
}


#include <bits/stdc++.h>
#define debug cerr
using namespace std;
const int maxn = 1e5 + 1e2;

int n;

inline bool ask(int x, int y) {
    printf("? %d %d\n", x, y), fflush(stdout);
    int ret; scanf("%d", &ret);
    if(!~ret) exit(0);
    return ret;
}
inline pair<int, queue<int>* > merge(int rt, queue<int>* bel, queue<int>* oth) {
    while(oth->size()) {
        int tp = oth->front(); oth->pop();
        int p = ask(rt, tp);
        // debug << "p = " << p << endl;
        if(p == 0) {
            // debug << "swept" << endl;
            swap(rt, tp), swap(bel, oth);
        }
    }
    return make_pair(rt, bel);
}

class Graph {
private:
    int s[maxn], t[maxn << 1], nxt[maxn << 1], dfn[maxn], low[maxn], bel[maxn], deg[maxn], dd, cnt, bcnt;
    bool ins[maxn];
    stack<int> stk;
    queue<int> bs[maxn];

    inline void dfs(int pos) {
        stk.push(pos), ins[pos] = 1, low[pos] = dfn[pos] = ++dd;
        for(int at = s[pos]; at; at = nxt[at]) {
            if(!dfn[t[at]]) dfs(t[at]), low[pos] = min(low[pos], low[t[at]]);
            else if(ins[t[at]]) low[pos] = min(low[pos], dfn[t[at]]);
        }
        if(low[pos] == dfn[pos]) {
            ++bcnt;
            do bs[bel[stk.top()] = bcnt].push(stk.top()), ins[stk.top()] = 0, stk.pop(); while(ins[pos]);
        }
    }
public:
    inline void addedge(int from, int to) {
        t[++cnt] = to, nxt[cnt] = s[from], s[from] = cnt;
    }
    inline void tarjan() {
        for(int i = 1; i <= n; i++) if(!dfn[i]) dfs(i);
    }
    inline int topo() {
        static vector<int> v[maxn];
        for(int pos = 1; pos <= n; pos++) for(int at = s[pos]; at; at = nxt[at]) {
            if(bel[pos] != bel[t[at]]) ++deg[bel[t[at]]];
            v[bel[pos]].push_back(bel[t[at]]);
        }
        deque<int> q;
        for(int i = 1; i <= bcnt; i++) if(!deg[i]) q.push_back(i);
        int curRoot = -1;
        while(q.size() > 1) {
            int h1 = q.front(); q.pop_front(); // curRoot is the root belonging to h1.
            int h2 = q.front(); q.pop_front();
            if(!~curRoot) curRoot = bs[h1].front(), bs[h1].pop();
            // debug << "curRoot = " << curRoot << endl;
            auto nw = merge(curRoot, bs + h1, bs + h2);
            if(nw.second == bs + h1) swap(h1, h2); // drop h1 and push h2 back.
            for(auto &t: v[h1]) {
                --deg[t];
                if(!deg[t]) q.push_back(t);
            }
            curRoot = nw.first, q.push_front(h2);
        }
        if(curRoot != -1) return curRoot;
        return bs[q.front()].front();
    }
}gra;

int main() {
    static int m;
    scanf("%d%d", &n, &m);
    for(int i = 1, u, v; i <= m; i++) scanf("%d%d", &u, &v), gra.addedge(u, v);
    gra.tarjan();
    printf("! %d\n", gra.topo()); // don't forget '!'
    return 0;
}