Equivalence of definitions of Cohen-Macaulay ring

The definitions that we have to prove as equivalent
The ring is assumed to be Noetherian.


 * 1) For every maximal ideal, the depth equals the codimension
 * 2) For every prime ideal, the depth equals the codimension
 * 3) For every ideal, the depth equals the codimension

Note that (3) implies (2) implies 1, so we need to show that (1) implies (3). In other words, we need to show that assuming depth = codimension for maximal ideals is enough to show that depth = codimension for all ideals.