Solving a CSP using AC-3
AC-3 is an algorithm for solving CSPs. In order to use it solve a question, you need to present the question as solving a CSP.
In your case, the CSP is on four variables $P,M,O,D$ ranging over $\{0,1,2\}$. The constraints are:

$P \neq M$.
$D &gt; O$.
$D \neq P$.
$D \neq M$.
$(P = O) \Rightarrow P = 1$.
$(P \neq O) \Rightarrow (P = 2 \lor O = 2)$.

We can convert them into the following explicit constraints:

$(P,M),(D,P),(D,M) \in \{(0,1),(0,2),(1,0),(1,2),(2,0),(2,1)\}$.
$(D,O) \in \{(1,0),(2,0),(2,1)\}$.
$(P,O) \in \{(0,2),(1,1),(1,2),(2,0),(2,1)\}$.

You can now take any implementation of AC-3 and simply run it on these constraints.