#include using namespace std; typedef long long ll; int main() { int n,m; cin>>n>>m; int cnt[n] {}; int turn = 0; int dir = 1; bool draw = false; for (int i = 0; i < m; i++) { string s; cin >> s; if (draw) { if (s == "drawtwo" || s == "drawfour") { cnt[turn]++; turn = (turn + dir + n) % n; continue; } else { turn = (turn + dir + n) % n; draw = false; } } cnt[turn]++; if (s == "drawtwo" || s == "drawfour") draw = true; else if (s == "reverse") dir = -dir; else if (s == "skip") turn = (turn + dir + n) % n; turn = (turn + dir + n) % n; } int winner = (turn - dir + n) % n; cout << winner + 1 << ' ' << cnt[winner] << endl; return 0; }