546. Ternary Password