#euler-circuit
The problem involves a Eulerian circuit (Eulerian circuit), that is a trail in a graph which visits every edge exactly once and ends on the same vertex it started.
https://en.wikipedia.org/wiki/Eulerian_path http://mathworld.wolfram.com/EulerianCycle.html