#include<bits/stdc++.h>
using namespace std;
int read() {
char ch=getchar();
int f=1,x=0;
while(ch<'0'||ch>'9') {
if(ch=='-')
f=-1;
ch=getchar();
}
while(ch>='0'&&ch<='9') {
x=x10+ch-'0';
ch=getchar();
}
return fx;
}
const int maxn=1e6+10;
int n;
struct snakes {
int id,len;
}a[maxn];
deque<snakes> q1,q2,q;
void work() {
q1.clear();
q2.clear();//记得多组数据初始化
q.clear();
}