Task: Program Execution
Input (English): 9729, P, 1943, h, S, q, D, h, K, N, q, 7831, 1917, I, F, f, S, 1081, J
Output (English): 9729, 1943, 7831, 1917, 1081