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

branch = dict()

a = []

b = []

for i in range(n+1):

	branch[i] = []

for i in range(m):

	atemp,btemp = list(map(int,input().split()))

	a.append(atemp)

	b.append(btemp)

	branch[atemp].append(btemp)

	branch[btemp].append(atemp)



counter = 0

for i in range(m):

	check = True

	delindex1 = branch[a[i]].index(b[i])

	delindex2 = branch[b[i]].index(a[i])

	del branch[a[i]][delindex1]

	del branch[b[i]][delindex2]

	arrival = [0 for i in range(n+1)]

	q = [1]

	while len(q) >= 1:

		arrival[q[0]]=1

		for k in range(len(branch[q[0]])):

			if arrival[branch[q[0]][k]] == 0:

				q.append(branch[q[0]][k])

		q.pop(0)



	for k in range(1,n+1):

		if arrival[k] == 0:

			check = False

	if check==False:

		counter += 1

	branch[a[i]].append(b[i])

	branch[b[i]].append(a[i])

print(counter)
def bfs(branch,n):

	arrival = [0 for i in range(n+1)]

	q = [1]

	arrival[q[0]]=1

	while len(q) >= 1:

		for k in range(len(branch[q[0]])):

			if arrival[branch[q[0]][k]] == 0:

				arrival[branch[q[0]][k]] = arrival[q[0]] + 1

				q.append(branch[q[0]][k])

		q.pop(0)

	return arrival



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

branch = dict()

for i in range(1,n+1):

    branch[i] = []

pair = []

for i in range(m):

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

    pair.append([a,b])

    branch[a].append(b)

    branch[b].append(a)

counter = 0



for i in range(m):

    branch[pair[i][0]].remove(pair[i][1])

    branch[pair[i][1]].remove(pair[i][0])

    arrival = bfs(branch,n)

    check = True

    for k in range(1,n+1):

        if arrival[k] == 0:

            check = False

    if check:

        counter += 1

    branch[pair[i][0]].append(pair[i][1])

    branch[pair[i][1]].append(pair[i][0])

print((m-counter))
n, m = list(map(int, input().split()))
branch = dict()
a = []
b = []
for i in range(n + 1):
    branch[i] = []
for i in range(m):
    atemp, btemp = list(map(int, input().split()))
    a.append(atemp)
    b.append(btemp)
    branch[atemp].append(btemp)
    branch[btemp].append(atemp)
counter = 0
for i in range(m):
    check = True
    delindex1 = branch[a[i]].index(b[i])
    delindex2 = branch[b[i]].index(a[i])
    del branch[a[i]][delindex1]
    del branch[b[i]][delindex2]
    arrival = [0 for i in range(n + 1)]
    q = [1]
    while len(q) >= 1:
        arrival[q[0]] = 1
        for k in range(len(branch[q[0]])):
            if arrival[branch[q[0]][k]] == 0:
                q.append(branch[q[0]][k])
        q.pop(0)
    for k in range(1, n + 1):
        if arrival[k] == 0:
            check = False
    if check == False:
        counter += 1
    branch[a[i]].append(b[i])
    branch[b[i]].append(a[i])
print(counter)

def bfs(branch, n):
    arrival = [0 for i in range(n + 1)]
    q = [1]
    arrival[q[0]] = 1
    while len(q) >= 1:
        for k in range(len(branch[q[0]])):
            if arrival[branch[q[0]][k]] == 0:
                arrival[branch[q[0]][k]] = arrival[q[0]] + 1
                q.append(branch[q[0]][k])
        q.pop(0)
    return arrival


n, m = list(map(int, input().split()))
branch = dict()
for i in range(1, n + 1):
    branch[i] = []
pair = []
for i in range(m):
    a, b = list(map(int, input().split()))
    pair.append([a, b])
    branch[a].append(b)
    branch[b].append(a)
counter = 0
for i in range(m):
    branch[pair[i][0]].remove(pair[i][1])
    branch[pair[i][1]].remove(pair[i][0])
    arrival = bfs(branch, n)
    check = True
    for k in range(1, n + 1):
        if arrival[k] == 0:
            check = False
    if check:
        counter += 1
    branch[pair[i][0]].append(pair[i][1])
    branch[pair[i][1]].append(pair[i][0])
print((m - counter))

+def bfs(branch, n): +    arrival = [0 for i in range(n + 1)] +    q = [1] +    arrival[q[0]] = 1 +    while len(q) >= 1: +        for k in range(len(branch[q[0]])): +            if arrival[branch[q[0]][k]] == 0: +                arrival[branch[q[0]][k]] = arrival[q[0]] + 1 +                q.append(branch[q[0]][k]) +        q.pop(0) +    return arrival + + -a = [] -b = [] -for i in range(n + 1): +for i in range(1, n + 1): +pair = [] -    atemp, btemp = list(map(int, input().split())) -    a.append(atemp) -    b.append(btemp) -    branch[atemp].append(btemp) -    branch[btemp].append(atemp) +    a, b = list(map(int, input().split())) +    pair.append([a, b]) +    branch[a].append(b) +    branch[b].append(a) +    branch[pair[i][0]].remove(pair[i][1]) +    branch[pair[i][1]].remove(pair[i][0]) +    arrival = bfs(branch, n) -    delindex1 = branch[a[i]].index(b[i]) -    delindex2 = branch[b[i]].index(a[i]) -    del branch[a[i]][delindex1] -    del branch[b[i]][delindex2] -    arrival = [0 for i in range(n + 1)] -    q = [1] -    while len(q) >= 1: -        arrival[q[0]] = 1 -        for k in range(len(branch[q[0]])): -            if arrival[branch[q[0]][k]] == 0: -                q.append(branch[q[0]][k]) -        q.pop(0) -    if check == False: +    if check: -    branch[a[i]].append(b[i]) -    branch[b[i]].append(a[i]) -print(counter) +    branch[pair[i][0]].append(pair[i][1]) +    branch[pair[i][1]].append(pair[i][0]) +print((m - counter))