#include #include #include using namespace std; #define MAX 10001 int a[MAX]; int visited[MAX]; int main() { memset(visited, -1, sizeof(visited)); for (int n=1; n0; nk-=1, n2k-=2) { int x = max(a[nk], a[n2k]); visited[x] = n; } int v=0; while (visited[v]==n) { v++; } printf("%d %d\n", n, a[n]=v); fflush(stdout); } return 0; }