

head = [5 , 4 , 0 , -1]
pos = 2
N = 1
You have to find the node where the cycle begins and return the Nth node from that point in the direction of the head.
The first line contains a single integer ‘T’ denoting the number of test cases to be run. Then the test cases follow.
The first line of each test case contains elements of a linked list terminated by -1, (hence -1 will never be the value of any node in the linked list.
The second line of each test case contains an integer representing the position where the cycle begins.
The third line of each test case contains an integer N, denoting the position to find.
For each test case print, an integer denoting the Nth node from the start of the loop.
1 <= T <= 50
1 <= X <= 10^4
-10^5 <= Node.val <= 10^5
1 <= N <= 10^5
Where ‘X’ is the number of nodes in the linked list.
Time Limit: 1 sec.
We will detect the cycle and the node where the cycle begins. Then we will find the nth node using two pointers. One at the head and the other N- node away.
Algorithm:-
A. Use a helper function to determine the presence of cycle and entry node:-
B. Now in the given function:-