
# Erste Zeile enthält Anzahl der Knoten und Kanten
(n, m) = list(map(int, input().split()))

vertices = range(1,n+1)
neighbors = {} 
for v in vertices:
    neighbors[v] = []

# Jede Zeile enthält eine Kante im Format 
# u v 
for edge_index in range(m):
    (u, v) = list(map(int, input().split()))
    neighbors[u].append (v)
    neighbors[v].append (u)

# Jetzt eine Zehnerpotenz berechnen, die > n ist, um 
# Kanten wie (51,79) als 5179 codieren zu können. 
power_of_ten = 1 
while (power_of_ten <= n):
    power_of_ten *= 10 

def variable(u, v):
    x = min(u,v)
    y = max(u,v)
    return x * power_of_ten + y 


for u in vertices:
    print(f"c {u} has at least one matched edge")
    for v in neighbors[u]:
        print(variable(u,v), end=' ')
    print(0)
    print(f"c no two edges of {u} are in the matching")
    for v1 in neighbors[u]:
        for v2 in neighbors[u]:
            if (v1 < v2):
                print(-variable(u,v1), -variable(u,v2), 0)

    

