Amazon Interview Question

Write a program that would identify first common manager of two employees