added function printLongestPath