A system that includes a laser, a three-dimensional (3D) camera, a memory, and a processor. The processor is configured to determine the position of a first teat candidate relative to a second teat candidate, assign the first teat candidate and the second teat candidate as a left teat candidate or right teat candidate, and receive a teat identifier for a target teat. The processor is configured to determine whether the left or right teat candidate is within a teat location range of the target teat and to link the teat identifier with the left teat candidate or right teat candidate based on the determination.