Cayley Table of the Dihedral Group \$D_3\$ The Dihedral group \$D_3\$ represents the symmetries of an equilateral triangle, using the identity (represented by id), rotations (represented by r1 and r2), and reflections (represented by s0, s1, and s2). 

Your task is to compute the composition \$yx\$ of the elements \$x, y \in D_3 \$. They are given by the Cayley table below:

  x  id  r1  r2  s0  s1  s2
y  +-----------------------
id | id  r1  r2  s0  s1  s2
r1 | r1  r2  id  s1  s2  s0
r2 | r2  id  r1  s2  s0  s1
s0 | s0  s2  s1  id  r2  r1
s1 | s1  s0  s2  r1  id  r2
s2 | s2  s1  s0  r2  r1  id


Input

Any reasonable input of x and y. Order does not matter.

Output

y composed with x, or looking up values in the table based on x and y.

Test Cases

These are given in the form x y -&gt; yx.

id id -&gt; id
s1 s2 -&gt; r1
r1 r1 -&gt; r2
r2 r1 -&gt; id
s0 id -&gt; s0
id s0 -&gt; s0


Notes on I/O

You may use any reasonable replacement of id, r1, r2, s0, s1, s2, for example 1, 2, 3, 4, 5, 6, 0, 1, 2, 3, 4, 5, or even [0,0], [0,1], [0,2], [1,0], [1,1], [1,2] (here the first number represents rotation/reflection and the second is the index).
Python 2, 27 bytes



lambda o,O:[o[_]for _ in O]


Try it online!