n = int(input()) m = int(input()) outgoing = [[] for _ in range(n)] sum_c = [0] * n for _ in range(m): a, b, c = map(int, input().split()) outgoing[a].append((b, c)) sum_c[a] += c # Compute the weights for each outgoing link for a in range(n): total = sum_c[a] outgoing[a] = [(b, c / total) for (b, c) in outgoing[a]] current_people = [10.0] * n for _ in range(100): next_people = [0.0] * n for a in range(n): people = current_people[a] if people == 0.0: continue for (b, weight) in outgoing[a]: next_people[b] += people * weight current_people = next_people for val in current_people: print("{0:.6f}".format(val))