#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");
}
