import sys from collections import defaultdict def main(): n = int(sys.stdin.readline()) m = int(sys.stdin.readline()) trans = defaultdict(list) sum_c = [0.0] * n for _ in range(m): a, b, c = map(int, sys.stdin.readline().split()) trans[a].append((b, c)) sum_c[a] += c # Accumulate sum as we read current_state = [10.0 for _ in range(n)] for _ in range(100): next_state = [0.0] * n for u in range(n): pop = current_state[u] if pop == 0: continue s = sum_c[u] if s == 0: continue # Shouldn't happen as per problem statement for (v, c) in trans[u]: next_state[v] += pop * c / s current_state = next_state.copy() for u in range(n): print("{0:.6f}".format(current_state[u])) if __name__ == "__main__": main()