#include <stack>
#include <cstdio>
using namespace std;
int main(int argc, char* argv[])
{
const int maxn = 100;
stack < int > s;
static int color[maxn];
static bool edge[maxn][maxn];
const int white = 0, grey = 1, black = 2;
int n, M;
scanf("%d %d", &n, &M);
for(int i=0; i<n; i++)
for(int j=0; j<n; j++)
edge[i][j] = false;
for(int k=0; k<M; k++)
{
int u,v;
scanf("%d %d", &u, &v);
edge[u-1][v-1] = true;
}
int start = 0;
bool cycle_found = false;
for(int i=0; i<n; i++)
color[i] = white;
s.push(start);
while (!s.empty()){
int from = s.top();
if (color[from] == white){
color[from] = grey;
for (int to = 0; to < n; ++to){
if (edge[from][to])
if(color[to] == white)
s.push(to);
else if(color[to] == grey)
cycle_found = true; // при желании можно что-то как-то оборвать
}
}else{ // вершина помеченна, значит мы в нее пришли уже на выходе из рекурсии из потомков
// делаем все, что надо делать после выхода dfs из потомков вершины
color[from] = black;
s.pop();
}
}
printf("%s\n", cycle_found ? "cycle found" : "acycled");
}
I2luY2x1ZGUgPHN0YWNrPgojaW5jbHVkZSA8Y3N0ZGlvPgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCgppbnQgbWFpbihpbnQgYXJnYywgY2hhciogYXJndltdKQp7Cgljb25zdCBpbnQgbWF4biA9IDEwMDsKCXN0YWNrIDwgaW50ID4gczsKCXN0YXRpYyBpbnQgY29sb3JbbWF4bl07CglzdGF0aWMgYm9vbCBlZGdlW21heG5dW21heG5dOwoJY29uc3QgaW50IHdoaXRlID0gMCwgZ3JleSA9IDEsIGJsYWNrID0gMjsKCglpbnQgbiwgTTsJCglzY2FuZigiJWQgJWQiLCAmbiwgJk0pOwoJZm9yKGludCBpPTA7IGk8bjsgaSsrKQoJCWZvcihpbnQgaj0wOyBqPG47IGorKykKCQkJZWRnZVtpXVtqXSA9IGZhbHNlOwoJZm9yKGludCBrPTA7IGs8TTsgaysrKQoJewoJCWludCB1LHY7CgkJc2NhbmYoIiVkICVkIiwgJnUsICZ2KTsKCQllZGdlW3UtMV1b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