Under construction

Still being built. Things may change

New Year and Rectangle

Time limit3sMemory limit1024 MB

Summary
Locate a hidden axis-aligned rectangle on an n by n grid using at most q count queries over an interactive judge. Standard binary search on edges with a count oracle.
Level

Hard8 of 10

Topics
Binary search, Implementation, Brute force
Solved
No attempts yet

Statement

This is an interactive problem.

For New Year, Grandfather Frost gave Gleb the gift he had wanted for a long time: a grid square of size n×nn \times n. The gift has a surprise. Grandfather Frost picked a non-empty rectangle inside the square and placed one tangerine in each cell of that rectangle.

To get the gift, Gleb must play a game with Grandfather Frost. Gleb has to find which rectangle contains all the tangerines. Rows and columns are numbered from 11 to nn, bottom to top and left to right. Gleb can make two kinds of queries:

  • ? x_1 y_1 x_2 y_2 (1≤x1≤x2≤n1 \le x_1 \le x_2 \le n, 1≤y1≤y2≤n1 \le y_1 \le y_2 \le n): Grandfather Frost replies with the number of tangerines in the rectangle whose bottom-left cell is (x1,y1)(x_1, y_1) and top-right cell is (x2,y2)(x_2, y_2).
  • ! x_1 y_1 x_2 y_2 (1≤x1≤x2≤n1 \le x_1 \le x_2 \le n, 1≤y1≤y2≤n1 \le y_1 \le y_2 \le n): when Gleb is sure of the location, he makes this query to report his answer. (x1,y1)(x_1, y_1) is the bottom-left cell of the guessed rectangle and (x2,y2)(x_2, y_2) is its top-right cell.

Input

The program receives one integer nn (1≤n≤2⋅1091 \leq n \leq 2 \cdot 10^9), the size of the square.

After each ? query, the program receives the number of tangerines in the rectangle you asked about.

Output

Print only valid queries in the format above. The last line must be a single ! query, after which the program must exit immediately. The program may print at most qq ? queries (qq depends on the group number). The final ! query is not counted among the qq queries.

Follow the output format exactly. Flush the output buffer after each line: use flush(output) in Pascal or Delphi, fflush(stdout) or cout.flush() in C/C++, sys.stdout.flush() in Python, and System.out.flush() in Java.

Hint

You do not have to make the same queries as the ones in the first test to pass it.

Examples1

  1. Example 1

    Input
    4
    
    6
    
    6
    
    4
    
    
    Expected output
    
    ? 1 1 4 4
    
    ? 1 3 4 4
    
    ? 2 3 4 4
    
    ! 1 3 3 4