I'm working as a file manager. My company bought me three safes and assigned me three assistants. I'm busy most of the time and I can't manage the safes myself, so I need to let my assistants access them.

I want to allow all three assistants to open any of the safes independently, without the presence of the other two assistants, but there are only two keys shipped with each safe, so I can't assign a key to each safe to every assistant. I am not allowed to replicate the keys. Is there a way to do it? (Note: Nobody else should be able to open the safes)


2 Answers 2



Let the safes be labeled 1, 2, 3 and their keys respectively be labelled A, B, C. Note that there are two of each key so we have the keys A, A, B, B, C, C. Also, let the A's open safe 1, the B's open safe 2, and the C's open safe 3.

The Setup:

Now, put a single key labelled B in safe 1, a key C in safe 2, and a key A in safe 3. Now, give the other keys A, B, and C to each of the assistants you have (Doesn't matter what order. The assistants are indistinguishable).

The Procedure:

Whenever one assistant wants to open any of the safes, he'll just try his key on each of the safes until he gets it (or if he already knows which one it'll be better). (He's guaranteed to be able to open one of the safes, as you gave one of each type of key to each assistant). Then, he pulls out the key in the safe and opens the next safe and then the next one until he has opened all three. Then, he pulls whatever you want out of it, and returns everything to its original state.

Why it works:

I placed the keys in each safe so that they were each shifted from their original place by one. Hence, each safe contains the key to another safe, and hence by opening a single safe, I am able to open all of the safes.

Tada! Any Questions or Clarifications you want?

  • 2
    $\begingroup$ The "try every safe" part is probably unnecessary as the assistants may know which safes their keys are to. $\endgroup$
    – iBug
    Commented Mar 21, 2018 at 3:48
  • $\begingroup$ Yep! I was just making it more complete :D I'll fix it if you want! Ok done, fixed it :D $\endgroup$
    – NL628
    Commented Mar 21, 2018 at 3:50
  • 17
    $\begingroup$ While highly interesting as a puzzle, the real world situation frightens me. Three humans, forced to perform an annoying task of opening unnecessary safes, and being taught to lock safe keys into safes? I'll give it six months before one of the safes has both of its keys locked inside it. $\endgroup$
    – Bass
    Commented Mar 21, 2018 at 4:18
  • 2
    $\begingroup$ @Bass Only six to eight weeks :) $\endgroup$
    – iBug
    Commented Mar 21, 2018 at 5:20
  • 4
    $\begingroup$ @Bass If the key is required to lock the safe (no self-locking door), you cannot get stuck with a safe with both keys in it. $\endgroup$
    – Alexander
    Commented Mar 21, 2018 at 9:17

The slightly simpler explanation of the arrangement I thought of is to label the assistants as A, B, C, who are each designated as the guardian of one safe, which can then also be referred to as safes A, B, C for simplicity.

Each assistant will carry the primary key for their own safe. Let's call the secondary key for each safe a, b, c.

Then, for everyone to be able to access every safe, we just need to put the secondary keys in the safes A, B, C like this:


Now everyone can open any safe by finding secondary keys in their own safe in a maximum of two steps.
Eg. If C wants to open safe A, she will take the b key from her own safe to open safe B and get the a key.


After a little more thought, there is an obvious second solution if the safe labels are fixed:


That leads to the insight that this method will in fact work for any number of 2-key safes, given an equal number of assistants. The number of different permutations of secondary key storage will be n-1, where n is the number of safes, with each assistant needing to open (n+1)/2 safes on average.

Eg. extending it to 4 safes, there are 3 permutations:

   A B C D
   - - - -
   b c d a
   c d a b
   d a b c

  • 1
    $\begingroup$ I believe this is the exact same arrangement as mine, but good job finding it still! :D $\endgroup$
    – NL628
    Commented Mar 21, 2018 at 4:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.