#include #include using namespace std; vector L; vector R; int amida_to(int n){ for(int i=0;i>N; cin>>K; for(int i=0;i>X>>Y; L.push_back(X); R.push_back(Y); } for(int i=0;i>A; int to=amida_to(i+1); while(to>A){ L.push_back(to-1); R.push_back(to); to--; } while(to