Calculate AM, GM, and HM and also verify their relations among them for the following data:
| X | 5 | 15 | 10 | 30 | 25 | 20 | 35 | 40 | | f | 18 | 16 | 20 | 21 | 22 | 13 | 12 | 16 |