package capigraph

import (
	"encoding/json"
	"fmt"
	"strings"
	"testing"

	"github.com/stretchr/testify/assert"
)

var testPermStrategies6 = "[null,null,[[0],[1]],[[0,0],[0,1],[0,2],[1,0],[1,1],[1,2]],[[0,0,0],[0,0,1],[0,0,2],[0,0,3],[0,1,0],[0,1,1],[0,1,2],[0,1,3],[0,2,0],[0,2,1],[0,2,2],[0,2,3],[1,0,0],[1,0,1],[1,0,2],[1,0,3],[1,1,0],[1,1,1],[1,1,2],[1,1,3],[1,2,0],[1,2,1],[1,2,2],[1,2,3]],[[0,0,0,0],[0,0,0,1],[0,0,0,2],[0,0,0,3],[0,0,0,4],[0,0,1,0],[0,0,1,1],[0,0,1,2],[0,0,1,3],[0,0,1,4],[0,0,2,0],[0,0,2,1],[0,0,2,2],[0,0,2,3],[0,0,2,4],[0,0,3,0],[0,0,3,1],[0,0,3,2],[0,0,3,3],[0,0,3,4],[0,1,0,0],[0,1,0,1],[0,1,0,2],[0,1,0,3],[0,1,0,4],[0,1,1,0],[0,1,1,1],[0,1,1,2],[0,1,1,3],[0,1,1,4],[0,1,2,0],[0,1,2,1],[0,1,2,2],[0,1,2,3],[0,1,2,4],[0,1,3,0],[0,1,3,1],[0,1,3,2],[0,1,3,3],[0,1,3,4],[0,2,0,0],[0,2,0,1],[0,2,0,2],[0,2,0,3],[0,2,0,4],[0,2,1,0],[0,2,1,1],[0,2,1,2],[0,2,1,3],[0,2,1,4],[0,2,2,0],[0,2,2,1],[0,2,2,2],[0,2,2,3],[0,2,2,4],[0,2,3,0],[0,2,3,1],[0,2,3,2],[0,2,3,3],[0,2,3,4],[1,0,0,0],[1,0,0,1],[1,0,0,2],[1,0,0,3],[1,0,0,4],[1,0,1,0],[1,0,1,1],[1,0,1,2],[1,0,1,3],[1,0,1,4],[1,0,2,0],[1,0,2,1],[1,0,2,2],[1,0,2,3],[1,0,2,4],[1,0,3,0],[1,0,3,1],[1,0,3,2],[1,0,3,3],[1,0,3,4],[1,1,0,0],[1,1,0,1],[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,3,5],[1,2,3,4,0],[1,2,3,4,1],[1,2,3,4,2],[1,2,3,4,3],[1,2,3,4,4],[1,2,3,4,5]]]"
var testFact6 = "[1,1,2,6,24,120,720]"

func TestInit(t *testing.T) {
	lp := NewLayerPermutator()
	b, _ := json.Marshal(lp.P)
	assert.Equal(t, testPermStrategies6, string(b))
	b, _ = json.Marshal(lp.Fact)
	assert.Equal(t, testFact6, string(b))
}

