Search for the decay of D+ and Ds+ mesons to three charged kaons