头 (tóu) 'head' here means 'upper reaches' of the river (upstream),
尾 (wěi) 'tail' means lower reaches (downstream). The couplet is routinely quoted today about long-distance relationships, especially between Sichuan/Chongqing (upstream) and the lower Yangtze cities (Nanjing, Shanghai).