bufio_scanner = [] def fmt_scan() -> str: sc = bufio_scanner if len(sc) == 0: for v in reversed(input().split()): sc.append(v) return sc.pop() def main(): n, m = [int(fmt_scan()) for _ in range(2)] a = [[] for _ in range(n)] ad = [0 for _ in range(n)] i = 0 r = 1 pre = "" for j in range(m): s = fmt_scan() if pre in ["drawtwo", "drawfour"] and s != pre: ad[i] += 2 if "two" in pre else 4 i = (i + r) % n a[i].append(s) if s == "skip": i += r elif s == "reverse": r *= -1 if j != m - 1: i = (i + r) % n pre = s print(i + 1, len(a[i]) - ad[i]) main()