output_description: Print the number of the edges that are bridges among the M edges.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N M  
      a_1 b_1  
      a_2 b_2
      :  
      a_M b_M
attempt: import sys
  
  
  class Node:
      def __init__(self, node_num):
          self.node_num = node_num
          self.connect = []
  
      def add_node(self, node):
          self.connect.append(node)
  
      def delete_node(self, node):
          self.connect.remove(node)
  
  
  def is_connect(node_list):
      check_list = [0]
      stack = [node_list[0]]
      while len(stack) != 0:
          if len(check_list) == N:
              return True
          current = stack.pop()
          for ii in current.connect:
              if ii not in check_list:
                  check_list.append(ii)
                  stack.append(node_list[ii])
      return len(check_list) == N
  
  
  N, M = list(map(int, sys.stdin.readline().strip().split(" ")))
  node_list = [Node(i) for i in range(N)]
  edge_list = []
  
  for i in range(M):
      n, m = list(map(int, sys.stdin.readline().strip().split(" ")))
      node_list[n - 1].add_node(m - 1)
      node_list[m - 1].add_node(n - 1)
      edge_list.append((n - 1, m - 1))
  
  res = 0
  prev_edge = None
  for e in edge_list:
      if prev_edge is not None:
          node_list[prev_edge[0]].add_node(prev_edge[1])
          node_list[prev_edge[1]].add_node(prev_edge[0])
      prev_edge = e
      node_list[e[0]].delete_node(e[1])
      node_list[e[1]].delete_node(e[0])
      if not is_connect(node_list):
          res += 1
  
  print(str(res))
  
problem_description: Statement
  
  You are given an undirected connected graph with N vertices and M edges that
  does not contain self-loops and double edges.  
  The i-th edge (1 \leq i \leq M) connects Vertex a_i and Vertex b_i.
  
  An edge whose removal disconnects the graph is called a _bridge_.  
  Find the number of the edges that are bridges among the M edges.
samples: [{"input": "7 7\n    1 3\n    2 7\n    3 4\n    4 5\n    4 6\n    5 6\n    6 7", "output": "4\n    \n\nThe figure below shows the given graph:\n\n![570677a9809fd7a5b63bff11e5d9bf79.png](https://img.atcoder.jp/abc075/570677a9809fd7a5b63bff11e5d9bf79.png)\n\nThe edges shown in red are bridges. There are four of them.\n\n* * *"}, {"input": "3 3\n    1 2\n    1 3\n    2 3", "output": "0\n    \n\nIt is possible that there is no bridge.\n\n* * *"}, {"input": "6 5\n    1 2\n    2 3\n    3 4\n    4 5\n    5 6", "output": "5\n    \n\nIt is possible that every edge is a bridge."}]