Chagiga2: 6
הַטּוֹבֵל לְחֻלִּין וְהֻחְזַק לְחֻלִּין — אָסוּר לְמַעֲשֵׂר. טָבַל לְמַעֲשֵׂר וְהֻחְזַק לְמַעֲשֵׂר — אָסוּר לִתְרוּמָה. טָבַל לִתְרוּמָה וְהֻחְזַק לִתְרוּמָה — אָסוּר לְקֹדֶשׁ. טָבַל לְקֹדֶשׁ וְהֻחְזַק לְקֹדֶשׁ — אָסוּר לַחַטָּאת.  טָבַל לְחָמוּר — מֻתָּר לְקַל.  טָבַל וְלֹא הֻחְזַק — כְּאִלּוּ לֹא טָבָל.
[If] one immersed himself for unsanctified food and [only] intended [to cleanse himself] for unsanctified food, he is prohibited from [eating] maaser. [If] he immersed himself for maaser and [only] intended [to cleanse himself] for maaser, he is prohibited from [eating] terumah. [If] he immersed himself for terumah and [only] intended [to cleanse himself] for terumah, he is prohibited from [eating] kodesh. [If] he immersed himself for kodesh and [only] intended [to cleanse himself] for kodesh, he is prohibited [from touching] water of cleansing.  [If] he immersed himself for a more stringent matter, he is permitted [to occupy himself with] a less stringent matter.  [If] he immersed himself without any intention, [it is deemed] as if he had not immersed himself.