Hello!
As the ball was replaced, the denominator in our probabilities will be the same. As the each had a 1/6 chance of getting the ball with the certain number, we just square the number as they both had the same probability.
1/6·1/6=1/36
There was a 1/36 chance of them selecting the same ball. This is also equivalent to about a 2.8% chance of this event occurring.
I hope this helps!