using System.Collections.Generic;
public static void Main()
Console.WriteLine("Hello World");
CommonManager cm = new CommonManager();
public string Name { get; set; }
public List<Node> Children { get; set; }
Children = new List<Node>();
public class CommonManager
Node root = new Node("A");
root.Children.Add(new Node("B"));
root.Children[0].Children.Add(new Node("D"));
root.Children[0].Children.Add(new Node("E"));
root.Children[0].Children[1].Children.Add(new Node("H"));
root.Children[0].Children[1].Children.Add(new Node("I"));
root.Children[0].Children[1].Children[1].Children.Add(new Node("L"));
Node n1 = root.Children[0].Children[1].Children[1].Children[0];
Node n2 = root.Children[0].Children[1].Children[1];
Node lcm = FindLCM(root, n1, n2);
Console.WriteLine("The LCM is " + lcm.Name);
Console.WriteLine("No LCM found.");
public static Node FindLCM(Node root, Node n1, Node n2)
if (root == n1 || root == n2)
foreach (Node child in root.Children)
Console.WriteLine(child.Name);
Node temp = FindLCM(child, n1, n2);
Console.WriteLine("temp.Name:--> " + temp.Name);