func TestSwapFunc(t *testing.T) {
	lp := NewLayerPermutator()
	intervalStarts := []int{1, 6}
	intervalLengths := []int{4, 2}
	in := []int16{-1, 10, 20, 30, 40, -2, 100, 200, -3}
	sb := strings.Builder{}
	lp.SwapIterator(intervalStarts, intervalLengths, len(intervalLengths), in, func(totalCnt int, perm []int16) {
		if sb.Len() > 0 {
			sb.WriteString(", ")
		}
		sb.WriteString(fmt.Sprintf("%d:%v", totalCnt, perm))
	})
	assert.Equal(t, "0:[-1 10 20 30 40 -2 100 200 -3], 1:[-1 10 20 30 40 -2 200 100 -3], 2:[-1 10 20 40 30 -2 100 200 -3], 3:[-1 10 20 40 30 -2 200 100 -3], 4:[-1 10 40 30 20 -2 100 200 -3], 5:[-1 10 40 30 20 -2 200 100 -3], 6:[-1 40 20 30 10 -2 100 200 -3], 7:[-1 40 20 30 10 -2 200 100 -3], 8:[-1 10 30 20 40 -2 100 200 -3], 9:[-1 10 30 20 40 -2 200 100 -3], 10:[-1 10 30 40 20 -2 100 200 -3], 11:[-1 10 30 40 20 -2 200 100 -3], 12:[-1 10 40 20 30 -2 100 200 -3], 13:[-1 10 40 20 30 -2 200 100 -3], 14:[-1 40 30 20 10 -2 100 200 -3], 15:[-1 40 30 20 10 -2 200 100 -3], 16:[-1 30 20 10 40 -2 100 200 -3], 17:[-1 30 20 10 40 -2 200 100 -3], 18:[-1 30 20 40 10 -2 100 200 -3], 19:[-1 30 20 40 10 -2 200 100 -3], 20:[-1 30 40 10 20 -2 100 200 -3], 21:[-1 30 40 10 20 -2 200 100 -3], 22:[-1 40 20 10 30 -2 100 200 -3], 23:[-1 40 20 10 30 -2 200 100 -3], 24:[-1 20 10 30 40 -2 100 200 -3], 25:[-1 20 10 30 40 -2 200 100 -3], 26:[-1 20 10 40 30 -2 100 200 -3], 27:[-1 20 10 40 30 -2 200 100 -3], 28:[-1 20 40 30 10 -2 100 200 -3], 29:[-1 20 40 30 10 -2 200 100 -3], 30:[-1 40 10 30 20 -2 100 200 -3], 31:[-1 40 10 30 20 -2 200 100 -3], 32:[-1 20 30 10 40 -2 100 200 -3], 33:[-1 20 30 10 40 -2 200 100 -3], 34:[-1 20 30 40 10 -2 100 200 -3], 35:[-1 20 30 40 10 -2 200 100 -3], 36:[-1 20 40 10 30 -2 100 200 -3], 37:[-1 20 40 10 30 -2 200 100 -3], 38:[-1 40 30 10 20 -2 100 200 -3], 39:[-1 40 30 10 20 -2 200 100 -3], 40:[-1 30 10 20 40 -2 100 200 -3], 41:[-1 30 10 20 40 -2 200 100 -3], 42:[-1 30 10 40 20 -2 100 200 -3], 43:[-1 30 10 40 20 -2 200 100 -3], 44:[-1 30 40 20 10 -2 100 200 -3], 45:[-1 30 40 20 10 -2 200 100 -3], 46:[-1 40 10 20 30 -2 100 200 -3], 47:[-1 40 10 20 30 -2 200 100 -3]", sb.String())
}

func TestInsert(t *testing.T) {
	lp := NewLayerPermutator()

	in := []int16{-1, -2, -3, -4, 100}
	lp.insertPermutationByIdx(in, 4, 1)
	assert.Equal(t, "[-1 100 -2 -3 -4]", fmt.Sprintf("%v", in))

	// Insert 100 and 200 starting at 0, 6x7=42 variants
	in = []int16{1, 2, 3, 4, 5, 100, 200}
	sb := strings.Builder{}
	lp.InsertIterator(5, 2, in, func(totalCnt int, perm []int16) {
		if sb.Len() > 0 {
			sb.WriteString(", ")
		}
		sb.WriteString(fmt.Sprintf("%d:%v", totalCnt, perm))
	})
	assert.Equal(t, "0:[1 2 3 4 5 100 200], 1:[1 2 3 4 5 200 100], 2:[1 2 3 4 200 5 100], 3:[1 2 3 200 4 5 100], 4:[1 2 200 3 4 5 100], 5:[1 200 2 3 4 5 100], 6:[200 1 2 3 4 5 100], 7:[1 2 3 4 100 5 200], 8:[1 2 3 4 100 200 5], 9:[1 2 3 4 200 100 5], 10:[1 2 3 200 4 100 5], 11:[1 2 200 3 4 100 5], 12:[1 200 2 3 4 100 5], 13:[200 1 2 3 4 100 5], 14:[1 2 3 100 4 5 200], 15:[1 2 3 100 4 200 5], 16:[1 2 3 100 200 4 5], 17:[1 2 3 200 100 4 5], 18:[1 2 200 3 100 4 5], 19:[1 200 2 3 100 4 5], 20:[200 1 2 3 100 4 5], 21:[1 2 100 3 4 5 200], 22:[1 2 100 3 4 200 5], 23:[1 2 100 3 200 4 5], 24:[1 2 100 200 3 4 5], 25:[1 2 200 100 3 4 5], 26:[1 200 2 100 3 4 5], 27:[200 1 2 100 3 4 5], 28:[1 100 2 3 4 5 200], 29:[1 100 2 3 4 200 5], 30:[1 100 2 3 200 4 5], 31:[1 100 2 200 3 4 5], 32:[1 100 200 2 3 4 5], 33:[1 200 100 2 3 4 5], 34:[200 1 100 2 3 4 5], 35:[100 1 2 3 4 5 200], 36:[100 1 2 3 4 200 5], 37:[100 1 2 3 200 4 5], 38:[100 1 2 200 3 4 5], 39:[100 1 200 2 3 4 5], 40:[100 200 1 2 3 4 5], 41:[200 100 1 2 3 4 5]", sb.String())
}

