The mean minimizes sum of squared deviations.
The sum of the squared deviations from the mean is:
(16)² + (26)² + (36)² + (76)² +
(86)² + (96)² + (126)² = 25 +16 + 9 + 1 + 4 + 9 + 36 = 100.
From the median:
(17)² + (27)² + (37)² + (77)² + (87)² + (97)² + (127)² = 36 + 25 + 16 + 0 + 1 + 4 + 25 = 107.
The median minimizes sum of absolute deviations.
The sum of the absolute values of the deviations from the mean are:

5 + 4 + 3 + 1 + 2 + 3 + 6 = 24.
From the median:
6 + 5 + 4 + 0 + 1 + 2 + 5 = 23.