n = int(input()) m = int(input()) links = [[] for _ in range(n)] sum_c = [0] * n for _ in range(m): a, b, c = map(int, input().split()) links[a].append((b, c)) sum_c[a] += c current_people = [10.0] * n for _ in range(100): next_people = [0.0] * n for a in range(n): total = sum_c[a] if total == 0: continue # According to problem statement, this case won't occur people = current_people[a] for (b, c) in links[a]: contribution = people * (c / total) next_people[b] += contribution current_people = next_people for u in current_people: print("{0:.6f}".format(u))