Diagonal relationship exists between certain pairs of diagonally adjacent elements in the second and third period of the periodic table. It occurs because of the directions of trends in various properties as we move across the period or down the periodic table. Lithium shows diagonal relationship with magnesium whereas aluminium with beryllium. Hence, the element X and Y are Mg and Be