Task 2 - 260712 In the material issuance of a company, the keys of twelve padlocks have been mixed up due to a mishap.

Since only one of the twelve keys fits each padlock and only one padlock fits each key, which cannot be distinguished from each other externally, it must be determined which key belongs to which padlock.

Apprentice Bernd, who was assigned this task, thought: "Now I have to try twelve keys on twelve padlocks, so if I'm unlucky, I have to perform $12 \cdot 12=144$ tests."

However, his friend Uwe said that much fewer tests would suffice.

Determine the smallest number of tests with which one can certainly (i.e., even in the worst case) find the matching key for each padlock!
From the total of twelve padlocks, exactly one fits each key. If we take one of the twelve keys and try to find out which of the twelve padlocks it fits, in the worst case, it could happen that after eleven attempts, the lock that the key fits has not yet been tried.

Since the key does belong to one of the locks, it must fit the lock that has not yet been considered, and it can be placed with that lock without further testing. With twelve padlocks, we can thus find the key that fits one of the locks with certainty after at most eleven attempts.

However, fewer than eleven attempts can leave the question of the matching lock open in unfavorable cases. For the remaining eleven padlocks and their keys, the corresponding considerations apply, so that we can specify the key for one of these eleven padlocks with certainty after at most ten further attempts, while fewer than ten attempts are insufficient in unfavorable cases.

If we continue these considerations analogously, it follows that after at most $10+9+8+7+6+5+4+3+2+1=$ 66.

attempts, the matching key for each of the twelve padlocks can be found, and this is also the smallest number of attempts required.