The phrase "when trying" is a reduced adverb clause (short for "when they are trying") that correctly modifies the action of reversing letters. "When tried" is passive and does not make sense here, while "if they tried" uses an incorrect tense sequence.