There is a modification of BFS that in some cases allows us to find the shortest path between a source and a target node faster. The idea is to run the procedure simultaneously from the source and the target node. The process continues until the traversals reach the same node . This node will be an intermediate node of the shortest path between the source and the target. Intuitively, when we run BFS simultaneously from two nodes, we need to visit fewer nodes compared to the original version because the number of "branches" (neighbors) to be considered during the traversals is likely to be smaller.
Your task here is to apply the modification for the following undirected graph:
Choose the node as a source and the node as a target. Apply one step of BFS for the node , then one step for the node and so on.
As an answer to the problem, print the label of the node where two traversals intersect.