When tetrahedral voids of the second layer are covered by the spheres of the third layer. In this case, the spheres of the third layer are exactly aligned with those of the first layer. Thus, the pattern of spheres is repeated in alternate layers. This is ABAB .. type of packing which is also called hexagonal close packing (hcp).
When octahedral voids of the second layer are covered by the spheres of the third layer. In this case, the spheres of the third layer are not aligned with those of either the first or the second layer. This is ABCABC.. type of packing also called cubic close packing (ccp) or face-centred cubic (fcc) close packing.
Thus third layer is the distinguishing layer.