Let the tank capacity be 20 ltrs.(Any multiple of 4,1,5 like 20,40,60.... will work) .
Since the tank can be filled by X in 5 hrs,X is filling the tank at a rate of 4 ltrs per hour.
Similarly Y is filling the tank at a rate of 5 ltrs per hour.
Similarly drainage hole is emptying the tank at a rate of 1 litre per hour.
If X,Y,Z are open for 1 hr,then at the end of hour,tank is increased by $4+5-1=8$ litres.
Therefore if you start with empty tank in $20/8=2.5hrs$, you can fill the tank completely