local n = io.read("*n") local k = {} local box = {} for i = 1, n do k[i], box[i] = io.read("*n"), false end local function iskado(i1, i2, i3) return (k[i1] ~= k[i3] and (k[i1] - k[i2]) * (k[i2] - k[i3]) < 0) end local function getbox(i1, i2, i3) local t = {i1, i2, i3} local ret = {0, 0, 0} for i = 1, 3 do local tmp = 0 for j = 1, n do if(not box[j]) then tmp = tmp + 1 if(tmp == t[i]) then ret[i] = j break end end end end box[ret[1]], box[ret[2]], box[ret[3]] = true, true, true return unpack(ret) end local function unsetbox(b1, b2, b3) box[b1], box[b2], box[b3] = false, false, false end local wd1, wd2, wd3 = 0, 0, 0 local d_win_found = false for i1_1 = 1, n - 2 do for i1_2 = i1_1 + 1, n - 1 do for i1_3 = i1_2 + 1, n do wd1, wd2, wd3 = i1_1, i1_2, i1_3 local b1_1, b1_2, b1_3 = getbox(i1_1, i1_2, i1_3) if(iskado(b1_1, b1_2, b1_3)) then if(n <= 5) then d_win_found = true else local e_has_win_route = false for i2_1 = 1, n - 5 do for i2_2 = i2_1 + 1, n - 4 do for i2_3 = i2_2 + 1, n - 3 do local b2_1, b2_2, b2_3 = getbox(i2_1, i2_2, i2_3) if(iskado(b2_1, b2_2, b2_3)) then if(n <= 8) then e_has_win_route = true else local d_has_win_route = false for i3_1 = 1, n - 8 do for i3_2 = i3_1 + 1, n - 7 do for i3_3 = i3_2 + 1, n - 6 do local b3_1, b3_2, b3_3 = getbox(i3_1, i3_2, i3_3) if(iskado(b3_1, b3_2, b3_3)) then if(n <= 11) then d_has_win_route = true else local b4_1, b4_2, b4_3 = getbox(1, 2, 3) if(not iskado(b4_1, b4_2, b4_3)) then d_has_win_route = true end unsetbox(b4_1, b4_2, b4_3) end end unsetbox(b3_1, b3_2, b3_3) if(d_has_win_route) then break end end if(d_has_win_route) then break end end if(d_has_win_route) then break end end if(not d_has_win_route) then e_has_win_route = true end end end unsetbox(b2_1, b2_2, b2_3) if(e_has_win_route) then break end end --i2_3 if(e_has_win_route) then break end end --i2_2 if(e_has_win_route) then break end end --i2_1 if(not e_has_win_route) then d_win_found = true end end--if (6 <= n) end unsetbox(b1_1, b1_2, b1_3) if(d_win_found) then break end end --i1_3 if(d_win_found) then break end end --i1_2 if(d_win_found) then break end end --i1_1 if(d_win_found) then print(wd1 - 1 .. " " .. wd2 - 1 .. " " .. wd3 - 1) else print(-1) end