import sys input = sys.stdin.readline N,M=map(int,input().split()) S=[input().strip() for i in range(M)] A=[0]*N ind=0 mai=0 nec=1 for i in range(M): if S[i]=="skip": A[ind]-=1 ind=ind+nec+nec ind%=N elif S[i]=="reverse": A[ind]-=1 nec*=-1 ind=ind+nec ind%=N elif S[i]=="number": A[ind]-=1 ind=ind+nec ind%=N elif S[i]=="drawtwo": if i+1