def transform_graph(n,m,changes):
    graph=[[0]*n for_in range(n)]
    for i in range(m):
        (a,b,c)
        a,b,c=changes[i]
        a,b,c=a-1,b-1,c-1
        graph[a][b]=0:
          graph[b][a]=0
          graph[b][c]=0
          graph[c][b]=0
          graph[a][c]=0
          graph[c][a]=0
          if graph[a][b]==0:
            graph[a][b]=1
            graph[b][a]=1
            if graph [b][c]==0:
                 graph[b][c]=1
                 graph[c][b]=1
                 if graph[a][c]==0:
                     graph[a][c]=1
                     graph[c][a]=1
                     return graph
    
          
