#include using namespace std; typedef long long ll; #define F first #define S second #define pii pair #define eb emplace_back #define all(v) v.begin(), v.end() #define rep(i, n) for (int i = 0; i < n; ++i) #define rep3(i, l, n) for (int i = l; i < n; ++i) #define chmax(a, b) a = max(a, b) #define chmin(a, b) a = min(a, b) #define out(a) cout << a << endl #define SZ(v) (int)v.size() #define inf (int)(1e9+7) //skip -> 2回カウンタ回す //two, four -> 連続の後の人skip(sample3で修正するけど) int c = 1; int rev, t, f; int n, m; int acc = 0; void counter() { if (rev) { c--; if (c == 0) c = n; } else { c++; if (c == n + 1) c = 1; } } int main() { cin >> n >> m; vector v(n + 1); rep(i, m) { string s; cin >> s; if ((t && s != "drawtwo") || (f && s != "drawfour")) { t = 0; f = 0; v[c] -= acc; //out(s << " " << c << " " << v[c]); acc = 0; counter(); } v[c] += 1;// out(s << " " << c << " " << v[c]); if (s == "drawfour") { t = 0; f = 1; acc += 4; } else if (s == "drawtwo") { f = 0; t = 1; acc += 2; } else { if (s == "reverse") { rev ^= 1; } if (s == "skip" || t || f) { counter(); } } if (i == m - 1) { cout << c << " " << v[c] << endl; break; } counter(); } }