7 6 7 2 1 3 4 5
4 7 5 3 2 $7 \rightarrow 5 \rightarrow 3 \rightarrow 2 \rightarrow 7$ is indeed a directed cycle. Here is the graph corresponding to this input:  Here are other acceptable outputs: 4 2 7 5 3 3 4 1 6 Note that the graph may not be connected.
2 2 1
2 1 2 This case contains both of the edges $1 \rightarrow 2$ and $2 \rightarrow 1$. In this case, $1 \rightarrow 2 \rightarrow 1$ is indeed a directed cycle. Here is the graph corresponding to this input, where $1 \leftrightarrow 2$ represents the existence of both $1 \rightarrow 2$ and $2 \rightarrow 1$: 
8 3 7 4 7 3 3 8 2
3 2 7 8 Here is the graph corresponding to this input: 
{
"problem": {
"name": "Find it!",
"description": {
"content": "There is a directed graph with $N$ vertices and $N$ edges. The $i$\\-th edge goes from vertex $i$ to vertex $A_i$. (The constraints guarantee that $i \\neq A_i$.) Find a directed cycle without the s",
"description_type": "Markdown"
},
"platform": "AtCoder",
"limit": {
"time_limit": 2000,
"memory_limit": 262144
},
"difficulty": "None",
"is_remote": true,
"is_sync": true,
"sync_url": null,
"sign": "abc311_c"
},
"statements": [
{
"statement_type": "Markdown",
"content": "There is a directed graph with $N$ vertices and $N$ edges. \nThe $i$\\-th edge goes from vertex $i$ to vertex $A_i$. (The constraints guarantee that $i \\neq A_i$.) \nFind a directed cycle without the s...",
"is_translate": false,
"language": "English"
}
]
}