def extract_arguments(fh):
    N, M = map(int, fh.readline().strip().split())
    edges = []
    for _ in range(M):
        a, b, c = map(int, fh.readline().strip().split())
        edges.append((a, b, c))
    return N, M, edges