Stage 1 for final. Graph class does not work perfectly.