local DBG = false
function dbgpr(...)
    if DBG then
        io.write("[dbg]")
        print(...)
    end
end

function dbgpr_t(tbl)
    if DBG then
        dbgpr(tbl)
        io.write("[dbg]")
        for i,v in ipairs(tbl) do
            io.write(i)
            io.write(":")
            io.write(tostring(v))
            io.write(" ")
        end
        print("")
    end
end

function dbgpr_t2d(tbl2d)
    if DBG then
        dbgpr(tbl2d)
        for i,t in ipairs(tbl2d) do
            io.write("[dbg]")
            for j,v in ipairs(t) do
                io.write("(" .. tostring(i) .. "," .. tostring(j) .. "): ")
                io.write(tostring(v))
                io.write("; ")
            end
            print("")
        end
    end
end
function create_tbl(a, initial)
    local tbl = {}
    for i=1,a do
        tbl[i] = initial
    end
    return tbl
end

function create_2d_tbl(a, b, initial)
    local tbl = {}
    for i=1,a do
        local t = {}
        for j=1,b do
            t[j] = initial
        end
        tbl[i] = t
    end
    return tbl
end

function parse_problem()
    local N, M = io.read("n", "n")
    local bridges = {}
    local map = create_2d_tbl(N, N, 0)
    for i=1, M do
        local a, b = io.read("n", "n")
        bridges[i] = {a, b}
        assert(map[a][b] == 0)
        map[a][b] = 1
        map[b][a] = 1
    end
    return N, M, bridges, map
end

function reachable(N, map, a, b)
    local visited = create_tbl(N, 0)
    local function dfs(src)
        for dest=1, N do
            if src ~= dest and visited[dest] == 0 then
                if map[src][dest] ~= 0 then
                    visited[dest] = 1
                    dfs(dest)
                end
            end
        end
    end
    visited[a] = 1
    dfs(a)
    local count = 0
    for i=1,N do
        if visited[i] ~= 0 then
            count = count + 1
        end
    end
    --dbgpr_t(visited)
    return visited[b] ~= 0, count
end

function main()
    local N, M, bridges, map = parse_problem()
    dbgpr(N, M)
    dbgpr("====bridges")
    dbgpr_t2d(bridges)
    dbgpr("====map")
    dbgpr_t2d(map)
    local inconvenience = 0
    for i=1,M do
        local a, b = bridges[i][1], bridges[i][2]
        -- bridge collapses
        map[a][b] = 0
        map[b][a] = 0
        -- still reachable?
        local r, count_a = reachable(N, map, a, b)
        local _, count_b = reachable(N, map, b, a)
        dbgpr("i,a,b: ",i,a,b, " r: ", r, " count: ", count_a, count_b)
        if not r then
            inconvenience = inconvenience + count_a * count_b
        end
        print(inconvenience)
    end
end

main()
