#include "bits/stdc++.h" using namespace std; typedef long long ll; void Say(bool say, string a = "Yes", string b = "No"){cout << (say ? a : b) << endl;}; int main(){ ll N, M; cin >> N >> M; vectorans(N, 0); ll ad = 1, p = 0; string lst = "number"; ll tmp = 0; for(ll i = 0; i < M; i++){ string s; cin >> s; if(tmp){ if(s == lst){ ans[p]++; if(s == "drawtwo")tmp += 2; else tmp += 4; p = (p + N + ad) % N; continue; } else{ ans[p] -= tmp; tmp = 0; p = (p + N + ad) % N; } } ans[p]++; if(i + 1 == M)break; if(tmp == 0){ if(s == "number"){ } if(s == "drawtwo"){ tmp = 2; } if(s == "drawfour"){ tmp = 4; } if(s == "skip"){ p = (p + N + ad) % N; } if(s == "reverse"){ ad = -ad; } lst = s; p = (p + N + ad) % N; } } cout << p + 1 << " " << ans[p] << endl; return 0; }