import numpy as np
def create_graph():
    n = int(input("Enter the count of exhibition halls"))
    print("Exhibition halls are numbered 0 to ", n-1)
    adj=np.zeros((n,n), dtype=int)
    c = int(input("Enter the count of corridors"))
    for i in range(c):
        u = int(input("Enter the number of the starting hall of corridor " +str(i+1)))
        v = int(input("Enter the number of the ending hall of corridor " +str(i+1)))
        adj[u,v] = 1
        adj[v,u] = 1
    return n,adj
    
def approx_vertex_cover(adj,n):
cover = set()
for i in range(n):
    for j in range(n):
        if (adj[i][j] ==1):
            cover.add(i)
            cover.add(j)
            for k in range(j,n):
                adj[i][k] =0
                adj[k][i] =0
            for k in range(n):
                adj[j][k] =0
                adj[k][j] =0                    
return cover

n,adj = create_graph()
v_cover= approx_vertex_cover(adj,n)
print(v_cover)