package yukicoder; import java.util.ArrayList; import java.util.Arrays; import java.util.Scanner; public class Q1191 { public static void main(String[] args) { new Q1191().solver(); } void solver() { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); ArrayList[] g = new ArrayList[n]; for (int i = 0; i < n; i++) { g[i] = new ArrayList<>(); } for (int i = 0; i < m; i++) { int src = sc.nextInt(); int dst = sc.nextInt(); int rate = sc.nextInt(); g[src].add(new Edge(src, dst, rate)); } for (int i = 0; i < n; i++) { double sum = 0; for (Edge e : g[i]) { sum += e.rate; } for (Edge e : g[i]) { e.rate /= sum; } } double[][] population = new double[2][n]; for (int i = 0; i < n; i++) { population[0][i] = 10; } for (int i = 0; i < 100; i++) { Arrays.fill(population[(i + 1) % 2], 0); for (int j = 0; j < n; j++) { for (Edge e : g[j]) { population[(i + 1) % 2][e.dst] += population[i % 2][e.src] * e.rate; } } } for (int i = 0; i < n; i++) { System.out.printf("%f\n", population[(99 + 1) % 2][i]); } } class Edge { int src; int dst; double rate; Edge(int src, int dst, double rate) { this.src = src; this.dst = dst; this.rate = rate; } } void tr(Object... o) { System.out.println(Arrays.deepToString(o)); } }