How do we localize pain? I know that different points of the brain correspond to different point of the body. But how a sensory information reaches its correct corresponding area?

For example, let say I put a pencil's extremity on position A of the thumb tip and then on position B always of the thumb tip. 
How do I discriminate between A and B?
Does these electrical activities travel trough two completely different pathways?
NOCICEPTORS AND THE PERCEPTION OF PAIN

The pain from nociceptors remain in bundles for that region until they reach the spinal cord at which time the signal begins to be processed to the appropriate pathway with primitive intelligence (like instinctive jerk away) till the signal reaches the brain and is processed by sentient intelligence (form a plan to avoid these situations in the future). The resolution of pain is something like 100x the size of a nerve branch equal to one bundle in theory but the minimum resolution of pain varies from person to person.