아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Central Element

시간 제한2초메모리 제한512 MB

요약
세 위치를 골라 가운데 값을 묻는 질의를 2000번 이내로 던져 숨은 순열을 알아낸다.
난이도

보통10점 중 6점

유형
구현, 완전 탐색, 정렬
정답자
아직 제출이 없습니다

문제

There is a permutation P of numbers 1 through n, not known to you, P = <P1, P2, ..., Pn>. You can ask the following type of questions: Given three distinct positions i, j and k, which of Pi, Pj and Pk is central? Element is central if it is neither minimal nor maximal.

For example, if the permutation is <2, 1, 4, 3>, and you ask about positions 1, 2, and 3, you receive 2, because 2 is the central element of the set {P1, P2, P3} = {2, 1, 4}. Note that you don’t get the information at which position among 1, 2, and 3 it is located.

Your task is to find the permutation P. Actually, for each permutation P there is a set S(P) of permutations that cannot be distinguished from P using the allowed questions. You must find any permutation from this set.

입력

The first line of the standard input contains n, the size of the permutation (3 ≤ n ≤ 200).

Each of the next lines of the standard input contains response to your question — the number that is central among the numbers at the asked positions.

출력

When you’re asking questions, each line of the standard output should contain three different integers from the range of 1 to n, space-separated. You can ask at most 2 000 questions.

When you’re stating the answer, the line of the standard output should contain the word “OK”, and the numbers P1, P2, . . . , Pn, all space-separated. After printing this line your program must exit.

You must flush standard output after printing each line.

예제1

  1. 예제 1

    입력
    4
    2
    3
    2
    3
    
    예상 출력
    1 2 3
    2 3 4
    1 2 4
    1 3 4
    OK 2 1 4 3