N = gets.to_i K = gets.split.map(&:to_i) def dfs(nums, turn = 0) l = nums.size kadomatsu_cnt = 0 win = turn.odd? [*0...l].combination(3) do |a, b, c| next if nums[a] == nums[b] next if nums[a] == nums[c] next if nums[b] == nums[c] next if nums[a] < nums[b] && nums[b] < nums[c] next if nums[a] > nums[b] && nums[b] > nums[c] kadomatsu_cnt += 1 arr = [] l.times do |i| next if i == a next if i == b next if i == c arr << nums[i] end if turn.even? win |= dfs(arr, turn + 1) else win &= dfs(arr, turn + 1) end if turn == 0 && win puts [a, b, c].join(' ') exit end end win end dfs(K) puts -1