import sys input = sys.stdin.readline from operator import itemgetter N,M=map(int,input().split()) E=[tuple(map(int,input().split())) for i in range(M)] E.sort(key=itemgetter(1),reverse=True) SCORE=dict() for x,y in E: if x in SCORE and y in SCORE: if SCORE[x]