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

abc = [list(map(int, input().split())) for i in range(m)]





d = [[0]*n for i in range(n)]

e = [[[-1]for j in range(n)] for i in range(n)]





for i in range(n):

    for j in range(n):

        if i!=j:

            d[i][j]=float('inf')





for i in range(m):

    d[abc[i][0]-1][abc[i][1]-1]=abc[i][2]

    d[abc[i][1]-1][abc[i][0]-1]=abc[i][2]

    e[abc[i][0]-1][abc[i][1]-1]=[i]

    e[abc[i][1]-1][abc[i][0]-1]=[i]





for i in range(n):

    for j in range(n):

        for k in range(n):

            if d[j][k]>d[j][i]+d[i][k]:

                d[j][k] = d[j][i]+d[i][k]

                e[j][k] = e[j][i]+e[i][k]





f = []



for i in range(n):

    for j in range(n):

        for k in range(len(e[i][j])):

            if e[i][j][k] not in f:

                f.append(e[i][j][k])



print((m-len(f)+1))
n,m = list(map(int,input().split()))

abc = [list(map(int, input().split())) for i in range(m)]



d = [[0]*n for i in range(n)]

e = [[0]*n for i in range(n)]



for i in range(n):

    for j in range(n):

        if i!=j:

            d[i][j]=float('inf')

            e[i][j]=float('inf')



for i in range(m):

    d[abc[i][0]-1][abc[i][1]-1]=abc[i][2]

    d[abc[i][1]-1][abc[i][0]-1]=abc[i][2]

    e[abc[i][0]-1][abc[i][1]-1]=abc[i][2]

    e[abc[i][1]-1][abc[i][0]-1]=abc[i][2]



for i in range(n):

    for j in range(n):

        for k in range(n):

            if d[j][k]>d[j][i]+d[i][k]:

                d[j][k] = d[j][i]+d[i][k]



f = 0



for i in range(n):

    for j in range(n):

        if d[i][j]!=e[i][j] and e[i][j]!=float('inf'):

            f+=1



print((f//2))
n, m = list(map(int, input().split()))
abc = [list(map(int, input().split())) for i in range(m)]
d = [[0] * n for i in range(n)]
e = [[[-1] for j in range(n)] for i in range(n)]
for i in range(n):
    for j in range(n):
        if i != j:
            d[i][j] = float("inf")
for i in range(m):
    d[abc[i][0] - 1][abc[i][1] - 1] = abc[i][2]
    d[abc[i][1] - 1][abc[i][0] - 1] = abc[i][2]
    e[abc[i][0] - 1][abc[i][1] - 1] = [i]
    e[abc[i][1] - 1][abc[i][0] - 1] = [i]
for i in range(n):
    for j in range(n):
        for k in range(n):
            if d[j][k] > d[j][i] + d[i][k]:
                d[j][k] = d[j][i] + d[i][k]
                e[j][k] = e[j][i] + e[i][k]
f = []
for i in range(n):
    for j in range(n):
        for k in range(len(e[i][j])):
            if e[i][j][k] not in f:
                f.append(e[i][j][k])
print((m - len(f) + 1))

n, m = list(map(int, input().split()))
abc = [list(map(int, input().split())) for i in range(m)]
d = [[0] * n for i in range(n)]
e = [[0] * n for i in range(n)]
for i in range(n):
    for j in range(n):
        if i != j:
            d[i][j] = float("inf")
            e[i][j] = float("inf")
for i in range(m):
    d[abc[i][0] - 1][abc[i][1] - 1] = abc[i][2]
    d[abc[i][1] - 1][abc[i][0] - 1] = abc[i][2]
    e[abc[i][0] - 1][abc[i][1] - 1] = abc[i][2]
    e[abc[i][1] - 1][abc[i][0] - 1] = abc[i][2]
for i in range(n):
    for j in range(n):
        for k in range(n):
            if d[j][k] > d[j][i] + d[i][k]:
                d[j][k] = d[j][i] + d[i][k]
f = 0
for i in range(n):
    for j in range(n):
        if d[i][j] != e[i][j] and e[i][j] != float("inf"):
            f += 1
print((f // 2))

-e = [[[-1] for j in range(n)] for i in range(n)] +e = [[0] * n for i in range(n)] +            e[i][j] = float("inf") -    e[abc[i][0] - 1][abc[i][1] - 1] = [i] -    e[abc[i][1] - 1][abc[i][0] - 1] = [i] +    e[abc[i][0] - 1][abc[i][1] - 1] = abc[i][2] +    e[abc[i][1] - 1][abc[i][0] - 1] = abc[i][2] -                e[j][k] = e[j][i] + e[i][k] -f = [] +f = 0 -        for k in range(len(e[i][j])): -            if e[i][j][k] not in f: -                f.append(e[i][j][k]) -print((m - len(f) + 1)) +        if d[i][j] != e[i][j] and e[i][j] != float("inf"): +            f += 1 +print((f // 2))