/* -*- coding: utf-8 -*- * * 2502.cc: No.2502 Optimization in the Dark - yukicoder */ #include #include using namespace std; /* subroutines */ bool query(int i, int x, int j, int y) { printf("? %d %d %d %d\n", i + 1, x + 1, j + 1, y + 1); fflush(stdout); char s[8]; scanf("%s", s); return (s[0] == 'Y'); } void op1(int p0, int p1, int p2) { // 2 x 3 // 0 0 1 // 1 2 2 printf(" %d %d", p0 + 1, p1 + 1); printf(" %d %d", p2 + 1, p0 + 1); printf(" %d %d", p1 + 1, p2 + 1); } void op2(int p0, int p1, int p2) { // 4 x 3 // 0 0 1 // 1 2 3 // 2 4 4 // 3 5 5 printf(" %d %d", p0 + 1, p1 + 1); printf(" %d %d", p2 + 1, p0 + 1); printf(" %d %d", p1 + 1, p0 + 1); printf(" %d %d", p0 + 1, p2 + 1); printf(" %d %d", p1 + 1, p2 + 1); printf(" %d %d", p1 + 1, p2 + 1); } /* main */ int main() { int n; scanf("%d", &n); int n2 = n * 2; bool f0 = query(0, n2 - 1, 1, n2 - 1); int p0 = f0 ? 1 : 0; bool f1 = query(p0, n2 - 1, 2, n2 - 1); if (f1) p0 = 2; int p1 = (p0 + 1) % 3, p2 = (p0 + 2) % 3; bool f2 = query(p1, n2 - 2, p2, n2 - 2); if (f2) swap(p1, p2); // v[p0][n2] >= max(v[p1][n2], v[p2][n2] // v[p1][n2-1] >= v[p2][n2-1] int k = 0; putchar('!'); if (n & 1) op1(p0, p1, p2), k++; while (k < n) op2(p0, p1, p2), k += 2; putchar('\n'); fflush(stdout); return 0; }