#include #include #include #include #include struct uno { int n; int *p; int now; int d2cnt; int d4cnt; int rvflg; void init(int player) { n = player; p = new int[n]; for (int i=0;i> table = { { "number", [this](){p[now]++;} }, { "drawtwo", [this](){p[now]++;d2cnt+=2;} }, { "drawfour", [this](){p[now]++;d4cnt+=4;} }, { "skip", [this](){p[now]++;next();} }, { "reverse", [this](){p[now]++;rvflg=(rvflg+1)%2;} }, }; if ((d2cnt!=0)&&(type!="drawtwo")) { p[now]-=d2cnt; d2cnt=0; next(); } if ((d4cnt!=0)&&(type!="drawfour")) { p[now]-=d4cnt; d4cnt=0; next(); } table[type](); }; int getWinner() {return now;}; int getCard(int player) {return p[player];}; }; int main() { int n,m; scanf("%d %d", &n, &m); struct uno Uno; Uno.init(n); for (int i=0;i> s; Uno.f(s); if (i!=(m-1)) Uno.next(); } printf("%d %d\n", Uno.getWinner()+1, Uno.getCard(Uno.getWinner())); }