Linked list Node
class Node { int data ; Node right , down ; Node ( int data ) { this . data = data ; right = null ; down = null ; } } class pair { int val ; Node head ; pair ( Node head , int val ) { this . val = val ; this . head = head ; } }