The plaintiff or any defendant who has answered may bring the case on for trial as other civil actions are brought on for trial. A defendant interposing a counterclaim for purposes of trial shall be deemed plaintiff, and the plaintiff and codefendants against whom relief is sought shall be deemed defendants as to the counterclaiming defendant. The court in its decision shall find the nature and extent of the claim asserted by the various parties, and shall determine the validity, superiority, and priority of the same. Any defendant in default for want of an answer, or not appearing at the trial, or a plaintiff not appearing at the trial, shall be adjudged to have no estate or interest in, or lien or encumbrance upon, the property, and such defendant also shall be adjudged to pay the amount demanded against such defendant in any counterclaim or reply for the use and occupation of the premises, property removed therefrom, and waste committed, except in the case of a defendant served by publication and not appearing. If any counterclaim for improvements has been urged against one recovering property, the value of such improvements thereof and the value of the land aside from the improvements shall be specifically found. There likewise shall be findings on all other counterclaims urged at the trial. If possession of the premises is demanded by the plaintiff or by any defendant asking for affirmative relief, such possession shall be awarded to the party asking for possession who has the paramount claim to the property, and such party thereupon may have a writ for possession as against all other parties to the action. Costs shall be awarded to the prevailing parties against each adversary in the action by the court, except that no costs shall be allowed against a defendant not appearing.
N.D.C.C. § 32-17-10