n,q = map(int, input().split()) assert 1 <= n <= 10**5 assert 1 <= q <= 5*10**4 for _ in range(q): c,s = map(int,input().split()) assert 1 <= c <= 2 assert 1 <= s <= n