import java.util.*; import java.io.*; class intList{ intList(){ this.data = -1; this.next = null; } intList( int data ){ this.data = data; this.next = null; } void add( int n ){ if( this.data == -1 )this.data = n; else if( this.next == null )this.next = new intList(n); else this.next.add(n); } boolean contains( int n ){ if( this.data == n )return true; if( this.next == null )return false; return this.next.contains(n); } int elements(){ if( this.next == null )return 1; return 1+this.next.elements(); } int[] toArray(){ int n = this.elements(); int[] ret = new int[n]; intList help = this; boolean written = false; for( int i=0; i " + queue.toString() ); int node = queue.get(); if( node == dest )return true; for( int n=0; n< edges.length; n++ )if( edges[n][0] == node ){ if( queue.check[node][edges[n][1]] == 1 )return false; queue.append( edges[n][1], node ); // System.out.println( "Appending " + edges[n][1] + " from: " + source); } } return false; } static intList sinks( int nodes, int[][] edges ){ intList list[] = new intList[nodes+1]; intList sinks = new intList(); for( int n=1; n<=nodes; n++ ){ list[n] = new intList(); for( int i=0; i