import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.LinkedList; import java.util.Scanner; import java.util.Map.Entry; public class Main { public static long MOD = 1000000007; public static void main(String[] args) { Scanner sc = new Scanner(System.in); final int N = sc.nextInt(); final int M = sc.nextInt(); ArrayList> adj = new ArrayList>(); for(int i = 0; i < N; i++){ adj.add(new HashMap()); } for(int i = 0; i < M; i++){ final int a = sc.nextInt(); final int b = sc.nextInt(); final double c = sc.nextDouble(); adj.get(a).put(b, c); } double[] out_sum = new double[N]; for(int curr = 0; curr < N; curr++){ for(final double denom : adj.get(curr).values()){ out_sum[curr] += denom; } } double[] curr_rank = new double[N]; for(int i = 0; i < N; i++){ curr_rank[i] = 10; } double[] next_rank = new double[N]; for(int i = 0; i < 100; i++){ Arrays.fill(next_rank, 0); for(int curr = 0; curr < N; curr++){ for(final Entry entry : adj.get(curr).entrySet()){ final int next = entry.getKey(); final double mul = entry.getValue(); next_rank[next] += curr_rank[curr] * mul / out_sum[curr]; } } { double[] tmp = curr_rank; curr_rank = next_rank; next_rank = tmp; } } for(int i = 0; i < N; i++){ System.out.printf("%.08f\n", curr_rank[i]); } } }