React

[1, 5, 2, 6, 3, 7, 4]

commands
[[2, 5, 3], [4, 4, 1], [1, 7, 3]]
return
[5, 6, 3]