시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
5 초 512 MB 140 40 31 40.260%

문제

일호는 매년 열리는 국제 체스대회의 심사 위원이다. 

국제 체스대회의 경기는 오로지 심판인 일호만 관전하며 일호가 경기 결과를 체스협회 회장인 진서에게  통보하면 진서가 결과들을 종합하여 순위를 발표하게 된다.

이러한 룰 때문에 일호가 경기 결과를 진서에게 실수로 잘못 통보한다면 아무도 경기 결과가 바뀐지 알 수 없다.

체스 경기는 우연이 아닌 기술의 게임이기 때문에 A플레이어의 기술 수준이 B플레이어의 기술 수준보다 더 높으면 A플레이어는 B플레이어를 항상 이길것이다. 이 때 두플레이어의 기술 수준이 같다면 경기를 비길 수도 있다.

우리는 일호가 경기 과정을 진서에게 전달 하는 과정에서 실수가 발생했을 수도 있으므로 선수들의 경기 결과가 일관성이 있는지 확인을 해야한다.

예를 들어 0 > 1 , 1 = 2 , 0 = 2 의 결과가 나왔다면 0번 선수의 기술 수준은 1번 선수의 기술 수준보다 높을 것이다. 

하지만 1번 선수의 기술 수준과 2번 선수의 기술 수준이 같고, 0번 선수의 기술 수준과 2번 선수의 기술 수준이 같다면 0번선수의 기술 수준과 1번 선수의 기술 수준이 같다는 결론을 도출할 수 있으므로, 0번 선수와 1번 선수의 기술 점수에 대한 모순이 생기게 되므로 일호가 진서에게 경기 결과를 잘못 전달한 것이다.

우리는 일관성을 판단하여 경기 결과가 잘 전달 됐는지 확인하는 프로그램을 만들면 된다.

입력

첫째 줄에 플레이어 수 N(2  ≤ N  ≤ 50 000) 와   경기 결과의 수 M(1  ≤ M  ≤ 250 000) 이 주어진다.

이어서 M개의 줄에 경기 결과 K S L이 주어진다.

K와 L은 경기를 치룬 선수이고 S는 '=' 혹은'>'혹은'<' 로 표현된다.

K > L 이면 해당 경기에서 K가 L을 이긴것이다.  

두 플레이어 간에는 최대 하나의 경기만 있으며, 각 플레이어는 적어도 하나의 경기에 참여한다. 

출력

주어진 경기 결과들이 일관성이 있다면 "consistent"를 출력하고 아니라면 "inconsistent"를 출력한다.

예제 입력 1

3 3
0 > 1
1 = 2
0 = 2

예제 출력 1

inconsistent

예제 입력 2

5 5
0 = 1
1 = 2
3 = 4
0 > 3
1 > 4

예제 출력 2

consistent

예제 입력 3

6 5
0 > 1
1 > 2
3 = 4
4 = 5
5 > 3

예제 출력 3

inconsistent

힌트

W3sicHJvYmxlbV9pZCI6IjEzMzQ0IiwicHJvYmxlbV9sYW5nIjoiMCIsInRpdGxlIjoiXHVhZDZkXHVjODFjIFx1Y2NiNFx1YzJhNFx1YjMwMFx1ZDY4YyIsImRlc2NyaXB0aW9uIjoiPHA+XHVjNzdjXHVkNjM4XHViMjk0IFx1YjllNFx1YjE0NCBcdWM1ZjRcdWI5YWNcdWIyOTQgXHVhZDZkXHVjODFjIFx1Y2NiNFx1YzJhNFx1YjMwMFx1ZDY4Y1x1Yzc1OCBcdWMyZWNcdWMwYWMgXHVjNzA0XHVjNmQwXHVjNzc0XHViMmU0LiZuYnNwOzxcL3A+XHJcblxyXG48cD5cdWFkNmRcdWM4MWMgXHVjY2I0XHVjMmE0XHViMzAwXHVkNjhjXHVjNzU4IFx1YWNiZFx1YWUzMFx1YjI5NCBcdWM2MjRcdWI4NWNcdWM5YzAgXHVjMmVjXHVkMzEwXHVjNzc4IFx1Yzc3Y1x1ZDYzOFx1YjljYyBcdWFkMDBcdWM4MDRcdWQ1NThcdWJhNzAgXHVjNzdjXHVkNjM4XHVhYzAwIFx1YWNiZFx1YWUzMCBcdWFjYjBcdWFjZmNcdWI5N2MgXHVjY2I0XHVjMmE0XHVkNjExXHVkNjhjIFx1ZDY4Y1x1YzdhNVx1Yzc3OCBcdWM5YzRcdWMxMWNcdWM1ZDBcdWFjOGMgJm5ic3A7XHVkMWI1XHViY2Y0XHVkNTU4XHViYTc0IFx1YzljNFx1YzExY1x1YWMwMCBcdWFjYjBcdWFjZmNcdWI0ZTRcdWM3NDQgXHVjODg1XHVkNTY5XHVkNTU4XHVjNWVjIFx1YzIxY1x1Yz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