> 
> *If you are not familiar with Braid-Theory I recommend that you read [this](https://en.wikipedia.org/wiki/Braid_group#Basic_properties) first. This question assumes that you are at least familiar with the concepts at hand and assumes you are well familiar with group-theory*
> 
> 
> 

Let us define \$\sigma\_n\$ to be the braid in which the \$n\$th strand (One indexed) from the top crosses over the \$n+1\$th strand, and \$\sigma\_n^-\$ to be the inverse of \$\sigma\_n\$ (That is the \$n+1\$th strand crosses the \$n\$th strand).

The braid group \$B\_n\$ is then generated by \$\langle\sigma\_1,\sigma\_2,\sigma\_3,\dots,\sigma\_{n-1}\rangle\$. Thus every braid on \$B\_n\$ can be written as the product of the \$\sigma\$-braids.1

---

Determining if two braids on a group are equal is not a simple task. It may be pretty obvious that \$\sigma\_1\sigma\_3 = \sigma\_3\sigma\_1\$, but it is a little less obvious that for example \$\sigma\_2\sigma\_1\sigma\_2 = \sigma\_1\sigma\_2\sigma\_1\$.2

So the question is "How can we determine if two braids are the same?". Well the two examples above each represent a bit of this. In general the following relations, called Artin's relations, are true:

* \$\sigma\_i\sigma\_j = \sigma\_j\sigma\_i; i - j > 1\$
* \$\sigma\_i\sigma\_{i+1}\sigma\_i = \sigma\_{i+1}\sigma\_i\sigma\_{i+1}\$

We can use these two relations in conjunction with the group axioms to prove that any equal braids are equal. Thus two braids are equal iff the repeated application of these relations and the group axioms can demonstrate so.

Task
----

You will write a program or function to take two braids and determine whether or not they are equal. You may also optionally take a positive integer representing the order of the group.

This is a [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'") question so answers will be scored in bytes, with less bytes being better.

Input and Output
----------------

You should represent a Braid as an ordered list of generators, (or any equivalent structure, e.g. vector). You may represent the generators in any reasonable form (e.g. an integer, a two tuple of a positive integer and a boolean).

On par with standard [descision-problem](/questions/tagged/descision-problem "show questions tagged 'descision-problem'") rules you should output one of two distinct values, an accept an reject.

Test Cases
----------

```
[],       []              -> True
[1,-1],   []              -> True
[1,2,1],  [2,1,2]         -> True
[1,3],    [3,1]           -> True
[1,3,2,1],[3,2,1,2]       -> True
[1,4,-4,3,2,1], [3,2,1,2] -> True
[2,2,1],  [2,1,2]         -> False
[1,2,-1], [-1,2,1]        -> False
[1,1,1,2],[1,1,2]         -> False

```

---

1: Note that while \$B\_n\$ satisfies all the properties of a group the operation on our braid group is *not* commutative, and thus our group is not abelian.

2: If you would like to verify this for yourself I suggest applying \$\sigma\_1^-\$ to both sides, If you draw the two out on paper, or model them with actual strings it should become apparent why this is the case.