Two theorems on perfect codes