In the reaction,
X and Y respectively are
neutral and acid
acid and base
base and acid
base and neutral
X ammonia accepts a proton and Y water donates a proton hence they are base and acid.