Alice and Bob graph N nodes, M edges. Each edge can be of type 1, 2 or 3

Format of files:

First line contains value of N
Second line contains value of M
Next M lines contain  triplets of the form node 1 node2 type