Step 1: Understand diagonal relationship.
Diagonal relationship is observed between certain elements of the second and third periods which show similar properties due to nearly equal ionic size, charge density, and electronegativity.
Step 2: Identify the element related to lithium.
Lithium (Li) of Group 1 shows diagonal relationship with magnesium (Mg) of Group 2.
Both show similarities such as:
Formation of nitrides
Low solubility of carbonates
and
Similar thermal behavior
Thus,
\[
X=\text{Mg}
\]
Step 3: Identify the element related to aluminium.
Aluminium (Al) shows diagonal relationship with beryllium (Be).
Both have similar properties such as:
Amphoteric oxides
Covalent character
and
Polymeric hydrides
Thus,
\[
Y=\text{Be}
\]
Step 4: Final conclusion.
Hence,
\[
\boxed{X=\text{Mg},\quad Y=\text{Be}}
\]