Agni Purana (Jyotisha Selections) · by Vyasa
Chapter 6 · Travel Muhurta
यात्रामण्डलचिन्ता
उपेतस्तु सुहृज्ज्ञेयः शत्रुमित्रमतः परम् ।मित्रमित्रं ततो ज्ञेयं मित्रमित्ररिपुस्ततः ॥ १५ ॥
In the full Agni Purana this is chapter 233, verse 15.
The next one is known as the friend. After that comes the enemy's friend. Then know the friend's friend. After that comes the friend's friend's enemy.
Simple meaning: Know the friend, then the enemy's friend, then the friend's friend, then that one's enemy.
एतत्पुरस्तात्कथितं पश्चादपि निबोध मे ।
Now hear about the kings behind: first the enemy at the rear, then the ally at the rear.
आसारस्तु ततोऽन्यः स्यादाक्रन्दासार उच्यते ।
Behind the king come the rear enemy's helper and the rear ally's helper.
नात्रापि निश्चयः शक्यो वक्तुं मनुजपुंगव ।
A king who can hold back or help both sides is called the middle king.