#include #include #include #include using namespace std; int n, m; vector graph[100005]; bool visited[100005]; stack st; void dfs(int node) { visited[node] = true; for(int i = 0; i < graph[node].size(); i++) { if(!visited[graph[node][i]]) { dfs(graph[node][i]); } } st.push(node); } int main() { ios_base::sync_with_stdio(false); cin >> n >> m; for(int i = 0; i < m; i++) { int a, b; cin >> a >> b; graph[a].push_back(b); } for(int i = 0; i <= n; i++) { visited[i] = false; } for(int i = 1; i <= n; i++){ if(!visited[i]) { dfs(i); } } while(!st.empty()) { cout << st.top() << " "; st.pop(); } return 0; } // 4 4