不知道为什么RE,到底哪里错了?```cpp
#include<bits/stdc++.h>
using namespace std;
const int Max=1e5+10;
char s[20][Max];
int to[Max],a[Max],sn[Max];
int main(){
int n,m;scanf("%d%d",&n,&m);
for(int i=1;i<=n;i++){
scanf("%d %s",&to[i],s[i]);
}
for(int i=1;i<=m;i++){
scanf("%d %d",&a[i],&sn[i]);
}
int tot=1;
for(int i=1;i<=m;i++){
int way=to[tot]^a[i];
if(way==1){
while(sn[i]--){
tot++;
if(tot==n+1)tot=1;
}
}else{
while(sn[i]--){
tot--;
if(tot==0)tot=n;
}
}
}
cout<<s[tot];
return 0;
}
