#include<iostream>
#include<string>
using namespace std;
struct kk {
int head;
string nme;
} a[100005];
int main() {
long n,m;
cin>>n>>m;
for (int i=1; i<=n; i++) {
cin>>a[i].head>>a[i].nme;
}
int temp = 1;
int cloc = 1;
while (cloc <= m) {
int h,l;
cin>>h>>l;
if (h == 0) {
if (a[temp].head==0) {
temp = (temp+n-l)%n;
} else temp = (temp+l)%n;
}
else {
if (a[temp].head==1) temp = (temp+l)%n;
else temp = (temp+n-l)%n;
}
cloc=cloc+1;
}
cout<<a[temp].nme;
return 0;
}
求一下哪里写的有问题