Unmanned Aerial Vehicles (UAVs) have emerged as suitable platforms for transporting and positioning communications nodes on demand, including Wi-Fi Access Points and cellular Base Stations. This paved the way for the deployment of flying networks capable of temporarily providing wireless connectivity and reinforcing coverage and capacity of existing networks. Several solutions have been proposed for the positioning of UAVs acting as Flying Access Points (FAPs). Yet, the positioning of Flying Communications Relays (FCRs) in charge of forwarding the traffic to/from the Internet has not received equal attention. In addition, state of the art works are focused on optimizing both the flying network performance and the energy-efficiency from the communications point of view, leaving aside a relevant component: the energy spent for the UAV propulsion. We propose the Energy and Performance Aware relay Positioning (EPAP) algorithm. EPAP defines target performance-aware Signal-to-Noise Ratio (SNR) values for the wireless links established between the FCR UAV and the FAPs and, based on that, computes the trajectory to be completed by the FCR UAV so that the energy spent for the UAV propulsion is minimized. EPAP was evaluated in terms of both the flying network performance and the FCR UAV endurance, considering multiple networking scenarios. Simulation results show gains up to 25% in the FCR UAV endurance, while not compromising the Quality of Service offered by the flying network.