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 k = 1 pre = "" for j in range(m - 1): s = fmt_scan() if pre in ["drawtwo", "drawfour"]: if s != pre: ad[i % n] += 2 * k if "two" in pre else 4 * k i += r k = 1 else: k += 1 a[i % n].append(s) if s == "skip": i += r elif s == "reverse": r *= -1 i += r pre = s i %= n print(i + 1, len(a[i]) - ad[i] + 1) main()