I set these up with what I call rubber bands. Rubber bands are lines connecting things in a sequential manner, but they remain flexible regarding how far apart they are.
So a clue like "G comes before K" would look like:
G---K
G is attached to K with a rubber band, so G could be near K or far from K, but will never switch sides with K. So if I had the elements G H I J K and M, and that were my only clue, then I can do anything I want as long as I can stretch G and K into place.
M I H G J K G I M K J H G M H I J K M I G K J H
G---K G-----K G---------K G-K
...and so on.
Adding other clues restricts my possibilities.
"M is before G"
M----G----K
"H is after G"
M----G----K
\
\--H
Notice here that we don't have a rule defining H's relationship to K. Their order can change depending on how far we stretch our rubber bands.
H may be before K:
I M G J H K
M-G-----K
\
\-H
or H may be after K:
M G J K I H
M-G---K
\
\-----H
It's left up to us to figure out the possibilities within the constraints of the questions.
Try making a rubber band diagram of the rules in this game and see if it helps.