Given a tree (not necessarily a binary tree) and a number of queries such that every query takes two nodes of the tree as parameters. For every query pair, find if two nodes are on the same path from the root to the bottom.
For example, consider the below tree, if given queries are (1, 5), (1, 6), and (2, 6), then answers should be true, true, and false respectively.
Check if two nodes are on same path in a tree : https://www.geeksforgeeks.org/check-if-two-nodes-are-on-same-path-in-a-tree/