added function to find maximum elemnt of 3