This will work because the answer is independent of the tribe you
are asking, and it gives you information about the door.
For example, if you end up asking the truth telling tribe, they will
tell you the truth - that the other tribe would lie to you about which
door you should open.
On the other hand if you happen to ask the lie telling tribe, they
will lie to you about what the other tribe would tell you - which
would have been the truth.