XS(s)⇌X+2(aq.)+S2−(aq.)
For precipitation of XS(s)
[X+2][S2−]≥Ksp(XS)
[S2−]≥0.011×10−22=10−20
YS(s)⇌Y+2(aq)+S2−(aq)
For precipitation of YS(s)
[Y+2][S2−]≥Ksp(YS)
[S2−]≥10−24×10−16=4×10−14
Now, H2S(aq)⇌2H+(aq)+S2−(aq)
H2S[S2−][H+]2=Ka1×Ka2=1×10−21
[S2−]=[H+]21×10−21×[H2S]≥4×10−14
[H+]2≤41×10−7×10−1
[H+]≤21×10−4⇒pH≥4.3
Nearest integer pH = 4.