from functools import * N, M = map(int, input().split()) D = [[0]*N for _ in range(N)] for i in range(N): D[i][i] = 1 G = [0]*N; B = {1<