Need help inUSACO 2019dec milk visits

Problem Info

USACO Gold 2019 December - Milk Visits USACO

What I’ve Tried

I’m trying to solve it using euler’s tour but not able to understand how to find if a element exists in a path from lca(a,b) to a in a tree . if you have any idea please share it

I’m trying to solve it using euler’s tour

Elaborate? Is there anything more specific that you’ve tried?