Y = 2,8,8,2 and Z = 2,6.
Y will readily give off its 2 valence electrons and Z will accept the 2 electrons in order to achieve octet configuration. Hence, the compound YZ is formed by ionic bonding.