The time 12:00 noon, no matter the area on the Earth, is neither a.m. nor p.m. The same is true of 12:00 midnight, as it is neither a.m. nor p.m. as well. However, it is widely accepted that noon is considered p.m. and midnight is considered a.m. informally.
A.M. stands for ante-meridiem and and p.m. stands for post-meridiem. Ante-meridiem refers to the time before midday and post-meridiem refers to the time after midday. At 12:00 noon, the position of the sun is at the highest point in the sky and it is exactly midday. With this in mind, it can neither be before midday or after midday. It is exactly midday. Midnight is the exact end of the day.