import java.util.ArrayList; import java.util.LinkedList; import java.util.Scanner; public class Main30 { public static void main(String[] args) { Main30 p = new Main30(); } boolean[] isVisited; long[][] need; public Main30() { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); isVisited = new boolean[n+1]; need = new long[n+1][n+1]; for(int i=0;i