n,m=map(int,input().split()) for i in range(m): t,p=map(int,input().split()) if t