three jug prblm

if u r given a pair of jugs with known capacity and an unlimited suppply of water,can u deduce a required amount of water through a series of logical operation such as fill,empty,remove,move provide a specific amount of water using filling ,moving and emptying a pair of jugs with marked capacities and unlimited supply of water.

I am not sure about this, but suppose we are given two jugs with capacity x and y. Then, we can find a sequence of moves to measure some amount z, if and only if z is a multiple of gcd(x, y).

Now, actually deducing the moves is another logic, but I believe we can make a quick check, whether the given quantity can be obtained with the given pair of jugs.

PS: I am not completely sure about this. I just remembered this from the days I used to crack puzzles like these, and I don’t even know how true this is.