Kth sorted value from N lists using recursion