Creating the graph from an input (as System.in) and printing it on the screen (The graph must be updated to accept both directions)