The probability of it happening once is 1/5, since 10/50 simplifies to 1/5. Because the ticket goes back in the bag, the probability stays constant at 1/5.
For it to happen twice, you multiply the probability of it happening once, twice.
1/5 • 1/5 = 1/25 probability of it being Gary's name twice in a row.