How do I make it in minecraft where if someone goes anywhere above a command block, they die?

For clarification, I want it to be if they go anywhere above a command block, they die. They can be 100 blocks above, or 1. But if they are one block to the right or left, they are safe. Currently I have this: testfor @a[r=10], then it will turn on a compactor and kill them. But they can just fly over or if they are 10 blocks behind they don't die.