EN
We introduce a way to color the regions of a classical knot diagram using ternary operations, so that the number of colorings is a knot invariant. By choosing appropriate substitutions in the algebras that we assign to diagrams, we obtain the relations from the knot group, and from the core group. Using the ternary operator approach, we generalize the Dehn presentation of the knot group to extra loops, and a similar presentation for the core group to the variety of Moufang loops.