/*
	func TestSwap(t *testing.T) {
		lp := NewLayerPermutator()

		// All permutations of 10/20/30/40 and 100/200 intervals
		permIntervalStarts := [20]int{1, 6}
		permIntervalLengths := [20]int{4, 2}
		a := []int16{-1, 10, 20, 30, 40, -2, 100, 200, -3}
		sb := strings.Builder{}
		for i, perm := range lp.SwapPermIterator(&permIntervalStarts, &permIntervalLengths, 2, a) {
			sb.WriteString(fmt.Sprintf("%d %v, ", i, perm))
		}
		assert.Equal(t, "0 [-1 40 10 20 30 -2 200 100 -3], 1 [-1 40 10 20 30 -2 100 200 -3], 2 [-1 30 40 20 10 -2 200 100 -3], 3 [-1 30 40 20 10 -2 100 200 -3], 4 [-1 30 10 40 20 -2 200 100 -3], 5 [-1 30 10 40 20 -2 100 200 -3], 6 [-1 30 10 20 40 -2 200 100 -3], 7 [-1 30 10 20 40 -2 100 200 -3], 8 [-1 40 30 10 20 -2 200 100 -3], 9 [-1 40 30 10 20 -2 100 200 -3], 10 [-1 20 40 10 30 -2 200 100 -3], 11 [-1 20 40 10 30 -2 100 200 -3], 12 [-1 20 30 40 10 -2 200 100 -3], 13 [-1 20 30 40 10 -2 100 200 -3], 14 [-1 20 30 10 40 -2 200 100 -3], 15 [-1 20 30 10 40 -2 100 200 -3], 16 [-1 40 10 30 20 -2 200 100 -3], 17 [-1 40 10 30 20 -2 100 200 -3], 18 [-1 20 40 30 10 -2 200 100 -3], 19 [-1 20 40 30 10 -2 100 200 -3], 20 [-1 20 10 40 30 -2 200 100 -3], 21 [-1 20 10 40 30 -2 100 200 -3], 22 [-1 20 10 30 40 -2 200 100 -3], 23 [-1 20 10 30 40 -2 100 200 -3], 24 [-1 40 20 10 30 -2 200 100 -3], 25 [-1 40 20 10 30 -2 100 200 -3], 26 [-1 30 40 10 20 -2 200 100 -3], 27 [-1 30 40 10 20 -2 100 200 -3], 28 [-1 30 20 40 10 -2 200 100 -3], 29 [-1 30 20 40 10 -2 100 200 -3], 30 [-1 30 20 10 40 -2 200 100 -3], 31 [-1 30 20 10 40 -2 100 200 -3], 32 [-1 40 30 20 10 -2 200 100 -3], 33 [-1 40 30 20 10 -2 100 200 -3], 34 [-1 10 40 20 30 -2 200 100 -3], 35 [-1 10 40 20 30 -2 100 200 -3], 36 [-1 10 30 40 20 -2 200 100 -3], 37 [-1 10 30 40 20 -2 100 200 -3], 38 [-1 10 30 20 40 -2 200 100 -3], 39 [-1 10 30 20 40 -2 100 200 -3], 40 [-1 40 20 30 10 -2 200 100 -3], 41 [-1 40 20 30 10 -2 100 200 -3], 42 [-1 10 40 30 20 -2 200 100 -3], 43 [-1 10 40 30 20 -2 100 200 -3], 44 [-1 10 20 40 30 -2 200 100 -3], 45 [-1 10 20 40 30 -2 100 200 -3], 46 [-1 10 20 30 40 -2 200 100 -3], 47 [-1 10 20 30 40 -2 100 200 -3], ", sb.String())
	}
*/
func TestSwapAndInsert(t *testing.T) {
	lp := NewLayerPermutator()

	// Swap permutations of 10/20 and 100/200, and insert 1000 and 2000 before 1000, total 2x2x8*9=288 final permutations
	in := []int16{-1, 10, 20, -2, 100, 200, -3, 1000, 2000}
	intervalStarts := []int{1, 4}
	intervalLengths := []int{2, 2}
	sb := strings.Builder{}
	lp.SwapAndInsertIterator(intervalStarts, intervalLengths, len(intervalStarts), 7, 2, in, func(totalCnt int, perm []int16) {
		if sb.Len() > 0 {
			sb.WriteString(", ")
		}
		sb.WriteString(fmt.Sprintf("%d:%v", totalCnt, perm))
	})
	assert.Equal(t, "0:[-1 10 20 -2 100 200 -3 1000 2000], 1:[-1 10 20 -2 100 200 -3 2000 1000], 2:[-1 10 20 -2 100 200 2000 -3 1000], 3:[-1 10 20 -2 100 2000 200 -3 1000], 4:[-1 10 20 -2 2000 100 200 -3 1000], 5:[-1 10 20 2000 -2 100 200 -3 1000], 6:[-1 10 2000 20 -2 100 200 -3 1000], 7:[-1 2000 10 20 -2 100 200 -3 1000], 8:[2000 -1 10 20 -2 100 200 -3 1000], 9:[-1 10 20 -2 100 200 1000 -3 2000], 10:[-1 10 20 -2 100 200 1000 2000 -3], 11:[-1 10 20 -2 100 200 2000 1000 -3], 12:[-1 10 20 -2 100 2000 200 1000 -3], 13:[-1 10 20 -2 2000 100 200 1000 -3], 14:[-1 10 20 2000 -2 100 200 1000 -3], 15:[-1 10 2000 20 -2 100 200 1000 -3], 16:[-1 2000 10 20 -2 100 200 1000 -3], 17:[2000 -1 10 20 -2 100 200 1000 -3], 18:[-1 10 20 -2 100 1000 200 -3 2000], 19:[-1 10 20 -2 100 1000 200 2000 -3], 20:[-1 10 20 -2 100 1000 2000 200 -3], 21:[-1 10 20 -2 100 2000 1000 200 -3], 22:[-1 10 20 -2 2000 100 1000 200 -3], 23:[-1 10 20 2000 -2 100 1000 200 -3], 24:[-1 10 2000 20 -2 100 1000 200 -3], 25:[-1 2000 10 20 -2 100 1000 200 -3], 26:[2000 -1 10 20 -2 100 1000 200 -3], 27:[-1 10 20 -2 1000 100 200 -3 2000], 28:[-1 10 20 -2 1000 100 200 2000 -3], 29:[-1 10 20 -2 1000 100 2000 200 -3], 30:[-1 10 20 -2 1000 2000 100 200 -3], 31:[-1 10 20 -2 2000 1000 100 200 -3], 32:[-1 10 20 2000 -2 1000 100 200 -3], 33:[-1 10 2000 20 -2 1000 100 200 -3], 34:[-1 2000 10 20 -2 1000 100 200 -3], 35:[2000 -1 10 20 -2 1000 100 200 -3], 36:[-1 10 20 1000 -2 100 200 -3 2000], 37:[-1 10 20 1000 -2 100 200 2000 -3], 38:[-1 10 20 1000 -2 100 2000 200 -3], 39:[-1 10 20 1000 -2 2000 100 200 -3], 40:[-1 10 20 1000 2000 -2 100 200 -3], 41:[-1 10 20 2000 1000 -2 100 200 -3], 42:[-1 10 2000 20 1000 -2 100 200 -3], 43:[-1 2000 10 20 1000 -2 100 200 -3], 44:[2000 -1 10 20 1000 -2 100 200 -3], 45:[-1 10 1000 20 -2 100 200 -3 2000], 46:[-1 10 1000 20 -2 100 200 2000 -3], 47:[-1 10 1000 20 -2 100 2000 200 -3], 48:[-1 10 1000 20 -2 2000 100 200 -3], 49:[-1 10 1000 20 2000 -2 100 200 -3], 50:[-1 10 1000 2000 20 -2 100 200 -3], 51:[-1 10 2000 1000 20 -2 100 200 -3], 52:[-1 2000 10 1000 20 -2 100 200 -3], 53:[2000 -1 10 1000 20 -2 100 200 -3], 54:[-1 1000 10 20 -2 100 200 -3 2000], 55:[-1 1000 10 20 -2 100 200 2000 -3], 56:[-1 1000 10 20 -2 100 2000 200 -3], 57:[-1 1000 10 20 -2 2000 100 200 -3], 58:[-1 1000 10 20 2000 -2 100 200 -3], 59:[-1 1000 10 2000 20 -2 100 200 -3], 60:[-1 1000 2000 10 20 -2 100 200 -3], 61:[-1 2000 1000 10 20 -2 100 200 -3], 62:[2000 -1 1000 10 20 -2 100 200 -3], 63:[1000 -1 10 20 -2 100 200 -3 2000], 64:[1000 -1 10 20 -2 100 200 2000 -3], 65:[1000 -1 10 20 -2 100 2000 200 -3], 66:[1000 -1 10 20 -2 2000 100 200 -3], 67:[1000 -1 10 20 2000 -2 100 200 -3], 68:[1000 -1 10 2000 20 -2 100 200 -3], 69:[1000 -1 2000 10 20 -2 100 200 -3], 70:[1000 2000 -1 10 20 -2 100 200 -3], 71:[2000 1000 -1 10 20 -2 100 200 -3], 72:[-1 10 20 -2 200 100 -3 1000 2000], 73:[-1 10 20 -2 200 100 -3 2000 1000], 74:[-1 10 20 -2 200 100 2000 -3 1000], 75:[-1 10 20 -2 200 2000 100 -3 1000], 76:[-1 10 20 -2 2000 200 100 -3 1000], 77:[-1 10 20 2000 -2 200 100 -3 1000], 78:[-1 10 2000 20 -2 200 100 -3 1000], 79:[-1 2000 10 20 -2 200 100 -3 1000], 80:[2000 -1 10 20 -2 200 100 -3 1000], 81:[-1 10 20 -2 200 100 1000 -3 2000], 82:[-1 10 20 -2 200 100 1000 2000 -3], 83:[-1 10 20 -2 200 100 2000 1000 -3], 84:[-1 10 20 -2 200 2000 100 1000 -3], 85:[-1 10 20 -2 2000 200 100 1000 -3], 86:[-1 10 20 2000 -2 200 100 1000 -3], 87:[-1 10 2000 20 -2 200 100 1000 -3], 88:[-1 2000 10 20 -2 200 100 1000 -3], 89:[2000 -1 10 20 -2 200 100 1000 -3], 90:[-1 10 20 -2 200 1000 100 -3 2000], 91:[-1 10 20 -2 200 1000 100 2000 -3], 92:[-1 10 20 -2 200 1000 2000 100 -3], 93:[-1 10 20 -2 200 2000 1000 100 -3], 94:[-1 10 20 -2 2000 200 1000 100 -3], 95:[-1 10 20 2000 -2 200 1000 100 -3], 96:[-1 10 2000 20 -2 200 1000 100 -3], 97:[-1 2000 10 20 -2 200 1000 100 -3], 98:[2000 -1 10 20 -2 200 1000 100 -3], 99:[-1 10 20 -2 1000 200 100 -3 2000], 100:[-1 10 20 -2 1000 200 100 2000 -3], 101:[-1 10 20 -2 1000 200 2000 100 -3], 102:[-1 10 20 -2 1000 2000 200 100 -3], 103:[-1 10 20 -2 2000 1000 200 100 -3], 104:[-1 10 20 2000 -2 1000 200 100 -3], 105:[-1 10 2000 20 -2 1000 200 100 -3], 106:[-1 2000 10 20 -2 1000 200 100 -3], 107:[2000 -1 10 20 -2 1000 200 100 -3], 108:[-1 10 20 1000 -2 200 100 -3 2000], 109:[-1 10 20 1000 -2 200 100 2000 -3], 110:[-1 10 20 1000 -2 200 2000 100 -3], 111:[-1 10 20 1000 -2 2000 200 100 -3], 112:[-1 10 20 1000 2000 -2 200 100 -3], 113:[-1 10 20 2000 1000 -2 200 100 -3], 114:[-1 10 2000 20 1000 -2 200 100 -3], 115:[-1 2000 10 20 1000 -2 200 100 -3], 116:[2000 -1 10 20 1000 -2 200 100 -3], 117:[-1 10 1000 20 -2 200 100 -3 2000], 118:[-1 10 1000 20 -2 200 100 2000 -3], 119:[-1 10 1000 20 -2 200 2000 100 -3], 120:[-1 10 1000 20 -2 2000 200 100 -3], 121:[-1 10 1000 20 2000 -2 200 100 -3], 122:[-1 10 1000 2000 20 -2 200 100 -3], 123:[-1 10 2000 1000 20 -2 200 100 -3], 124:[-1 2000 10 1000 20 -2 200 100 -3], 125:[2000 -1 10 1000 20 -2 200 100 -3], 126:[-1 1000 10 20 -2 200 100 -3 2000], 127:[-1 1000 10 20 -2 200 100 2000 -3], 128:[-1 1000 10 20 -2 200 2000 100 -3], 129:[-1 1000 10 20 -2 2000 200 100 -3], 130:[-1 1000 10 20 2000 -2 200 100 -3], 131:[-1 1000 10 2000 20 -2 200 100 -3], 132:[-1 1000 2000 10 20 -2 200 100 -3], 133:[-1 2000 1000 10 20 -2 200 100 -3], 134:[2000 -1 1000 10 20 -2 200 100 -3], 135:[1000 -1 10 20 -2 200 100 -3 2000], 136:[1000 -1 10 20 -2 200 100 2000 -3], 137:[1000 -1 10 20 -2 200 2000 100 -3], 138:[1000 -1 10 20 -2 2000 200 100 -3], 139:[1000 -1 10 20 2000 -2 200 100 -3], 140:[1000 -1 10 2000 20 -2 200 100 -3], 141:[1000 -1 2000 10 20 -2 200 100 -3], 142:[1000 2000 -1 10 20 -2 200 100 -3], 143:[2000 1000 -1 10 20 -2 200 100 -3], 144:[-1 20 10 -2 100 200 -3 1000 2000], 145:[-1 20 10 -2 100 200 -3 2000 1000], 146:[-1 20 10 -2 100 200 2000 -3 1000], 147:[-1 20 10 -2 100 2000 200 -3 1000], 148:[-1 20 10 -2 2000 100 200 -3 1000], 149:[-1 20 10 2000 -2 100 200 -3 1000], 150:[-1 20 2000 10 -2 100 200 -3 1000], 151:[-1 2000 20 10 -2 100 200 -3 1000], 152:[2000 -1 20 10 -2 100 200 -3 1000], 153:[-1 20 10 -2 100 200 1000 -3 2000], 154:[-1 20 10 -2 100 200 1000 2000 -3], 155:[-1 20 10 -2 100 200 2000 1000 -3], 156:[-1 20 10 -2 100 2000 200 1000 -3], 157:[-1 20 10 -2 2000 100 200 1000 -3], 158:[-1 20 10 2000 -2 100 200 1000 -3], 159:[-1 20 2000 10 -2 100 200 1000 -3], 160:[-1 2000 20 10 -2 100 200 1000 -3], 161:[2000 -1 20 10 -2 100 200 1000 -3], 162:[-1 20 10 -2 100 1000 200 -3 2000], 163:[-1 20 10 -2 100 1000 200 2000 -3], 164:[-1 20 10 -2 100 1000 2000 200 -3], 165:[-1 20 10 -2 100 2000 1000 200 -3], 166:[-1 20 10 -2 2000 100 1000 200 -3], 167:[-1 20 10 2000 -2 100 1000 200 -3], 168:[-1 20 2000 10 -2 100 1000 200 -3], 169:[-1 2000 20 10 -2 100 1000 200 -3], 170:[2000 -1 20 10 -2 100 1000 200 -3], 171:[-1 20 10 -2 1000 100 200 -3 2000], 172:[-1 20 10 -2 1000 100 200 2000 -3], 173:[-1 20 10 -2 1000 100 2000 200 -3], 174:[-1 20 10 -2 1000 2000 100 200 -3], 175:[-1 20 10 -2 2000 1000 100 200 -3], 176:[-1 20 10 2000 -2 1000 100 200 -3], 177:[-1 20 2000 10 -2 1000 100 200 -3], 178:[-1 2000 20 10 -2 1000 100 200 -3], 179:[2000 -1 20 10 -2 1000 100 200 -3], 180:[-1 20 10 1000 -2 100 200 -3 2000], 181:[-1 20 10 1000 -2 100 200 2000 -3], 182:[-1 20 10 1000 -2 100 2000 200 -3], 183:[-1 20 10 1000 -2 2000 100 200 -3], 184:[-1 20 10 1000 2000 -2 100 200 -3], 185:[-1 20 10 2000 1000 -2 100 200 -3], 186:[-1 20 2000 10 1000 -2 100 200 -3], 187:[-1 2000 20 10 1000 -2 100 200 -3], 188:[2000 -1 20 10 1000 -2 100 200 -3], 189:[-1 20 1000 10 -2 100 200 -3 2000], 190:[-1 20 1000 10 -2 100 200 2000 -3], 191:[-1 20 1000 10 -2 100 2000 200 -3], 192:[-1 20 1000 10 -2 2000 100 200 -3], 193:[-1 20 1000 10 2000 -2 100 200 -3], 194:[-1 20 1000 2000 10 -2 100 200 -3], 195:[-1 20 2000 1000 10 -2 100 200 -3], 196:[-1 2000 20 1000 10 -2 100 200 -3], 197:[2000 -1 20 1000 10 -2 100 200 -3], 198:[-1 1000 20 10 -2 100 200 -3 2000], 199:[-1 1000 20 10 -2 100 200 2000 -3], 200:[-1 1000 20 10 -2 100 2000 200 -3], 201:[-1 1000 20 10 -2 2000 100 200 -3], 202:[-1 1000 20 10 2000 -2 100 200 -3], 203:[-1 1000 20 2000 10 -2 100 200 -3], 204:[-1 1000 2000 20 10 -2 100 200 -3], 205:[-1 2000 1000 20 10 -2 100 200 -3], 206:[2000 -1 1000 20 10 -2 100 200 -3], 207:[1000 -1 20 10 -2 100 200 -3 2000], 208:[1000 -1 20 10 -2 100 200 2000 -3], 209:[1000 -1 20 10 -2 100 2000 200 -3], 210:[1000 -1 20 10 -2 2000 100 200 -3], 211:[1000 -1 20 10 2000 -2 100 200 -3], 212:[1000 -1 20 2000 10 -2 100 200 -3], 213:[1000 -1 2000 20 10 -2 100 200 -3], 214:[1000 2000 -1 20 10 -2 100 200 -3], 215:[2000 1000 -1 20 10 -2 100 200 -3], 216:[-1 20 10 -2 200 100 -3 1000 2000], 217:[-1 20 10 -2 200 100 -3 2000 1000], 218:[-1 20 10 -2 200 100 2000 -3 1000], 219:[-1 20 10 -2 200 2000 100 -3 1000], 220:[-1 20 10 -2 2000 200 100 -3 1000], 221:[-1 20 10 2000 -2 200 100 -3 1000], 222:[-1 20 2000 10 -2 200 100 -3 1000], 223:[-1 2000 20 10 -2 200 100 -3 1000], 224:[2000 -1 20 10 -2 200 100 -3 1000], 225:[-1 20 10 -2 200 100 1000 -3 2000], 226:[-1 20 10 -2 200 100 1000 2000 -3], 227:[-1 20 10 -2 200 100 2000 1000 -3], 228:[-1 20 10 -2 200 2000 100 1000 -3], 229:[-1 20 10 -2 2000 200 100 1000 -3], 230:[-1 20 10 2000 -2 200 100 1000 -3], 231:[-1 20 2000 10 -2 200 100 1000 -3], 232:[-1 2000 20 10 -2 200 100 1000 -3], 233:[2000 -1 20 10 -2 200 100 1000 -3], 234:[-1 20 10 -2 200 1000 100 -3 2000], 235:[-1 20 10 -2 200 1000 100 2000 -3], 236:[-1 20 10 -2 200 1000 2000 100 -3], 237:[-1 20 10 -2 200 2000 1000 100 -3], 238:[-1 20 10 -2 2000 200 1000 100 -3], 239:[-1 20 10 2000 -2 200 1000 100 -3], 240:[-1 20 2000 10 -2 200 1000 100 -3], 241:[-1 2000 20 10 -2 200 1000 100 -3], 242:[2000 -1 20 10 -2 200 1000 100 -3], 243:[-1 20 10 -2 1000 200 100 -3 2000], 244:[-1 20 10 -2 1000 200 100 2000 -3], 245:[-1 20 10 -2 1000 200 2000 100 -3], 246:[-1 20 10 -2 1000 2000 200 100 -3], 247:[-1 20 10 -2 2000 1000 200 100 -3], 248:[-1 20 10 2000 -2 1000 200 100 -3], 249:[-1 20 2000 10 -2 1000 200 100 -3], 250:[-1 2000 20 10 -2 1000 200 100 -3], 251:[2000 -1 20 10 -2 1000 200 100 -3], 252:[-1 20 10 1000 -2 200 100 -3 2000], 253:[-1 20 10 1000 -2 200 100 2000 -3], 254:[-1 20 10 1000 -2 200 2000 100 -3], 255:[-1 20 10 1000 -2 2000 200 100 -3], 256:[-1 20 10 1000 2000 -2 200 100 -3], 257:[-1 20 10 2000 1000 -2 200 100 -3], 258:[-1 20 2000 10 1000 -2 200 100 -3], 259:[-1 2000 20 10 1000 -2 200 100 -3], 260:[2000 -1 20 10 1000 -2 200 100 -3], 261:[-1 20 1000 10 -2 200 100 -3 2000], 262:[-1 20 1000 10 -2 200 100 2000 -3], 263:[-1 20 1000 10 -2 200 2000 100 -3], 264:[-1 20 1000 10 -2 2000 200 100 -3], 265:[-1 20 1000 10 2000 -2 200 100 -3], 266:[-1 20 1000 2000 10 -2 200 100 -3], 267:[-1 20 2000 1000 10 -2 200 100 -3], 268:[-1 2000 20 1000 10 -2 200 100 -3], 269:[2000 -1 20 1000 10 -2 200 100 -3], 270:[-1 1000 20 10 -2 200 100 -3 2000], 271:[-1 1000 20 10 -2 200 100 2000 -3], 272:[-1 1000 20 10 -2 200 2000 100 -3], 273:[-1 1000 20 10 -2 2000 200 100 -3], 274:[-1 1000 20 10 2000 -2 200 100 -3], 275:[-1 1000 20 2000 10 -2 200 100 -3], 276:[-1 1000 2000 20 10 -2 200 100 -3], 277:[-1 2000 1000 20 10 -2 200 100 -3], 278:[2000 -1 1000 20 10 -2 200 100 -3], 279:[1000 -1 20 10 -2 200 100 -3 2000], 280:[1000 -1 20 10 -2 200 100 2000 -3], 281:[1000 -1 20 10 -2 200 2000 100 -3], 282:[1000 -1 20 10 -2 2000 200 100 -3], 283:[1000 -1 20 10 2000 -2 200 100 -3], 284:[1000 -1 20 2000 10 -2 200 100 -3], 285:[1000 -1 2000 20 10 -2 200 100 -3], 286:[1000 2000 -1 20 10 -2 200 100 -3], 287:[2000 1000 -1 20 10 -2 200 100 -3]", sb.String())
}
