Task: Program Execution
Input (English): 3941, l, Z, k, 3061, p, 5017, 1087, x, 3613, R, Q, K, x, 4163, p, q
Output (English): 3941, 3061, 5017, 1087, 3613, 4163