Newton's second law applies to all accelerating objects. Consider two masses mA and mB, in contact on a frictionless table. If a constant force is applied on mass mA horizontally to accelerate both the masses, then what force will each mass exert on the other? To solve this, draw a free-body diagram of each mass and calculate the acceleration of the whole system. Since the masses don't move vertically, consider only the horizontal component of the forces. The horizontal component of the net force on mass mA is equal to the applied force minus the contact force of mass mB. On mass mB, the contact force is equal to the net force. Substituting the value of acceleration, the value of contact force exerted on masses mA and mB is obtained. Note that the contact force on both the masses is equal and opposite, following Newton's third law.