arr1.forEach(([arr1FirstValue, arr1SecondValue]) => {
for (let k = 0; k < arr2.length; k++) {
const [arr2FirstValue, arr2SecondValue] = arr2[k]
if (arr1FirstValue < arr2FirstValue) {
if (arr1SecondValue < arr2SecondValue) {
arr.push([arr2FirstValue, arr1SecondValue])
} else {
arr.push([arr2FirstValue, arr1SecondValue])
}
}
else {
if (arr1SecondValue < arr2SecondValue) {
arr.push([arr1FirstValue, arr2SecondValue])
} else {
arr.push([arr1FirstValue, arr1SecondValue])
}
}
}
})