I have a list of numbers let's say $\{1,2,3,...10\}$ and I have a list for each number denoting with what numbers that number can pair with.
Example:
$1:2,3$
$2:3,4$
$3:4,5$
$4:5,6$
...
$8:9,10$
$9:10,1$
$10:1,2$
I now need an algorithm (meaning a well defined step by step solution and not python code) that finds a way for each number having a partner. In this case there would be 2 solutions one being:
$1,2$
$2,3$
$3,4$
$4,5$
$5,6$
...
$10,1$
EDIT:
The statement $a:b$ and $b:c$ is just a shortcut in my notation for $a:b$ and $b:a,c$ because otherwise this would be a contradiction.