A shape is its corners joined in order. A side is the gap between its numbers.
If two corners share the same first number, the side is straight up and down; the length is the gap between the second numbers.
Add all the sides to find the way round.