#include using namespace std; const int MAX_N = 1e6 + 10; int n, m; vector adj[MAX_N]; bool visited[MAX_N]; vector sorted_nodes; void read_input() { cin >> n >> m; for (int i = 0; i < m; i++) { int u, v; cin >> u >> v; u--, v--; adj[u].push_back(v); } } void dfs(int u) { visited[u] = true; for (int v : adj[u]) { if (!visited[v]) { dfs(v); } } sorted_nodes.push_back(u + 1); } void solve() { for (int i = 0; i < n; i++) { if (!visited[i]) { dfs(i); } } reverse(sorted_nodes.begin(), sorted_nodes.end()); } void print_output() { for (int node : sorted_nodes) { cout << node << " "; } cout << endl; } int main() { read_input(); solve(); print_output(); return 0; }