On the Subject of Gem Division

I hear jewel theft is popular around these parts...

Before you lies an artifact revered by the ancient Ichmotep civilisation; a ring of twenty precious gems, resting upon an altar.

This artifact was believed to be desired by the gods of the sky and the earth, Obec and Terzhu, who would fight one another to claim it, causing natural disasters and damaging the artifact itself.
Tired of the feud, the god of the sea, Nayri, stole the artifact and placed it upon the altar, where neither god can reach it.

A great treasure is said to be bestowed to the one who returns the artifact to the gods and resolves the feud. This can only be done by interacting with the altar.
You attempt to cut the gems from the ring and sort them individually but you notice:

  • The gems cannot be moved from their positions on the altar.
  • After a certain number of cuts, the ones made earliest fix themselves.
    It appears that there can be no more additional cuts than there are distinct gem types.
  • Touching the original cut reseals all additional cuts except the one made most recently.

Pressing the centre of the altar will prepare the artifact for offering:

  1. The ring is separated into groups based on where the cuts have been made.
  2. The group immediately clockwise from the original cut is offered to Obec.
  3. Each group after alternates between which god it is being offered to.

If both gods receive the same number of each type of gem, they will accept the offering, and the treasure is yours.
However if either god receives fewer of any gem type than the other, the fighting will continue and there will be consequences for angering them.