  In the present paper, we construct an invariant for virtual knots in the
thickened sphere with g handles; this invariant is a Laurent polynomial in 2g+3
variables. To this end, we use a modification of the Wirtinger presentation of
the knot group and the concept of parity introduced by V.O.Manturov. The
section 4 of the paper is devoted to an enhancement of the invariant
(construction of the invariant module) by using the parity hierarchy concept
suggested by V.O.Manturov. Namely, we discriminate between odd crossings and
two types of even crossings; the latter two types depend on whether an even
crossing remains even/odd after all odd crossings of the diagram are removed.
The construction of the invariant also works for virtual knots.
