n, m = list(map(int, input().split()))

G = [[] for i in range(n)]

E = []

for i in range(m):

    a, b = list(map(int, input().split()))

    G[a-1].append(b-1)

    G[b-1].append(a-1)

    E.append((a-1, b-1))

from collections import deque

def solve(s, t):

    if len(G[s]) == 1 or len(G[t]) == 1:

        return 1

    used = [0]*n

    que = deque()

    used[s] = 1

    for v in G[s]:

        if v == t:

            continue

        used[v] = 1

        que.append(v)

    while que:

        u = que.popleft()

        for v in G[u]:

            if not used[v]:

                used[v] = 1

                que.append(v)

    return sum(used) != n

ans = 0

for a, b in E:

    ans += solve(a, b)

print(ans)

n, m = list(map(int, input().split()))

G = [[] for i in range(n)]

for i in range(m):

    a, b = list(map(int, input().split()))

    G[a-1].append(b-1)

    G[b-1].append(a-1)

def bridge(g, v, s=0):

    bl = [False] * v

    c_memo = [0] * v

    c_used = [False] * v

    b_g = [[] for i in range(v)]

    def dfs(v, f, l):

        bcnt = fcnt = 0

        c_used[v] = True

        for t in g[v]:

            if not c_used[t]:

                ll = []

                ret = dfs(t, v, ll)

                if ret>0:

                    l += ll

                else:

                    b_g[t] = ll

                    for u in ll:

                        b_g[u].append(t)

                    l.append(t)

                bcnt += ret

            else:

                if t==f:

                    if fcnt==1:

                        c_memo[f] -= 1

                        bcnt += 1

                    fcnt += 1

                elif not bl[t]:

                    c_memo[t] -= 1

                    bcnt += 1

        bl[v] = True

        bcnt += c_memo[v]

        return bcnt

    dfs(s, -1, b_g[s])

    for u in b_g[s]:

        b_g[u].append(s)

    return b_g

G = bridge(G, n)

ans = 0

for i in range(n):

    for v in G[i]:

        if i < v:

            ans += 1

print(ans)
n, m = list(map(int, input().split()))
G = [[] for i in range(n)]
E = []
for i in range(m):
    a, b = list(map(int, input().split()))
    G[a - 1].append(b - 1)
    G[b - 1].append(a - 1)
    E.append((a - 1, b - 1))
from collections import deque


def solve(s, t):
    if len(G[s]) == 1 or len(G[t]) == 1:
        return 1
    used = [0] * n
    que = deque()
    used[s] = 1
    for v in G[s]:
        if v == t:
            continue
        used[v] = 1
        que.append(v)
    while que:
        u = que.popleft()
        for v in G[u]:
            if not used[v]:
                used[v] = 1
                que.append(v)
    return sum(used) != n


ans = 0
for a, b in E:
    ans += solve(a, b)
print(ans)

n, m = list(map(int, input().split()))
G = [[] for i in range(n)]
for i in range(m):
    a, b = list(map(int, input().split()))
    G[a - 1].append(b - 1)
    G[b - 1].append(a - 1)


def bridge(g, v, s=0):
    bl = [False] * v
    c_memo = [0] * v
    c_used = [False] * v
    b_g = [[] for i in range(v)]

    def dfs(v, f, l):
        bcnt = fcnt = 0
        c_used[v] = True
        for t in g[v]:
            if not c_used[t]:
                ll = []
                ret = dfs(t, v, ll)
                if ret > 0:
                    l += ll
                else:
                    b_g[t] = ll
                    for u in ll:
                        b_g[u].append(t)
                    l.append(t)
                bcnt += ret
            else:
                if t == f:
                    if fcnt == 1:
                        c_memo[f] -= 1
                        bcnt += 1
                    fcnt += 1
                elif not bl[t]:
                    c_memo[t] -= 1
                    bcnt += 1
        bl[v] = True
        bcnt += c_memo[v]
        return bcnt

    dfs(s, -1, b_g[s])
    for u in b_g[s]:
        b_g[u].append(s)
    return b_g


G = bridge(G, n)
ans = 0
for i in range(n):
    for v in G[i]:
        if i < v:
            ans += 1
print(ans)

-E = [] -    E.append((a - 1, b - 1)) -from collections import deque -def solve(s, t): -    if len(G[s]) == 1 or len(G[t]) == 1: -        return 1 -    used = [0] * n -    que = deque() -    used[s] = 1 -    for v in G[s]: -        if v == t: -            continue -        used[v] = 1 -        que.append(v) -    while que: -        u = que.popleft() -        for v in G[u]: -            if not used[v]: -                used[v] = 1 -                que.append(v) -    return sum(used) != n +def bridge(g, v, s=0): +    bl = [False] * v +    c_memo = [0] * v +    c_used = [False] * v +    b_g = [[] for i in range(v)] + +    def dfs(v, f, l): +        bcnt = fcnt = 0 +        c_used[v] = True +        for t in g[v]: +            if not c_used[t]: +                ll = [] +                ret = dfs(t, v, ll) +                if ret > 0: +                    l += ll +                else: +                    b_g[t] = ll +                    for u in ll: +                        b_g[u].append(t) +                    l.append(t) +                bcnt += ret +            else: +                if t == f: +                    if fcnt == 1: +                        c_memo[f] -= 1 +                        bcnt += 1 +                    fcnt += 1 +                elif not bl[t]: +                    c_memo[t] -= 1 +                    bcnt += 1 +        bl[v] = True +        bcnt += c_memo[v] +        return bcnt + +    dfs(s, -1, b_g[s]) +    for u in b_g[s]: +        b_g[u].append(s) +    return b_g +G = bridge(G, n) -for a, b in E: -    ans += solve(a, b) +for i in range(n): +    for v in G[i]: +        if i < v: +            ans += 1