Under construction

Still being built. Things may change

Triangles

Time limit2sMemory limit1024 MB

Summary
Given a green triangle and n marked points, find three of the points that form a blue triangle strictly containing the green one, or report NO.
Level

Medium7 of 10

Topics
Geometry, Sorting, Binary search
Solved
No attempts yet

Problem

Peter is a freshman at the university. His biggest problem is analytical geometry, because his mind simply resists anything new.

Peter is bored at analytical geometry lectures, but he attends them anyway. Right now he is sitting in one of these lectures and looking for something to entertain himself. Peter loves triangles. They are simple, and he knows them well. He has a sheet of paper and a blue ballpen. He put nn dots on the sheet and decided to connect them with lines and fill the triangles in blue.

At that moment the bell rings, and everyone leaves the room for a break. When Peter returns, he finds that someone has drawn a green triangle on his paper. He does not like green. He wants to draw his own blue triangle with three of the marked dots as vertices, so that it covers the green triangle. The green triangle must lie strictly inside the blue one, so the boundaries of the two triangles must have no common points. Peter has not been listening to his professor and cannot solve the problem alone, so he asks you for help.

Input

The first three lines of the input contain two integers each, the coordinates of the vertices of the green triangle, given in counterclockwise order. The triangle is guaranteed not to be degenerate.

The fourth line contains an integer nn, the number of marked dots (1≤n≤1051 \le n \le 10^5). Each of the next nn lines contains two integers, the coordinates of one dot. All nn dots are guaranteed to be pairwise distinct.

All coordinates have absolute value at most 10610^6.

Output

If the desired blue triangle that strictly contains the green triangle does not exist, print NO.

Otherwise, print YES on the first line. On the second line, print the numbers of the dots that are the vertices of the blue triangle, in counterclockwise order. Dots are numbered from 1 in the order they appear in the input. If there are several solutions, print any of them.

Examples2

  1. Example 1

    Input
    0 0
    1 0
    0 1
    3
    -1 -1
    2 0
    -1 2
    
    Expected output
    YES
    1 2 3
    
  2. Example 2

    Input
    0 0
    1 0
    0 1
    3
    0 -2
    -2 1
    3 1
    
    Expected output
    NO