This reminds me of a similar brain teaser.
You die and you're standing between the gates of heaven and hell. The gates are identical and they are guarded by identical looking angels. One angel is a good angel who only tells the truth, the other is a bad angel who only tells lies.
In order to get to heaven, you're only allowed to ask one question to one angel. What question do you ask to guarantee that you make it into heaven??