The cooperation between Unmanned Aerial Vehicles (UAVs) and ground Mobile Edge Computing (MEC) servers in processing tasks is becoming one of the main research trends of MEC networks. Despite the advantages of UAV-assisted MEC, it is restricted by the limited battery capacity and sensitive energy consumption of UAVs. Unlike the previous works where UAVs are allowed to either process tasks locally or offload them to ground MEC servers, in this paper, we propose a multi-hop task routing solution for Internet of Things (IoT) networks in which a UAV can also relay to another UAV with better connection to a ground MEC server. Furthermore, the UAV can make benefit of existing Intelligent Reflective Surfaces (IRSs) to further improve tasks offloading and reduce energy consumption. We show that the problem of minimizing the total energy of UAVs is NP-hard, and we propose a graph-based heuristic solution to solve it. Simulation results show that the proposed graph-based solution outperforms the traditional no-relaying scheme, especially when IRSs are deployed. Furthermore, a Convolutional Neural Network (CNN) is devised to reduce the delay of finding the decisions for the UAVs at the centralized coordinator. Simulations show that the CNN achieves very close energy consumption performance and a remarkable reduction in execution time compared to the graph-based heuristic solution.