Next Greater Node In Linked List Leetcode Solution Python